//-- Yahoo!
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid  = "1D1KIO6JJ47AKDJDABH7UGHLS4C";
document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' " 
+ "SRC=//" + "srv2.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet" + "?aid=" + ysm_accountid 
+ "></SCR" + "IPT>");
// -->

function showOverNav(butName)
{
	var navButton = document.images[navOverArray[butName][1]];
	navButton.src = navOverArray[butName][0].src;
}

function hideOverNav(butName)
{
	var navButton = document.images[navOffArray[butName][1]];
	navButton.src = navOffArray[butName][0].src;
}

var navOverArray = new Array(7);
for (var i=0;i<7;i++) {
	navOverArray[i] = new Array(2);
}

var navOffArray = new Array(7);
for (var i=0;i<7;i++) {
	navOffArray[i] = new Array(2);
}

var HOME = 0;
var COURSE = 1;
var ABOUT = 2;
var JOBS = 3;
var FAQS = 4;
var CONTACT = 5;
var APPLY = 6;

// preload work
navOverArray[HOME][0] = new Image();
navOverArray[HOME][0].src = "../images/home_over.gif";
navOverArray[HOME][1] = "home";

navOffArray[HOME][0] = new Image();
navOffArray[HOME][0].src= "../images/home.gif";
navOffArray[HOME][1] = "home";

navOverArray[COURSE][0] = new Image();
navOverArray[COURSE][0].src = "../images/course_over.gif";
navOverArray[COURSE][1] = "course";

navOffArray[COURSE][0] = new Image();
navOffArray[COURSE][0].src= "../images/course.gif";
navOffArray[COURSE][1] = "course";

navOverArray[ABOUT][0] = new Image();
navOverArray[ABOUT][0].src = "../images/about_over.gif";
navOverArray[ABOUT][1] = "about";

navOffArray[ABOUT][0] = new Image();
navOffArray[ABOUT][0].src= "../images/about.gif";
navOffArray[ABOUT][1] = "about";

navOverArray[JOBS][0] = new Image();
navOverArray[JOBS][0].src = "../images/jobs_over.gif";
navOverArray[JOBS][1] = "jobs";

navOffArray[JOBS][0] = new Image();
navOffArray[JOBS][0].src= "../images/jobs.gif";
navOffArray[JOBS][1] = "jobs";

navOverArray[FAQS][0] = new Image();
navOverArray[FAQS][0].src = "../images/faqs_over.gif";
navOverArray[FAQS][1] = "faqs";

navOffArray[FAQS][0] = new Image();
navOffArray[FAQS][0].src= "../images/faqs.gif";
navOffArray[FAQS][1] = "faqs";

navOverArray[CONTACT][0] = new Image();
navOverArray[CONTACT][0].src = "../images/contact_over.gif";
navOverArray[CONTACT][1] = "contact";

navOffArray[CONTACT][0] = new Image();
navOffArray[CONTACT][0].src= "../images/contact.gif";
navOffArray[CONTACT][1] = "contact";

navOverArray[APPLY][0] = new Image();
navOverArray[APPLY][0].src = "../images/apply_over.gif";
navOverArray[APPLY][1] = "apply";

navOffArray[APPLY][0] = new Image();
navOffArray[APPLY][0].src= "../images/apply.gif";
navOffArray[APPLY][1] = "apply";

function chkLogin() { 	
	/*	
	var msg = "";
	pObj = document.forms["form1"];
	if (pObj.cruiseline.value == "any" && pObj.flycruise.value == "any" && pObj.shipname.value == "any" && pObj.price.value == "any") {
		msg = "\nYou must select either cruise line, fly cruise, cruise ship or price per person." + msg;
		pObj.cruiseline.focus();
	}		

	if (msg == "") {
		return true;
	} else {
		alert(msg);
		return false;
	}		
	*/
}
function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
	}

function isDigit(num) {
	if (num.length>1){return false;}
	var string="1234567890";
	if (string.indexOf(num)!=-1){return true;}
	return false;
	}


function isInteger(val){
	if (isBlank(val)){return false;}
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i))){return false;}
		}
	return true;
	}

function chkApply(vNonTT) {
    var nonTT = "true";
    if (vNonTT == "false") {        
        nonTT = "false";
    }
        
	var msg = "";
	pObj = document.forms["applyForm"];
	if (pObj.inputTandC.checked != true) {
		msg = "\nYou must let us know that you have read the terms and conditions." + msg;
		pObj.inputTandC.focus();
	}
	if (pObj.inputForename.value == "") {
		msg = "\nYou must enter your forename." + msg;
		pObj.inputForename.focus();
	}
	if (pObj.inputSurname.value == "") {
		msg = "\nYou must enter your surname." + msg;
		pObj.inputSurname.focus();
	}
	if (pObj.inputEmail.value == "") {
		msg = "\nYou must enter your email address." + msg;
		pObj.inputEmail.focus();
	}
	if (pObj.inputTitle.value == "") {
		msg = "\nYou must enter your title." + msg;
		pObj.inputTitle.focus();
	}
	if (pObj.inputhouseno.value == "") {
		msg = "\nYou must enter your house number." + msg;
		pObj.inputhouseno.focus();
	}
	if (pObj.inputPcode.value == "") {
		msg = "\nYou must enter your postcode." + msg;
		pObj.inputPcode.focus();
	}
	if (pObj.inputAddress1.value == "") {
		msg = "\nYou must enter your address line 1." + msg;
		pObj.inputAddress1.focus();
	}
	//if (pObj.inputCounty.value == "") {
	//	msg = "\nYou must enter your county." + msg;
	//	pObj.inputCounty.focus();
	//}
	//if (pObj.inputCountry.value == "") {
	//	msg = "\nYou must enter your country." + msg;
	//	pObj.inputCountry.focus();
	//}
	if (pObj.inputHtel.value == "") {
		msg = "\nYou must enter your home telephone number." + msg;
		pObj.inputHtel.focus();
	}
	//if ((pObj.dob_day.value == "") || (pObj.dob_month.value == "") || (pObj.dob_year.value == "")) {
	//	msg = "\nYou must enter your date of birth." + msg;
	//	pObj.dob_day.focus();
	//}
	if (pObj.inputage.value == "") {
		msg = "\nYou must enter your age." + msg;
		pObj.inputage.focus();
	}
	//if (pObj.inputPaymentType.value == "") {
	//	msg = "\nYou must enter your payment type." + msg;
	//	pObj.inputPaymentType.focus();
	//}
	//if (pObj.inputCardNo.value == "") {
	//	msg = "\nYou must enter your card number." + msg;
	//	pObj.inputCardNo.focus();
	//}
	//if ((pObj.expirymonth.value == "") || (pObj.expiryyear.value == ""))  {
	//	msg = "\nYou must enter your card expiry date." + msg;
	//	pObj.expirymonth.focus();
	//}
	//if ((pObj.expiryyear.value == jyear) && (pObj.expirymonth.value < jmonth)) {
	//	msg = "\nYour card expiry date is in the past." + msg;
	//	pObj.expirymonth.focus();
	//}
	//if (pObj.inputSecurity.value == "") {
	//	msg = "\nYou must enter your card security number." + msg;
	//	pObj.inputSecurity.focus();
	//}
	//if (pObj.inputSecurityname.value == "") {
	//	msg = "\nYou must enter the name on your card." + msg;
	//	pObj.inputSecurityname.focus();
	//}
		
	//if (pObj.inputCardNo.value != "") {
	//	if (!isInteger(pObj.inputCardNo.value)) {
	//		msg = "\nCard number must be numeric with no spaces" + msg;
	//		pObj.inputCardNo.focus();
	//	} 
	//}
	//if (pObj.expirymonth.value != "") {
	//	if (!isInteger(pObj.expirymonth.value)) {
	//		msg = "\nExpiry month must be numeric with no spaces" + msg;
	//		pObj.expirymonth.focus();
	//	}	
	//}
	//if (pObj.expiryyear.value != "") {
	//	if (!isInteger(pObj.expiryyear.value) ) {
	//		msg = "\nExpiry year must be numeric with no spaces" + msg;
	//		pObj.expiryyear.focus();
	//	}		
	//}
	//if (pObj.inputIssue.value != "") {
	//	if (!isInteger(pObj.inputIssue.value)) {
	//		msg = "\nIssue Number must be numeric with no spaces" + msg;
	//		pObj.inputIssue.focus();
	//	}		
	//}
	//if (pObj.inputSecurity.value != "") {
	//	if (!isInteger(pObj.inputSecurity.value)) {
	//		msg = "\nSecurity number must be numeric with no spaces" + msg;
	//		pObj.inputSecurity.focus();
	//	}		
	//}
	//alert(!pObj.inputReg[1].checked);
	if (nonTT == "true") {
	    //if (!pObj.inputReg[1].checked) {
	        if (pObj.inputDates.value == "") {
	            msg = "\nYou must enter the date you wish to attend your course." + msg;
	            pObj.inputDates.focus();
	        }
	        if (pObj.inputLocations.value == "") {
	            msg = "\nYou must enter the location you wish to attend your course." + msg;
	            pObj.inputLocations.focus();
	        }
	        if (pObj.inputcity.value == "") {
	            msg = "\nYou must enter the city you wish to attend your course." + msg;
	            pObj.inputcity.focus();
	        }
	    //}
	    //else {
	    //   if (pObj.inputPayment[2].checked == false) {
	    //        msg = "\nYou must select £135 only." + msg;
	    //    }
	    //}

	    if (pObj.inputReg[0].checked) {
	        if (pObj.inputPayment[2].checked == true) {
	            msg = "\nYou must select either £50 or £210." + msg;
	        }
	    }
	    if (pObj.inputReg[1].checked) {

	        if (pObj.inputPayment[1].checked == true) {
	            msg = "\nYou must select either £50 or £345." + msg;
	        }
	    }
	}
	else {
//	    if (!pObj.inputReg[1].checked) {
        if (pObj.inputDates.value == "") {
            msg = "\nYou must enter the date you wish to attend your course." + msg;
            pObj.inputDates.focus();
        }
        if (pObj.inputLocations.value == "") {
            msg = "\nYou must enter the location you wish to attend your course." + msg;
            pObj.inputLocations.focus();
        }
        if (pObj.inputcity.value == "") {
            msg = "\nYou must enter the city you wish to attend your course." + msg;
            pObj.inputcity.focus();
        }

	    if (pObj.inputReg[0].checked) {
	        if (pObj.inputPayment[1].checked == true) {
	            msg = "\nYou must select £50 only." + msg;
	        }
	    }
	    if (pObj.inputReg[1].checked) {

	        if (pObj.inputPayment[0].checked == true) {
	            msg = "\nYou must select £50 & £135 only." + msg;
	        }
	    }
	}	
	

	if (msg == "") {
		return true;
	} else {
		alert(msg);
		return false;
	}	
		
}

function chkInfoPack() { 	
	var msg = "";
	pObj = document.forms["applyForm"];
	//if (pObj.inputInit.value == "") {
	//	msg = "\nYou must enter your initial." + msg;
	//	pObj.inputInit.focus();
	//}		
	if (pObj.inputForename.value == "") {
		msg = "\nYou must enter your forename." + msg;
		pObj.inputForename.focus();
	}
	if (pObj.inputSurname.value == "") {
		msg = "\nYou must enter your surname." + msg;
		pObj.inputSurname.focus();
	}
	if (pObj.inputEmail.value == "") {
		msg = "\nYou must enter your email address." + msg;
		pObj.inputEmail.focus();
	}		
	if (msg == "") {
		return true;
	} else {
		alert(msg);
		return false;
	}	
}

function chkPay() { 	
	var msg = "";
	pObj = document.forms["applyForm"];
	//if (pObj.inputInit.value == "") {
	//	msg = "\nYou must enter your initial." + msg;
	//	pObj.inputInit.focus();
	//}		
	if (pObj.inputForename.value == "") {
		msg = "\nYou must enter your forename." + msg;
		pObj.inputForename.focus();
	}
	if (pObj.inputSurname.value == "") {
		msg = "\nYou must enter your surname." + msg;
		pObj.inputSurname.focus();
	}
	if (pObj.inputEmail.value == "") {
		msg = "\nYou must enter your email address." + msg;
		pObj.inputEmail.focus();
	}		
	//if (pObj.inputCardNo.value != "") {
	//	if (!isInteger(pObj.inputCardNo.value)) {
	//		msg = "\nCard number must be numeric with no spaces" + msg;
	//		pObj.inputCardNo.focus();
	//	} 
	//}
	//if (pObj.expirymonth.value != "") {
	//	if (!isInteger(pObj.expirymonth.value)) {
	//		msg = "\nExpiry month must be numeric with no spaces" + msg;
	//		pObj.expirymonth.focus();
	//	}	
	//}
	//if (pObj.expiryyear.value != "") {
	//	if (!isInteger(pObj.expiryyear.value) ) {
	//		msg = "\nExpiry year must be numeric with no spaces" + msg;
	//		pObj.expiryyear.focus();
	//	}		
	//}
	//if (pObj.inputIssue.value != "") {
	//	if (!isInteger(pObj.inputIssue.value)) {
	//		msg = "\nIssue Number must be numeric with no spaces" + msg;
	//		pObj.inputIssue.focus();
	//	}		
	//}
	//if (pObj.inputSecurity.value != "") {
	//	if (!isInteger(pObj.inputSecurity.value)) {
	//		msg = "\nSecurity number must be numeric with no spaces" + msg;
	//		pObj.inputSecurity.focus();
	//	}		
	//}
	if (msg == "") {
		return true;
	} else {
		alert(msg);
		return false;
	}	
		
}

function calctotal(){
//alert('here');
	var vPymtType, vCourse, vCardType
	vObj=document.forms['applyForm']
	//find amount of charge to add

	if (vObj.inputPayment[0] != null) {

	    if (vObj.inputPayment[0].checked == true) {
	        vCourse = 2;
	    }
	}

	//if (vObj.inputPayment[1] != null) {
	//    if (vObj.inputPayment[1].checked == true) {
	//        vCourse = 5;
	//    }
	//}

    if (vObj.inputPayment[1] != null) {
        if (vObj.inputPayment[1].checked == true) {
            vCourse = 6;
        }
    }

    if (vObj.inputPayment[2] != null) {
        if (vObj.inputPayment[2].checked == true) {
            vCourse = 6;
        }
    }

    //if (vObj.inputPayment[4] != null) {
    //    if (vObj.inputPayment[4].checked == true) {
    //        vCourse = 6;
    //    }
    //}
    
    //find payment amount
    for (j = 0; j < 5; j++) {
        if (vObj.inputPayment[j] != null) {
            if (document.forms['applyForm'].inputPayment[j].checked == true) {
                vPymtType = j;
            }
        }
    }
	
	//find card type
	for (k=0; k<7; k++){
		if (document.forms['applyForm'].inputPaymentType[k].selected == true){
			vCardType = document.forms['applyForm'].inputPaymentType[k].value;	
		}
    }
	
	//if card type switch no charge
	//alert(vCardType);
	if(vCardType == "Switch" || vCardType == "Cheque" || vCardType == "Maestro" || vCardType == "Visa Delta" || vCardType == "Electron" || vCardType == "Solo"){
		vCourse = 0;
	}

	//calculate total
	if (vObj.inputPayment[vPymtType] != null) {
	    document.forms['applyForm'].inputTotal.value = parseInt(document.forms['applyForm'].inputPayment[vPymtType].value) + vCourse
	}
	else {
	    document.forms['applyForm'].inputTotal.value = 50
	}
}

function calctotal2(){
	/*var vCardType, vCourse, vPayment
	
	vPayment = 160;
	vCourse = 5;
	var k;
	
	//find card type
	for (k=0; k<7; k++)
	{
		if (document.forms['applyForm'].inputPaymentType[k].selected == true){
			vCardType = document.forms['applyForm'].inputPaymentType[k].value;	
		}		
	}	
	//if card type switch no charge
	if(vCardType == "Switch" || vCardType == "Cheque" || vCardType == "Maestro" || vCardType == "Visa Delta" || vCardType == "Electron" || vCardType == "Solo"){
		vCourse = 0;
	}
	
	//calculate total			

	document.forms['applyForm'].inputTotal.value = vPayment + vCourse;

	var total =  parseInt(vPayment) + parseInt(vCourse);
	//alert(document.getElementById('hdnFullPayment').value);
	alert(total);*/




	var vCardType, vCourse, vPayment
	
	vPayment = 160;
	vCourse = 5;
	
var k;
	//find card type
	for (k=0; k<7; k++){
		if (document.forms['applyForm'].inputPaymentType[k].selected == true)
		{
			vCardType = document.forms['applyForm'].inputPaymentType[k].value;	
		}		
	}	
	//if card type switch no charge
	if(vCardType == "Switch" || vCardType == "Cheque" || vCardType == "Maestro" || vCardType == "Visa Delta" || vCardType == "Electron" || vCardType == "Solo"){
		vCourse = 0;
	}
	
	//calculate total			
	document.forms['applyForm'].inputTotal.value = vPayment + vCourse
	//document.forms['applyForm'].inputTotal.value = vPayment + vCourse
	if(document.forms['applyForm'].inputPayment[0].checked)
	{
	    document.forms['applyForm'].inputTotal.value = parseInt(document.forms['applyForm'].inputPayment[0].value) + parseInt(vCourse );
	
	}
	else
	{
	    document.forms['applyForm'].inputTotal.value = parseInt(document.forms['applyForm'].inputPayment[1].value) + parseInt(vCourse );
	
	}


}

function calctotal3() {
    
    var vCardType, vCourse, vPayment

    vPayment = 135;
    vCourse = 3;

    var k;
    //find card type
    for (k = 0; k < 7; k++) {
        if (document.forms['applyForm'].inputPaymentType[k].selected == true) {
            vCardType = document.forms['applyForm'].inputPaymentType[k].value;
        }
    }
    //if card type switch no charge
    if (vCardType == "Switch" || vCardType == "Cheque" || vCardType == "Maestro" || vCardType == "Visa Delta" || vCardType == "Electron" || vCardType == "Solo") {
        vCourse = 0;
    }

    //calculate total			
    document.forms['applyForm'].inputTotal.value = vPayment + vCourse
}

function itinPopUp(){
	var url = "itinerary.asp"
	directionsWin = window.open(url, "HELPWin","width=500,height=360,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=0,left=0");
	directionsWin.focus(); 
}
var bTypeNs = (navigator.appName=="Netscape" && parseInt(navigator.appVersion) >= 4);
var NN4 = false;
var NN6 = false;
var IE4 = false;
if (bTypeNs) {
	if (parseInt(navigator.appVersion) < 5) {
		NN4 = true;
	} else {
		NN6 = true;
	}
} else {IE4 = true;}

// determine platform
var isMac = navigator.appVersion.indexOf('Mac') > 0 ? 1 : 0 ;

// setup defaults
var HIDDEN = (NN4) ? 'hide' : 'hidden';
var VISIBLE = (NN4) ? 'show' : 'visible';
var navVersion = parseInt(navigator.appVersion);