
function popitup(url)
{
newwindow=window.open(url,'name','height=500, width=500');
if (window.focus) {newwindow.focus()}
return false;
}

function popfolio(url)
{
newwindow=window.open(url,'name','height=500, width=500');
if (window.focus) {newwindow.focus()}
return false;
}

function popgames(url)
{
newwindow=window.open(url,'name','height=700, width=700');
if (window.focus) {newwindow.focus()}
return false;
}

var W3CDOM = (document.createElement && document.getElementsByTagName);

function swap( name, src){
if (!W3CDOM) return;
if (document.images)
document.images[name].src = src;
}

function MM_findObj(n, d) {
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_preloadImagesFolio() {
var d=document; if(d.imagesfolio){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validate_GIFT()
{
	valid = true;
	var myalert;
	myalert="";
  


	if ( document.GIFTCERTIFICATES.whichPackage.value == "" )
	{
	myalert = "Please select a Surf Package. \n";
	valid = false;
	}

/*
	if ( document.GIFTCERTIFICATES.whichDelivery.value !== "" )
	{
		if ( document.GIFTCERTIFICATES.myGiftCardName.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's Name. \n";
		valid = false;
		}

		if ( document.GIFTCERTIFICATES.myGiftCardAddress.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's Address. \n";
		valid = false;
		}

		if ( document.GIFTCERTIFICATES.myGiftCardSuburb.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's Suburb. \n";
		valid = false;
		}

		if ( document.GIFTCERTIFICATES.myGiftCardState.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's State. \n";
		valid = false;
		}

		if ( document.GIFTCERTIFICATES.myGiftCardPostcode.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's Postcode. \n";
		valid = false;
		}


	}
	else if ( document.GIFTCERTIFICATES.whichDelivery.value !== "" )
	{
		if ( document.GIFTCERTIFICATES.giftCardEmail.value == "" )
		{
		myalert = myalert + "Please enter the Recipient's Email. \n";
		valid = false;
		}
	
	}
*/

	if ( document.GIFTCERTIFICATES.YOURCardName.value == "" )
	{
	myalert = myalert + "Card Details - enter YOUR Name. \n";
	valid = false;
	}

	if ( document.GIFTCERTIFICATES.YOURCardEmail.value == "" )
	{
	myalert = myalert + "Card Details - enter YOUR Email. \n";
	valid = false;
	}

	if ( document.GIFTCERTIFICATES.YOURCardContact.value == "" )
	{
	myalert = myalert + "Card Details - enter YOUR Contact details. \n";
	valid = false;
	}

	if ( document.GIFTCERTIFICATES.THEIRCardName.value == "" )
	{
	myalert = myalert + "Card Details - enter THEIR Name. \n";
	valid = false;
	}

	if ( document.GIFTCERTIFICATES.THEIRmessage.value == "" )
	{
	myalert = myalert + "Card Details - enter a message. \n";
	valid = false;
	}



	if ( document.GIFTCERTIFICATES.CardName.value == "" )
	{
	myalert = myalert + "Please enter Name on Credit Card. \n";
	valid = false;
	}

	if ( document.GIFTCERTIFICATES.CardNumber.value == "" )
	{
	myalert = myalert + "Please enter your Credit Card Number. \n";
	valid = false;
	}



	var j = document.GIFTCERTIFICATES.myTerms.checked;
	if ( j == false )
	{
	myalert = myalert + "Please check box to agree to our terms. \n";
	valid = false;
	}



	// FINAL ALERT IF ANY    
	if (myalert != "")
	{
	alert ( myalert );
	}
    
    
	return valid;
}





function validate_BOOK()
{
	valid = true;
	var myalert;
	myalert="";
  


	if ( document.BOOKINGS.myFirstName.value == "" )
	{
	myalert = "Please enter your First Name. \n";
	valid = false;
	}


	if ( document.BOOKINGS.myLastName.value == "" )
	{
	myalert = myalert + "Please enter your Last Name. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myPhone.value == "" )
	{
	myalert = myalert + "Please enter your Phone Number. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myEmail.value == "" )
	{
	myalert = myalert + "Please enter your Email. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myNationality.value == "" )
	{
	myalert = myalert + "Please enter your Nationality. \n";
	valid = false;
	}

	if ( document.BOOKINGS.whichPackage.value == "" )
	{
	myalert = myalert + "Please choose a package. \n";
	valid = false;
	}

	if ( document.BOOKINGS.date.value == "" )
	{
	myalert = myalert + "Please select a date. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myPeople.value == "" )
	{
	myalert = myalert + "Please enter number of people. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myHearAbout.value == "" )
	{
	myalert = myalert + "How did you hear about us. \n";
	valid = false;
	}

	if ( document.BOOKINGS.CardHoldersName.value == "" )
	{
	myalert = myalert + "Please enter Card Holders Name. \n";
	valid = false;
	}

	if ( document.BOOKINGS.CardNumber.value == "" )
	{
	myalert = myalert + "Please enter Card Number. \n";
	valid = false;
	}

	if ( document.BOOKINGS.CardExpiryMonth.value == "" )
	{
	myalert = myalert + "Please enter Expiry Month. \n";
	valid = false;
	}

	if ( document.BOOKINGS.CardExpiryYear.value == "" )
	{
	myalert = myalert + "Please enter Expiry Year. \n";
	valid = false;
	}

	if ( document.BOOKINGS.myCardType.value == "" )
	{
	myalert = myalert + "Please enter Card Type. \n";
	valid = false;
	}

	var j = document.BOOKINGS.myTerms.checked;
	if ( j == false )
	{
	myalert = myalert + "Please check box to agree to our terms. \n";
	valid = false;
	}



	// FINAL ALERT IF ANY    
	if (myalert != "")
	{
	alert ( myalert );
	}
    
    
	return valid;
}









function validate_SIDE()
{
	valid = true;
	var myalert;
	myalert="";
  


	if ( document.BOOKCHECK.myName.value == "" )
	{
	myalert = "Please enter your Name. \n";
	valid = false;
	}


	if ( document.BOOKCHECK.myEmail.value == "" )
	{
	myalert = myalert + "Please enter your Email. \n";
	valid = false;
	}

	if ( document.BOOKCHECK.myPhone.value == "" )
	{
	myalert = myalert + "Please enter your Phone Number. \n";
	valid = false;
	}

	if ( document.BOOKCHECK.myEmail.value == "" )
	{
	myalert = myalert + "Please enter your Email. \n";
	valid = false;
	}

	if ( document.BOOKCHECK.myPeople.value == "" )
	{
	myalert = myalert + "Please enter number of People. \n";
	valid = false;
	}
/*
	if ( document.BOOKCHECK.whichPackage.value == "" )
	{
	myalert = myalert + "Please select a Package. \n";
	valid = false;
	}
*/

	if ( document.BOOKCHECK.date.value == "" )
	{
	myalert = myalert + "Please enter a Date. \n";
	valid = false;
	}


	// FINAL ALERT IF ANY    
	if (myalert != "")
	{
	alert ( myalert );
	}
    
    
	return valid;
}














// GIFT VOUCHER #####  
function calcGift(x){

  var amount = "";
  
  var whichPackage =  document.GIFTCERTIFICATES.whichPackage.value;
  
  
  if (whichPackage == "Gift Certificate Card $50")
  {
  amount = "$50.00";
  }
  
  if (whichPackage == "1 x Kids Full Day Holiday Surf Adventure $89")
  {
  amount = "$89.00";
  }

  if (whichPackage == "1 Full Day Surf Adventure - $89")
  {
  amount = "$89.00";
  }
  
  if (whichPackage == "2 x Full Day Surf Adventures $155")
  {
  amount = "$155.00";
  }
  
  if (whichPackage == "Weekender Surf Camp $219")
  {
  amount = "$219.00";
  }
  
  
  if (whichPackage == "3 Day Progressive $210")
  {
  amount = "$210.00";
  }
  
  if (whichPackage == "Adventure 1 Day Tour +  Weekender Surfcamp $308")
  {
  amount = "$308.00";
  }
  
  if (whichPackage == "Family Full Day Adventure Package ( 2 Adults & 2 Kids ) $350")
  {
  amount = "$350.00";
  }
  
  if (whichPackage == "4 Day Progressive $275")
  {
  amount = "$275.00";
  }
  
  if (whichPackage == "Private Lesson Full Day (1-2 persons) $360")
  {
  amount = "$360.00";
  }

  
  if (whichPackage == "Ultimate Sydney To Byron Bay 5 Days $599")
  {
  amount = "$599.00";
  }
  if (whichPackage == "1 Day Package")
  {
  amount = "$89.00";
  }

  document.GIFTCERTIFICATES.myAmount.value = amount;
}



function Comma(number)  {
number = '' + number;
if (number.length > 3) {
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++) {
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}





// GIFT VOUCHER #####	


function calcBOOKINGS(){

	var amount = "";
	
	var whichPackage =	document.BOOKINGS.whichPackage.value;
	var mypeops =	document.BOOKINGS.myPeople.value;
	var myBag =	 document.BOOKINGS.myBag.value;
	divBag = document.getElementById('Bag');
	divBag1 = document.getElementById('Bag1');
	divPickupday = document.getElementById('Pickupday');
	divPickupday1 = document.getElementById('Pickupday1');
	divPickup = document.getElementById('Pickup');
	divPickup1 = document.getElementById('Pickup1');
	divfriends = document.getElementById('friends');
	divfriends1 = document.getElementById('friends1');
	divPickupC = document.getElementById('PickupC');	

	if (whichPackage == "1 Day Package")
	{amount = "89";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "2 day Progressive")
	{amount = "155";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "3 day Progressive")
	{amount = "210";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "4 day Progressive")
	{amount = "275";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "1 Day Private Lesson (1 or 2 persons)")
	{amount = "360";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Weekender Surf Camp")
	{amount = "239";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Sydney to Byron")
	{amount = "499";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Corporate")
	{amount = "";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Kids 1 Day Program")
	{amount = "89";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Kids 2 Day Program")
	{amount = "159";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Kids 3 Day Program)")
	{amount = "219";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Kids 4 Day Program")
	{amount = "289";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Kids 2 Day Overnight Camp")
	{amount = "199";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Midweek Surf Camp")
	{amount = "199";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Sydney to Byron High Season")
	{amount = "";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Byron to Sydney")
	{amount = "Call us for a quote";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Byron to Sydney Express (2days)")
	{amount = "279";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "Sydney to Byron Express (2days)")
	{amount = "199";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "9 Day Sydney to Byron")
	{amount = "939";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "9 Day Byron to Sydney")
	{amount = "799";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	if (whichPackage == "9 Day Byron to Sydney (High Season)")
	{amount = "899";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}	
	
	if (whichPackage == "5 Day Sydney to Byron")
	{amount = "499";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}	
	
	if (whichPackage == "5 Day Sydney to Byron (High Season)")
	{amount = "599";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}	
	
	if (whichPackage == "5 Day Byron to Sydney")
	{amount = "499";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}	
	
	if (whichPackage == "5 Day Byron to Sydney (High Season)")
	{amount = "599";Bag.style.display = "none";Bag1.style.display = "none";Pickupday.style.display = "block";Pickupday1.style.display = "block";Pickup.style.display = "none";Pickup1.style.display = "none";}
	
	/*
	if (whichPackage == "Day tour package")
	{
	amount = "89";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "2 day progressive")
	{
	amount = "155";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "3 day progressive")
	{
	amount = "210";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "4 day progressive")
	{
	amount = "275";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "1 Day Private Lesson (1 or 2 persons)")
	{
	amount = "360";
	mypeops = "1"
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "Weekender Surfcamp")
	{
	amount = "219";
	Bag.style.display = "block";
	Bag1.style.display = "block";
	Pickupday.style.display = "none";
	Pickupday1.style.display = "none";
	Pickup.style.display = "block";
	Pickup1.style.display = "block";
	}
	
	if (whichPackage == "Sydney to Byron")
	{
	amount = "599";
	Bag.style.display = "block";
	Bag1.style.display = "block";
	Pickupday.style.display = "none";
	Pickupday1.style.display = "none";
	Pickup.style.display = "block";
	Pickup1.style.display = "block";
	}
	
	if (whichPackage == "Corporate")
	{
	amount = "0";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "none";
	Pickupday1.style.display = "none";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	PickupC.style.display = "block";
	}
	
	if (whichPackage == "Kids 1 Day Program")
	{
	amount = "89";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "Kids 2 Day Program")
	{
	amount = "159";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "Kids 3 Day Program")
	{
	amount = "219";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "Kids 4 Day Program")
	{
	amount = "289";
	Bag.style.display = "none";
	Bag1.style.display = "none";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	
	if (whichPackage == "Kids 2 Day Overnight Camp")
	{
	amount = "199";
	Bag.style.display = "block";
	Bag1.style.display = "block";
	Pickupday.style.display = "block";
	Pickupday1.style.display = "block";
	Pickup.style.display = "none";
	Pickup1.style.display = "none";
	}
	*/
	
	if (mypeops == "1")
	{
		friends.style.display = "none";
		friends1.style.display = "none";
	}
	else
	{
		friends.style.display = "block";
		friends1.style.display = "block";
	}

	if (myBag == "")
	{
		myBag = 10;
	}
	var TotalK = Math.round (myBag*10);

	if (mypeops == "")
	{
	mypeops = 1;
	}
	
	var TotalJ = Math.round(amount * mypeops);
	
	var TotalL = Math.round(TotalJ + TotalK)
	
	amount = "$";
	amount = amount + TotalL;
	amount = amount + ".00";
	
	
	document.BOOKINGS.myAmount.value = amount;
	
}




