﻿function pageint() {
	$(document).ready(function () {
		applycufont();

		$("#navigation_right").accordion({
			header: '.head_right'
		});

		$(function () {
			$(".datepicker").datepicker({ 
			dateFormat: 'dd/mm/yy',
			buttonImage: '/Assets/images/cal.gif',
			buttonImageOnly: false,
			showOn: 'both',
			onSelect: function () { $(".ui-datepicker a").removeAttr("href"); }
		});

		});


		$("label").inFieldLabels();

		$(".jobtypecombo").sexyCombo({
			autoFill: false,
			skin: "custom"
		});


//		$(".hoverfx").mouseover(function () {
//			$(this).animate({ opacity: 1.0 }, 1500);
//		});

//		$(".hoverfx").mouseout(function () {
//			$(this).animate({ opacity: 0.5 }, 1500);
//		});

		$(".thickbox").fancybox({
			'autoScale': false,
			'width': 640,
			'height': 400,
			'transitionIn': 'elastic',
			'transitionOut': 'none',
			'overlayColor':'#333',
			'type': 'iframe'
		});

		$(".thickvideo").fancybox({
			'autoScale': false,
			'width': 480,
			'height': 270,
			'overlayColor': '#333',
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'type': 'iframe'
		});

		

		$(".thickboxgame").fancybox({
			'autoScale': false,
			'width': 640,
			'height': 480,
			'overlayColor': '#333',
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'type': 'iframe'
		});


		$(".thickboxsendtofriend").fancybox({
			'autoScale': false,
			'width': 440,
			'height': 440,
			'overlayColor': '#333',
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'type': 'iframe'
		});
	});
}

function applycufont() {
	Cufon.replace('h2');
	Cufon.replace('h1');
	Cufon.replace('h3');
	Cufon.replace('h4');
	Cufon.replace('#leftnavigation #leftnavigationbottom a', { hover: true });
}

function addMarker(lat, lng, name, info) {

	return marker = new google.maps.Marker({
	position: new google.maps.LatLng(lat,lng),
	map: map,
	shadow: '/Assets/images/shadow-logo.png',
	icon: '/Assets/images/logo_30.gif'
	})

}

function newWindow(htmlfile) {
	htmlWindow = window.open(htmlfile, 'map', 'width=690,height=680,toolbar=no,scrollbars=no')
	if (window.focus) { htmlWindow.focus() }
}

function CheckboxAlert(checkboxName) {
	var stores = document.getElementsByName("id_store");
	var count = 0;
	for (i = 0; i < stores.length; i++) {
		if (stores[i].checked) {
			count++;
			if (count > 3) {
				checkboxName.checked = false;
				alert('You cannot apply for more than 3 positions!');
			}
			else {
				if (count > 0) {
					$('#selectStore').fadeOut('fast', function () {
						$('#applybuttonsearch').fadeIn('fast');
					});
				}
				else {

				}
			}
		}
	}

	if (count == 0) {
		$('#applybuttonsearch').fadeOut('fast', function () {
			$('#selectStore').fadeIn('fast');
		});
	}
}

function showerrorpopup() {
	$('#errormessage').dialog({draggable: false, resizable: false, modal: true});
}

function checkClick() {
	var stores = document.getElementsByName("id_store");
	var count = 0;
	for (i = 0; i < stores.length; i++) {
		if (stores[i].checked) {
			count++;
		}
	}
	if (count == 0) {
		alert('Select at least one position.');
		return false;
	}
}

function make_blank() {
	if (document.getElementsByName("searchInStore").value != "Postcode or Suburb")
	{ }
	else
	{ document.getElementsByName("searchInStore").value = ""; }
}

function loadgooglemapobjects(intlat, intlong) {
	loadMap(intlat, intlong);
	loadMarkers();
}

function loadMap(intlat, intlong) {
	var mapcenterpoint = new google.maps.LatLng(intlat, intlong);
	 var myOptions = {
		zoom: 12,
		center: mapcenterpoint,
		 disableDefaultUI: true,
		 panControl: false,
		zoomControl: true,
		streetViewControl:true,
		mapTypeControl: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};

	map = new google.maps.Map(document.getElementById('gmap'), myOptions);

}

function mapzoomIn(){
	map.setZoom(map.getZoom()+1);
}

function mapzoomOut(){
	map.setZoom(map.getZoom()-1);
}

