// *** START *** Frame Buster Script

if (window != window.top)
  top.location.href = location.href;

// *** END *** Frame Buster Script


// *** START *** List View Table Row Rollover Effect Script

	function mouseOverWhite(i) {
		i.style.backgroundColor='#F7E360';
	}
	function mouseOutWhite(i) {
		i.style.backgroundColor='#FFFFFF';
	}
	
	function mouseOverGray(i) {
		i.style.backgroundColor='#F7E360';
	}
	function mouseOutGray(i) {
		i.style.backgroundColor='#F2F2F2';
	}
	
// *** END *** List View Table Row Rollover Effect Script




// *** START *** On-Click Pop-up and Center Window Script
// Requires "onClick="NewWindow(this.href,'title','400','300','no');return false;"" in the A HREF tag
// Example: <a href="doc.html" onClick="NewWindow(this.href,'title','400','300','no');return false;">LINK</a>

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// *** END *** On-Click Pop-up and Center Window Script




// *** START *** Auto Select Form Field Script

// Requires "onLoad=ready()" in the BODY tag
// Example: <body onLoad=ready()>
// Requires form name to match where it reads "form" in script
// Example: <form name="form">
// Requires form field name to match where it reads "field" in script
// Example: <input name="field">

function ready(){document.form.field.focus();}

// *** END *** Auto Select Form Field Script

function validateFindAgent(form) {
	return (
				 checkSelect(form.elements["salut"],"V","","Please specify your Salutation.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkString(form.elements['city'],'City',false) &&
				 checkSelect(form.elements["state"],"V","","Please select your State or Province from the dropdown.",false) &&
				 checkSelect(form.elements["country"],"V","","Please select your Country from the dropdown.",false) );
}


function validateSports(form) {
	return (
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkSelect(form.elements["city"],"V","","Please tell us what City you will be departing from.",false) &&
				 checkSelect(form.elements["people"],"V","","Please tell us how many People you have going.",false) &&
				 checkSelect(form.elements["cabins"],"V","","Please tell us how many Cabins you need.",false) );
}


function validateJobs(form) {
	return (
				 checkSelect(form.elements["salut"],"V","","Please specify your Salutation.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkString(form.elements['city'],'City',false) &&
				 checkSelect(form.elements["state"],"V","","Please select your State or Province from the dropdown.",false) &&
				 checkSelect(form.elements["experience"],"V","","Please tell us your Cruise Sales Experience.",false) );
}


function validateClasses(form) {
	return (
				 checkSelect(form.elements["salut"],"V","","Please specify your Salutation.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkString(form.elements['city'],'City',false) &&
				 checkSelect(form.elements["state"],"V","","Please select your State or Province from the dropdown.",false) &&
				 checkSelect(form.elements["classes"],"V","","Please specify the Classes you want to take.",false) &&
				 checkSelect(form.elements["experience"],"V","","Please tell us your Cruise Sales Experience.",false) );
}


function validateUnsub(form) {
	return (
				 checkEmail(form.elements["email"],false) );
}


function validateBasic(form) {
	return (
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false));
}


function validateQuickQuote(form) {
	return (
				 checkSelect(form.elements["cdatem"],"V","","Please select the Month for your Cruise Date.",false) &&
				 checkSelect(form.elements["cdatey"],"V","","Please select the Year for your Cruise Date.",false) &&
				 checkSelect(form.elements["leadDest"],"V","","All fields are required - Please select a Desired Destination.",false) &&
				 checkSelect(form.elements["cruiselength"],"V","","All fields are required - Please tell us your Desired Cruise Length.",false) &&
				 checkSelect(form.elements["firstname"],"V","First Name","All fields are required - Please supply your First Name.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkSelect(form.elements["lastname"],"V","Last Name","All fields are required - Please supply your Last Name.",false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false));
}


function validateQuote(form) {
	return (
				 checkSelect(form.elements["leadDest"],"V","","Please select a Destination.",false) &&
				 checkSelect(form.elements["cdatem"],"V","","Please select the Month for your Cruise Date.",false) &&
				 checkSelect(form.elements["cdatey"],"V","","Please select the Year for your Cruise Date.",false) &&
				 checkSelect(form.elements["cruiselength"],"V","","Please tell us your preferred Cruise Length.",false) &&
				 checkSelect(form.elements["cabintype"],"V","","Please tell us your preferred Cabin Type.",false) &&
				 checkSelect(form.elements["numofadult"],"V","","Please tell us the Number of Adult cruisers.",false) &&
				 checkSelect(form.elements["numofchild"],"V","","Please tell us the Number of Children who will be cruising.",false) &&
				 checkSelect(form.elements["contacttime"],"V","","Please select a Best Time to Contact you.",false) &&
				 checkSelect(form.elements["salut"],"V","","Please specify your Salutation.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkSelect(form.elements["state"],"V","","Please select your State or Province from the dropdown.",false));
}

function validateQuoteEsp(form) {
	return (
				 checkSelect(form.elements["leadDest"],"V","","Proporcione por favor a la información para: Destino.",false) &&
				 checkSelect(form.elements["cruisedate1"],"V","","Proporcione por favor a la información para: Fecha de Viaje.",false) &&
				 checkSelect(form.elements["cruisedate2"],"V","","Proporcione por favor a la información para: Fecha de Viaje.",false) &&
				 checkSelect(form.elements["cabintype"],"V","","Proporcione por favor a la información para: Tipo de Cabina.",false) &&
				 checkSelect(form.elements["numofadult"],"V","","Proporcione por favor a la información para: Cantidad de Adultos.",false) &&
				 checkSelect(form.elements["cruiselength"],"V","","Proporcione por favor a la información para: Duracion del Crucero.",false) &&
				 checkSelect(form.elements["salut"],"V","","Proporcione por favor a la información para: Saludo.",false) &&
				 checkSelect(form.elements["firstname"],"V","","Proporcione por favor a la información para: Primer Nombre.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Proporcione por favor a la información para: Apellido.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkSelect(form.elements["contacttime"],"V","","Proporcione por favor a la información para: Mejor Hora para Llamarlo.",false) &&
				 checkSelect(form.elements["timezone"],"V","","Proporcione por favor a la información para: Horario de su Zona.",false) &&				 
				 checkSelect(form.elements["state"],"V","","Proporcione por favor a la información para: Estado o Provincia.",false));
}


function validateWin(form) {
	return (
				 checkSelect(form.elements["salut"],"V","","Please specify your Salutation.",false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkString(form.elements["address"],sUSAddress,false) &&
				 checkString(form.elements["city"],sCity,false) &&
				 checkSelect(form.elements["state"],"V","","Please select your State or Province from the dropdown.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter your Zip or Postal Code.",false) &&
				 checkSelect(form.elements["country"],"V","","Please select your Country from the dropdown.",false) &&
				 checkSelect(form.elements["mob"],"V","","Please specify the Month you were born.",false) &&
				 checkSelect(form.elements["dob"],"V","","Please specify the Day you were born.",false) &&
				 checkSelect(form.elements["yob"],"V","","Please specify the Year you were born.",false) &&
				 checkSelect(form.elements["marital"],"V","","Please tell us your Marital Status.",false) &&
				 checkSelect(form.elements["budget"],"V","","Please tell us your Usual Trip Budget.",false) &&
				 checkSelect(form.elements["cruiselength"],"V","","Please tell us your Usual Trip Length.",false) &&
				 checkSelect(form.elements["cruisefreq"],"V","","Please tell us your Cruise Frequency.",false) &&
				 checkSelect(form.elements["find"],"V","","Please tell us How You Found Us.",false) &&
				 checkSelect(form.elements["prevcustomer"],"V","","Please tell us if you are a Previous Customer.",false));
}

function validateBook(form) {
	return (
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkUSPhone(form.elements["phone1"],false));
}

function validateTest(form) {
	return (
				 checkEmail(form.elements["email"],false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkUSPhone(form.elements["phone1"],false) &&
				 checkString(form.elements["address"],sUSAddress,false) &&
				 checkString(form.elements["city"],sCity,false) &&
				 checkZIPCode(form.elements["zip"],false));
}

function validateAgent(form) {
	return (
				 checkEmail(form.elements["email"],false) &&
				 checkString(form.elements["firstname"],sUSFirstName,false) &&
				 checkString(form.elements["lastname"],sUSLastName,false) &&
				 checkUSPhone(form.elements["phone1"],false));
}

function days_in_month (year,month)  {
	var days;
	if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) 
		days=31;
	else if (month==4 || month==6 || month==9 || month==11) 
		days=30;
	else if (month==2)  {
		if (leapYear (year)==1)
			days=29;
		else days=28;
	}
	return (days);
}


function valiDate(day, month, year) {

	if (day == 0)
		day = days_in_month(year,month);
	//alert("d: " + day + " m: " + month + " y: " + year);
	
	month--;		// months are zero-based

	var objDate = new Date(year,month,day);

	//alert(objDate);

	// handle invalid dates
	if (objDate.getMonth() != month) {
		alert("The date you have chosen is invalid.\n Please select a valid date.");
		return false;
	}	

	// handle dates in the past
	var today = new Date();
	if (objDate < today) {
		alert("The date you have chosen is in the past.\n Please select a valid date.");
		return false;
	}

	return true;
}
