<!--

	//================================================================================================
	// VARIABLES DECLARATION
	//================================================================================================	
	var openContactUs = false, openNewsletter = false;
	var detailsShow;
	var selectedTab = 1, selectedPromo = 1, totalColumns = 0, totalPromos = 0;
	var timerPromo;
	var INTERVAL_PROMO = 6000;
	
	//================================================================================================
	// AJAX FUNCTIONS
	//================================================================================================		
	function registerOpenDay(listID, opendaytitle, opendayaddress, fullname, email, phone)
	{
		var url = "process.asp";

		var data = "process=openday";
		data = data + "&fullname=" + fullname;
		data = data + "&opendaytitle=" + opendaytitle;
		data = data + "&opendayaddress=" + escape(opendayaddress);
		data = data + "&email=" + email;
		data = data + "&phone=" + phone;
		data = data + "&listID=" + listID;
		data = data + "&sid=" + Math.random();		
		
		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {
        alert(txt);
        document.opendayform.reset();
			},
			
			onFailure: function() {
				alert("Error connecting to server. Please refresh this page...");
			}
			
		}).send(data);
	}
  
	function sendEnquiry(fullname, email, phone, location, comment)
	{
		var url = "process.asp";

		var data = "process=contact";
		data = data + "&fullname=" + fullname;
		data = data + "&email=" + email;
		data = data + "&phone=" + phone;
		data = data + "&location=" + location;
		data = data + "&comment=" + escape(comment);
		data = data + "&sid=" + Math.random();		
		
		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {			
				alert(txt);				
				hideContactUs();
				document.contactform.reset();
			},
			
			onFailure: function() {
				alert("Error connecting to server. Please refresh this page...");
			}
			
		}).send(data);
	}	
	
	function signupNewsletter(listID, fullname, email)
	{
		var url = "process.asp";

		var data = "process=recipient";
		data = data + "&action=add-jax";
		data = data + "&listID=" + listID;
		data = data + "&fullname=" + fullname;
		data = data + "&email=" + email;
		data = data + "&sid=" + Math.random();

		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {
				alert(txt);
				hideNewsletter();
				document.signupform.reset();
			},

			onFailure: function() { 
				alert("Error connecting to server. Please refresh this page and try again.");	
			}

		}).send(data);
	}	
	
	function sendEnquiryHome(id, subject, link, fullname, email, phone, comment)
	{
		var url = "process.asp";

		var data = "process=enquiry";
		data = data + "&subject=" + subject;
		data = data + "&link=" + link;
		data = data + "&fullname=" + fullname;
		data = data + "&email=" + email;
		data = data + "&phone=" + phone;
		data = data + "&comment=" + escape(comment);
		data = data + "&sid=" + Math.random();		
		
		var btn_submit = $('btn_submit_enquiry_' + id);
		
		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {			
				alert(txt);				
				$(btn_submit).disabled = 0;
				$(btn_submit).set('value', $(btn_submit).get('title'));
				
				$('enquiryform_' + id).reset();
				//document.getElementById("sendtofriendform_" + id).reset();
			},
			
			onRequest: function() { 
				$(btn_submit).disabled = 1;
				$(btn_submit).set('value', 'Processing...');
			},
			
			onFailure: function() { 
				alert("Error connecting to server. Please refresh this page and try again.");					
				$(btn_submit).disabled = 0;
				$(btn_submit).set('value', $(btn_submit).get('title'));
			}	
			
		}).send(data);
	}	

	function sendToFriend(id, subject, link, fullname, email, friend_emails, comment)
	{
		var url = "process.asp";

		var data = "process=sendtofriend";
		data = data + "&subject=" + subject;
		data = data + "&fullname=" + fullname;
		data = data + "&email=" + email;
		data = data + "&friend_emails=" + friend_emails;
		data = data + "&link=" + link;
		data = data + "&comment=" + escape(comment);
		data = data + "&sid=" + Math.random();		
		
		var btn_submit = $('btn_submit_sendtofriend_' + id);
		
		var req = new Request( {method: 'get', url: '' + url, 

			onSuccess: function(txt) {			
				alert(txt);				
				$(btn_submit).disabled = 0;
				$(btn_submit).set('value', $(btn_submit).get('title'));
				
				$('sendtofriendform_' + id).reset();
				//document.getElementById("sendtofriendform_" + id).reset();
			},
			
			onRequest: function() { 
				$(btn_submit).disabled = 1;
				$(btn_submit).set('value', 'Processing...');
			},
			
			onFailure: function() { 
				alert("Error connecting to server. Please refresh this page and try again.");					
				$(btn_submit).disabled = 0;
				$(btn_submit).set('value', $(btn_submit).get('title'));
			}	
			
		}).send(data);
	}		
	
	//================================================================================================
	// FORM FUNCTIONS
	//================================================================================================
	function submitEnquiry()
	{
		var form = document.contactform;

		var c_fullname = form.fullname.value;
		var c_email = form.email.value;
		var c_phone = form.phone.value;
		var c_location = form.location.value;
		var c_comment = form.comment.value;

		var valid = true;

		if ((c_fullname == "") || (c_fullname == "Your full name")) 
		{
			valid = false;
			alert("Please make sure you have entered your full name.");
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			alert("Please make sure you have entered a valid e-mail address.");
		}
		else if ((c_phone == "") || (c_phone == "Contact number")) 
		{
			valid = false;
			alert("Please make sure you have entered your phone number.");
		}
		else if ((c_comment == "") || (c_comment == "Your enquiry")) 
		{
			valid = false;
			alert("Please make sure you have entered your enquiry.");
		}

		if (valid == true)
		{
			sendEnquiry(c_fullname, c_email, c_phone, c_location, c_comment);
		}
	}
	
	function submitSubscription()
	{
		var message = "";
		var form = document.signupform;

		var c_listID = form.listID.value;
		var c_name = form.fullname.value;
		var c_email = form.email.value;

		var valid = true;

		if ((c_name == "") || (c_name == "Your name"))
		{
			valid = false;
			message = message + "Please make sure you've entered your name.\n";
		}

		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			message = message + "Please make sure you've entered valid e-mail address.";
		}

		if (valid == true) 
		{
			signupNewsletter(c_listID, c_name, c_email);
		}
		else
		{
			alert(message);
		}
	}	
	
	function submitEnquiryHome(id)
	{
		var form = document.getElementById("enquiryform_" + id);

		var c_subject = form.subject.value;
		var c_link = form.link.value;
		var c_fullname = form.fullname.value;
		var c_email = form.email.value;
		var c_phone = form.phone.value;
		var c_comment = form.comment.value;

		var valid = true;

		if ((c_fullname == "") || (c_fullname == "Your full name")) 
		{
			valid = false;
			alert("Please make sure you have entered your full name.");
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			alert("Please make sure you have entered a valid e-mail address.");
		}
		else if ((c_comment == "") || (c_comment == "Your enquiry")) 
		{
			valid = false;
			alert("Please make sure you have entered your enquiry.");
		}

		if (valid == true)
		{
			sendEnquiryHome(id, c_subject, c_link, c_fullname, c_email, c_phone, c_comment);
		}
	}			
	
	function submitSendToFriend(id)
	{
		var form = document.getElementById("sendtofriendform_" + id);

		var c_subject = form.subject.value;
		var c_link = form.link.value;
		var c_fullname = form.fullname.value;
		var c_email = form.email.value;
		var c_friend_emails = form.friend_emails.value;
		var c_comment = form.comment.value;

		var valid = true;

		if ((c_fullname == "") || (c_fullname == "Your full name")) 
		{
			valid = false;
			alert("Please make sure you have entered your full name.");
		}
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			alert("Please make sure you have entered a valid e-mail address.");
		}
		else if ((c_friend_emails == "")) 
		{
			valid = false;
			alert("Please make sure you have entered your friend emails.");
		}
		else if ((c_comment == "") || (c_comment == "Your enquiry")) 
		{
			valid = false;
			alert("Please make sure you have entered your enquiry.");
		}

		if (valid == true)
		{
			sendToFriend(id, c_subject, c_link, c_fullname, c_email, c_friend_emails, c_comment);
		}
	}	
	
	function submitOpenDayRegistration()
	{
		var form = document.opendayform;
		
		var c_listID = form.listID.value;
		var c_opendaytitle = form.opendaytitle.value;
		var c_opendayaddress = form.opendayaddress.value;
		var c_email = form.email.value;
		var c_phone = form.phone.value;
		var c_fullname = form.fullname.value;
		
		var valid = true;
		
		if ((c_fullname == "") || (c_fullname.toUpperCase() == "YOUR FULL NAME")) 
		{
			valid = false;
			alert("Please make sure you have entered your full name.");		
		} 
		else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(c_email)))
		{
			valid = false;
			alert("Please make sure you have entered a valid e-mail address.");		
		}
		else if ((c_phone == "") || (c_phone.toUpperCase() == "YOUR PHONE")) 
		{
			valid = false;
			alert("Please make sure you have entered your contact number.");		
		} 
		
		if (valid == true) 
		{
			registerOpenDay(c_listID,c_opendaytitle,c_opendayaddress,c_fullname,c_email,c_phone);
		}		
	}
  
	//================================================================================================
	// LAYOUT FUNCTIONS 
	//================================================================================================			
	function goTop()
	{
		new Fx.Scroll($(window)).toTop();
	}

	function showNewsletter()
	{
		hideContactUs();
		if (!openNewsletter)
		{
			goTop();
			$('mailinglist').setStyles({ 'display' : 'block', 'opacity' : 0 });
			new Fx.Tween('mailinglist').start('opacity', 0, 1);
			openNewsletter = true;
		}
	}	
		
	function hideNewsletter()
	{
		if (openNewsletter)
		{
			new Fx.Tween('mailinglist').start('opacity', 1, 0).chain(function(){
				$('mailinglist').setStyle('display', 'none');
			});
			openNewsletter = false;
		}
	}	

	function toggleNewsletter()
	{
		if (openNewsletter)
		{
			hideNewsletter();
		} 
		else
		{
			showNewsletter();
		}
	}	
	
	function showContactUs()
	{
		hideNewsletter();
		if (!openContactUs)
		{
			goTop();
			$('contactus').setStyles({ 'display' : 'block', 'opacity' : 0 });
			new Fx.Tween('contactus').start('opacity', 0, 1);
			openContactUs = true;
		}
	}	
		
	function hideContactUs()
	{
		if (openContactUs)
		{
			new Fx.Tween('contactus').start('opacity', 1, 0).chain(function(){
				$('contactus').setStyle('display', 'none');
			});			
			openContactUs = false;
		}
	}	

	function toggleContactUs()
	{
		if (openContactUs)
		{
			hideContactUs();
		} 
		else
		{
			showContactUs();
		}
	}
	
	function showGalleryTab(id)
	{
		if($chk($('gallery_tab_1')))
		{
			if(id != selectedTab)
			{
				selectedTab = id;
			}

			new Fx.Scroll($('scrolling_thumbs')).toElement('gallery_tab_' + id);
		}
	}		
	
	function prevGalleryTab()
	{
		var tab;

		tab = selectedTab; 
		tab--;
		if (tab < 1)
		{
			tab = totalColumns;
		}		
		showGalleryTab(tab);
	}	
	
	function nextGalleryTab()
	{
		var tab;

		tab = selectedTab; 
		tab++;
		if (tab > totalColumns)
		{
			tab = 1;
		}		
		showGalleryTab(tab);
	}		
	
	function showPromoTab(id)
	{
		if($chk($('promo_content_1')))
		{
			if(id != selectedPromo)
			{
				selectedPromo = id;
			}

			new Fx.Scroll($('scrollable_promos')).toElement('promo_content_' + id);
			new Fx.Scroll($('banner_home')).toElement('promo_image_' + id);
			
			clearInterval(timerPromo);
			timerPromo = nextPromoTab.periodical(INTERVAL_PROMO);
		}
	}
	
	var prevPromoTab = function()
	{
		var tab;

		tab = selectedPromo; 
		tab--;
		if (tab < 1)
		{
			tab = totalPromos;
		}		
		showPromoTab(tab);
	}	
	
	var nextPromoTab = function()
	{
		var tab;

		tab = selectedPromo; 
		tab++;
		if (tab > totalPromos)
		{
			tab = 1;
		}		
		showPromoTab(tab);
	}	
  
	function initLayouts()
	{
		hideEnquiryBoxes()
	}
  
	function showEnquiryBox(id)
	{
		if ($chk($('enquiry_box_' + id)))
		{
			hideSendToFriendBox(id);
			new Fx.Reveal($('enquiry_box_' + id)).reveal();
		}		
	}
	
	function hideEnquiryBox(id)
	{
		if ($chk($('enquiry_box_' + id)))
		{
			new Fx.Reveal($('enquiry_box_' + id)).dissolve();
		}		
	}	

	function toggleEnquiryBox(id)
	{
		if ($chk($('enquiry_box_' + id)))
		{
			new Fx.Reveal($('enquiry_box_' + id)).toggle();
		}		
	}
	
	function showSendToFriendBox(id)
	{
		if ($chk($('sendtofriend_box_' + id)))
		{
			hideEnquiryBox(id);
			new Fx.Reveal($('sendtofriend_box_' + id)).reveal();
		}		
	}
	
	function hideSendToFriendBox(id)
	{
		if ($chk($('sendtofriend_box_' + id)))
		{
			new Fx.Reveal($('sendtofriend_box_' + id)).dissolve();
		}		
	}	
	
	function hideEnquiryBoxes()
	{
		if ($chk($$('.enquiry_box')))
		{
			$$('.enquiry_box').setStyle('display', 'none');
		}			
		if ($chk($$('.enquiry_home_box')))
		{
			$$('.enquiry_home_box').setStyle('display', 'none');
		}			
	}	
	
	function showDisclaimer(type, id)
	{
		if ($chk($(type + '_disclaimer_' + id)))
		{
			new Fx.Reveal($(type + '_disclaimer_' + id)).reveal();
		}		
	}
	
	function hideDisclaimer(type, id)
	{
		if ($chk($(type + '_disclaimer_' + id)))
		{
			new Fx.Reveal($(type + '_disclaimer_' + id)).dissolve();
		}		
	}	

	function toggleDisclaimer(type, id)
	{
		if ($chk($(type + '_disclaimer_' + id)))
		{
			new Fx.Reveal($(type + '_disclaimer_' + id)).toggle();
		}		
	}	
	
	//================================================================================================
	// EVENTS FUNCTIONS
	//================================================================================================		
	function setupActions()
	{	
		if ($chk($$('.img_hover')[0])) 
		{				
			$$('.img_hover').setStyle('opacity', 0.7);
			$$('.img_hover').addEvents({
			
				'mouseover' : function(e) {
					this.setStyle('opacity', 1);
				},
			
				'mouseout' : function(e) {
					this.setStyle('opacity', 0.7);
				}
				
			});					
		}
		
		if ($chk($$('.gallery_hover')[0])) 
		{				
			$$('.gallery_hover').setStyle('opacity', 0.5);
			$$('.gallery_hover').addEvents({
			
				'mouseover' : function(e) {
					if (!this.hasClass('disabled_hover'))
					{
						this.setStyle('opacity', 1);
					}
				},
			
				'mouseout' : function(e) {
					if (!this.hasClass('disabled_hover'))
					{
						this.setStyle('opacity', 0.5);
					}
				}
				
			});					
		}
		
		if ($chk($$('.hoverHighlight')))
		{
			$$('.hoverHighlight').addEvents({
				'click' : function(e) {
					var idx = $$('.hoverHighlight').indexOf(this);
					detailsShow.go(parseInt(idx));
				}
			});
		}			
	}	
	
	function setupCufons()
	{
		Cufon.replace('.futura_medium, .navlink', { fontFamily: 'Futura Medium', hover: true });
		Cufon.replace('.home_title', { fontFamily: 'Futura Medium', textShadow: '2px 2px rgba(0, 0, 0, 0.6)' });
		Cufon.replace('.package_intro, .package_price', { fontFamily: 'Futura Medium' });
	}			
	
	function setupSlideshows()
	{
		if ($chk($$('.homedetails')))
		{			
			detailsShow = new Slideshow('banner', false, {captions: true, delay: 4000, width: 980, height: 370});
			totalColumns = $$('.tab_thumbs').length;
		}	
		
		if ($chk($('scrollable_promos')))
		{			
			totalPromos = $$('.home_promo_box').length;
			showPromoTab(1);
		}		
	}	

	function showOpenDay()
	{
    if($chk($('openday')))
    {
      $('openday').setStyles({ 'display' : 'block', 'opacity' : 0 });
      new Fx.Tween('openday').start('opacity', 0, 1);
    }
	}	  
  
	function hideOpenDay()
	{
    $('openday').setStyle('display', 'none');
	}	  
  	
	//================================================================================================
	// GOOGLE MAP
	//================================================================================================		
	function initialize() {
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("container_map"));
			map.enableScrollWheelZoom();
			map.disableDoubleClickZoom();
			map.setUIToDefault();
			geocoder = new GClientGeocoder();
			geocoder.setBaseCountryCode("AU");
		}
	}
	
	function markAddress(address, heading) {
		if (geocoder) {
		  geocoder.getLatLng(
			 address,
			 function(point) {
				if (!point) {
				  //alert(address + " not found");
				} else {
				  //map.setCenter(point, 13);
				  map.addOverlay(createMarker(point, address, heading));
				}
			 }
		  );
		}
	}

	function createMarker(point, address, heading) {
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {
			var myHtml = "<strong>" + heading + "</strong><br />" + address;
			map.openInfoWindowHtml(point, myHtml);
		});
		return marker;
	}
	
	function setupGoogleMap()
	{
		var tmpHeading; 
		
		if ($chk($('container_map')))
		{
			initialize();	
			map.setCenter(new GLatLng(-37.899781,144.698868), 9);
			
			$$('.map_marker').each(function(item, index) {
				tmpHeading = $('marker_heading_' + item.get('id')).get('html');
				markAddress(item.get('html'), tmpHeading);
			});			
		}
	}	
	
	//================================================================================================
	// START THIS WHEN PAGE DOM READY
	//================================================================================================		
	window.addEvents({
	
		'domready' : function(e) {
			setupSlideshows();
			showGalleryTab(1);
			initLayouts();
			setupCufons();
			setupActions();
			setupGoogleMap();
      showOpenDay();
		},
		
		'resize' : function() {
		}
		
	});
	

//-->
