//pop-up
theUrl="promoDetail.htm";
function doThePopUp() {
reWin = window.open(theUrl,'determined','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=600,top=100,left=100');
}

OnlinetheUrl="promoDetail_online.htm";
function doTheOnlinePopUp() {
reWin = window.open(OnlinetheUrl,'determined','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=600,top=100,left=100');
}

ClasstheUrl="promoDetail_classroom.htm";
function doTheClassPopUp() {
reWin = window.open(ClasstheUrl,'determined','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=600,top=100,left=100');
}

//Automatica pass from one field to another like phone number
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
		var keyCode = (isNN) ? e.which : e.keyCode; 
		var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
		if(input.value.length >= len && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}

	function containsElement(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length)
			if(arr[index] == ele)
				found = true;
			else
				index++;
		return found;
	}

	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
			if (input.form[i] == input)index = i;
			else i++;
		return index;
	}
	
	return true;
}

//
//pop up windows
//

function openPopUp(page) { 
OpenWin = this.open(page, "CDDS", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=600,height=600");
} 

function openPopUp2(page) { 
OpenWin = this.open(page, "CDDS", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=950,height=600");
} 



function extrictPopUp(page) { 

	netscape = "netscape.html"; // set your browser pages
	explorer = "explorer.html";
	unknown  = "unknown.html";
	
	// Determine the popup window properties
	// options include:  top, left, toolbars, scrollbars,
	// menubar, location, statusbar, and resizable
	
	windowprops = "top=0,left=0,location=no,toolbar=no,resizable=no,statusbar=no,scrollbars=yes,fullscreen=yes"
	+ ",width=" + screen.width + ",height=" + screen.height;
	
	OpenWin = this.open(page, "CDDS", windowprops);
}

function submit(){
	document.xform.cities.submit();
}

//
//prints currrent page
//

function printPage() {
  if (window.print)
    window.print()
  else
    alert("Sorry, your browser doesn't support this feature.");
}




function validate_required_exact(field, len, alerttxt){
	with (field){
		var stripped = value.replace(/[\(\)\.\-\ ]/, '');
		if (value==null||value==""){
			alert(alerttxt);
			return false
		} 
		if ((stripped.length != len)){
			alert("Is not long enogh");
			return false
		}
		else{return true}
	}
}

function validate_email(field,alerttxt){
	with (field){
		apos = value.indexOf("@");
		dotpos = value.lastIndexOf(".");
		if ( apos < 1 || dotpos-apos < 2 ){		
			alert(alerttxt);return false
		}
		else{return true}
	}
}

function validate_num(field, len, alerttxt){
	with (field){
		var stripped = value.replace(/[\(\)\.\-\ ]/g, '');
		if (isNaN(parseInt(stripped))) {
		   alert(alerttxt+" "+"Invalid characters");return false;
		}

		if (!(stripped.length == len)) {
			alert(alerttxt+" "+"Invalid length");return false;
		}
		else{return true}
	}
}

function validate_dependency_location(field, chk, dd, alerttxt){
	res = dd.selectedIndex;
	with (field){
		if ( value==null && res==1 && validate_checkC(chk,alerttxt) ){
			alert(alerttxt);
			return false
		} else if((value=="" && res==1 && validate_checkC(chk,alerttxt) )){
			alert(alerttxt);
			return false			
		}
		else{
			return true
		}
	}
}

function validate_dependency_cardnumber(field, dd, alerttxt){
	res = dd.selectedIndex;
	with (field){
		if (res==4){
			validate_required_exact(field, 15, "Not American Express Number");
		} else if (res == 1 || res == 2 || res == 3){
			validate_required_exact(field, 16, "Not a Valid Number");
		}
		else{
			return true
		}
	}
}

function validate_dependency_cvv(field, dd, alerttxt){
	res = dd.selectedIndex;
	with (field){
		if (res==4){
			validate_required_exact(field, 4, "Not American Express cvv");
		} else if (res == 1 || res == 2 || res == 3){
			validate_required_exact(field, 3, "cvv: Not a Valid Number");
		}
		else{
			return true
		}
	}
}

function validate_dependency_license(field, dd, alerttxt){
	res = dd.selectedIndex;
	with (field){
		if ((value==null || value=="") && (res!=2 && res!=3 && res!=4 && res!=5)){
			validate_num(field, 8, alerttxt);
			alert(alerttxt);
			return false
		}
		else{
			return true
		}
	}
}

function validate_dependency_pass(field, field2, alerttxt){
	with (field){
		valA=value;
		with(field2){
			if (value!=valA){
				alert(alerttxt);
				return false
			}
			else{
				return true
			}
		}
	}
}

function validate_dropdown(choice,alerttxt) {
	res = choice.selectedIndex;
	if (res == 0) {
		alert(alerttxt);return false;
	}
}

var radio_selection="";

function validate_radio(choice,alerttxt){
    var isOneChecked = false;
    for (var i=0; i < choice.length; i++)
    {
         if(choice[i].checked){
            isOneChecked = true;
            break;
         }
    }

    if (!isOneChecked) {
        alert(alerttxt);
         return(false);
    }
}

function exam_mss_radio(choice){
    var isOneCorrect = false;
    for (var i=0; i < choice.length; i++)
    {
         if(choice[i].checked && choice[i].value.indexOf("x") == 0){
            isOneCorrect = true;
            break;
         }
    }

    if (!isOneCorrect) {
        alert("Incorrect");
    } else if (isOneCorrect) {
        alert("Correct");
    } 
}

function validate_add_info(thisform){
	with (thisform){
		if (validate_required(lplate01,3,"Fill License Plate!")==false){
			lplate01.focus();return false
		} else if (validate_required(cortName,1,"Fill Court Information!")==false){
			cortName.focus();return false			
		}
	}
	Element.hide('btnH');
}

function validate_check(choice, alerttxt){
	if (!choice.checked) {
		alert(alerttxt);
		return false;
	}	
}

function validate_checkC(choice, alerttxt){
	if (!choice.checked) {
		alert(alerttxt);
		return true;
	}	
}

function validate_payment(){
		if (validate_num(billzip,5,"Fill Billing Zip code!")==false){
			billzip.focus();return false
		} else if (validate_num(shipzip,5,"Fill Shiping Zip code!")==false){
			shipzip.focus();return false
		}
}

function validate_formCmr(thisform){
	with (thisform){
		if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		}  else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_dropdown(gender,"Gender not selected!")==false){
			gender.focus();return false
		} else if (validate_dropdown(lic_state,"Driver license not selected!")==false){
			lic_state.focus();return false
		} else if (validate_dependency_license(dlicense, lic_state,"Fill license number")==false){
			dlicense.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		}
	}
	Element.hide('btnH');
}
	
function validate_formCmrCourt(thisform){
	with (thisform){
		if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_dropdown(gender,"Gender not selected!")==false){
			gender.focus();return false
		} else if (validate_required(cortName, 1,"Fill court!")==false){
			cortName.focus();return false
		} else if (validate_dropdown(lic_state,"Driver license not selected!")==false){
			lic_state.focus();return false
		} else if (validate_dependency_license(dlicense, lic_state,"Fill license number")==false){
			dlicense.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		}
	}
	Element.hide('btnH');
}


//segunda
function validate_form_cmr_online(thisform){
	with (thisform){
		if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(lic_state,"Driver license not selected!")==false){
			lic_state.focus();return false
		} else if (validate_dependency_license(dlicense, lic_state,"Fill license number")==false){
			dlicense.focus();return false
		} else if (validate_required(lplate01,4,"Fill License Plate!")==false){
			lplate01.focus();return false
		}  else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_radio(gender,"Select a gender!")==false){
			comm.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		}
	}
	Element.hide('btnH');
}

//using this
function validate_form_cmr_online_court(thisform){
	with (thisform){
		if (validate_required(cmrFstName, 1,"Fill first name!")==false){
			cmrFstName.focus();return false
		} else if (validate_required(cmrLstName, 1,"Fill last name!")==false){
			cmrLstName.focus();return false
		} else if (validate_required(cmrAddress, 2,"Fill address!")==false){
			cmrAddress.focus();return false
		} else if (validate_required(cmrCty, 2,"Fill in the City")==false){
			cmrCty.focus();return false
		} else if (validate_dropdown(cmrSttID,"State not selected!")==false){
			cmrSttID.focus();return false
		} else if (validate_num(cmrZip,5,"Fill Zip code!")==false){
			cmrZip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(cmrDrvLicSttID,"Driver license not selected!")==false){
			cmrDrvLicSttID.focus();return false
		} else if (validate_dependency_license(cmrDrvLicense, cmrDrvLicSttID,"Fill license number")==false){
			cmrDrvLicense.focus();return false
		} else if (validate_required(cmrLPlate,3,"Fill License Plate!")==false){
			cmrLPlate.focus();return false
		}  else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_radio(cmrGender,"Select a gender!")==false){
			cmrGender.focus();return false
		} else if (validate_email(cmrEmail,"Fill email!")==false){
			cmrEmail.focus();return false
		} else if (validate_required(cmrPassw, 5,"Fill password!")==false){
			cmrPassw.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		} else if (validate_required(cortName, 1,"Fill court!")==false){
			cortName.focus();return false
		}
	}
	Element.hide('btnH');
}

//************************************************************************************************
function validate_Regform_cmr(thisform){
	with (thisform){
		if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_required(city, 2,"Fill City!")==false){
			zip.focus();return false			
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(lic_state,"Driver license not selected!")==false){
			lic_state.focus();return false
		} else if (validate_dependency_license(dlicense, lic_state,"Select one option for Driver license!")==false){
			dlicense.focus();return false
		} else if (validate_required(lplate01,3,"Fill License Plate!")==false){
			lplate01.focus();return false
		} else if (validate_required(cortName,1,"Fill Court Information!")==false){
			cortName.focus();return false			
		}  else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_dropdown(gender,"Select a gender!")==false){
			gender.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		} else if (validate_required(cortName, 1,"Fill court!")==false){
			cortName.focus();return false
		}
		

	}
	Element.hide('btnH');
}

function validate_required(field, len, alerttxt){
	with (field){
		var stripped = value.replace(/[\(\)\.\-\ ]/, '');
		if (value==null||value==""){
			alert(alerttxt);
			return false
		} 
		if ((stripped.length < len)){
			alert(alerttxt);
			return false
		}
		else{return true}
	}
}



//segunda
function validate_form_cmr_onlineOLD(thisform){
	with (thisform){
		if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_required(city, 2,"Fill in the City")==false){
			city.focus();return false
		} else if (validate_dropdown(state,"State not selected!")==false){
			year.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(lic_state,"Driver license not selected!")==false){
			lic_state.focus();return false
		} else if (validate_dependency_license(dlicense, lic_state,"Fill license number")==false){
			dlicense.focus();return false
		} else if (validate_required(lplate01,4,"Fill License Plate!")==false){
			lplate01.focus();return false
		}  else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_radio(gender,"Select a gender!")==false){
			comm.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		} else if (validate_check(terms,"Check the terms and conditions!")==false){
			repass.focus();return false
		}

	    for (var i=0; i < gender.length; i++){
        	 if(gender[i].checked){
        	 	genderVal = gender[i].value;
    	     }
	    }
	    
	    if(suit.value != null || suit.value != "")
	    	nadd = address.value+"  &#35; "+suit.value;
	    else
	    	nadd = address.value;
	    	
		var cmrData = fname.value+"*-*"+mname.value+"*-*"+lname.value+"*-*"+nadd+"*-*"+address2.value+"*-*"+city.value+"*-*"+state.value+"*-*"+zip.value+"*-*"+phone01.value+phone02.value+phone03.value+"*-*"+lic_state.value+"*-*"+dlicense.value+"*-*"+lplate01.value+"*-*"+month.value+"*-*"+day.value+"*-*"+year.value+"*-*"+genderVal+"*-*"+comm.value+"*-*"+email.value+"*-*"+pass.value;
		getOtherInfoForm(cmrData); return false
	}
}

function validate_login(thisform){
	with (thisform){
		if (validate_email(email,"Fill user!")==false){
			email.focus();return false
		} else if (validate_required(pass_log, 5,"Fill password!")==false){
			pass_log.focus();return false
		}
	}
}

function validate_reason(thisform){
	with (thisform){
		if (validate_dropdown(cause,"Tell us why you want to take the course")==false){
			cause.focus();return false
		} else if (validate_dependency_location(cortName, passit,cause, "Fill in court information")==false){
			cortName.focus();return false
		}
	}
}

function validate_details(thisform){
	with (thisform){
		if (validate_required(shipTo, 1,"Shipping name is require")==false){
			shipTo.focus();return false
		} else if (validate_radio(addType,"Select address type")==false){
			shipaddress.focus();return false
		} else if (validate_required(shipaddress, 1,"Shipping address is require")==false){
			shipaddress.focus();return false
		} else if (validate_required(shipcity, 1,"Shipping city is require")==false){
			shipcity.focus();return false
		} else if (validate_num(shipzip, 5,"Shipping zip is require")==false){
			shipzip.focus();return false
		} else if (validate_radio(shipopt,"Select a shipping method")==false){
			shipzip.focus();return false
		}
	}
}

function validate_shippingt(thisform){
	with (thisform){
		if (validate_radio(shipopt,"Select a shipping method")==false){
			return false
		}
	}
}

function validate_shippingtx(thisform){
	with (thisform){
		if (validate_radio(shipopt,"Select a shipping method")==false){
			return false
		}
		
		for (var i=0; i < shipopt.length; i++){
    	   	 if(shipopt[i].checked){
       		 	aTVal = shipopt[i].value;
	   	     }
    	}
		getNewInvoice(thisform, 1, aTVal);
		return false;
	}
}

function validate_details_online(thisform){
	with (thisform){
		if (validate_dropdown(cause,"Tell us why you want to take the course")==false){
			cause.focus();return false
		} else if (validate_dependency_location(cortName, passit,cause, "Fill in court information")==false){
			cortName.focus();return false
		} else if (validate_required(shipTo, 1,"Shipping name is require")==false){
			shipTo.focus();return false
		} else if (validate_radio(addType,"Select address type")==false){
			shipaddress.focus();return false
		} else if (validate_required(shipaddress, 1,"Shipping address is require")==false){
			shipaddress.focus();return false
		} else if (validate_required(shipcity, 1,"Shipping city is require")==false){
			shipcity.focus();return false
		} else if (validate_num(shipzip, 5,"Shipping zip is require")==false){
			shipzip.focus();return false
		} else if (validate_radio(shipopt,"Select a shipping method")==false){
			shipzip.focus();return false
		}
	}
}

function validate_Adddetailsx(thisform){
	with (thisform){
		if (validate_radio(prchShippingAtID,"Select address type")==false){
			prchShippingAtID.focus();return false
		} else if (validate_required(prchShippingTo, 1,"Shipping name is require")==false){
			prchShippingTo.focus();return false
		} else if (validate_required(prchShippingAddress, 1,"Shipping address is require")==false){
			prchShippingAddress.focus();return false
		} else if (validate_num(zip, 5,"Shipping zip is require")==false){
			prchShippingZip.focus();return false
		}

	}
}

function validate_detailsx(thisform){
	with (thisform){
		if (validate_radio(addType,"Select address type")==false){
			shipTo.focus();return false
		} else if (validate_required(shipTo, 1,"Shipping name is require")==false){
			shipTo.focus();return false
		} else if (validate_required(address, 1,"Shipping address is require")==false){
			address.focus();return false
		} else if (validate_num(zip, 5,"Shipping zip is require")==false){
			zip.focus();return false
		}

	    for (var i=0; i < addType.length; i++){
    	   	 if(addType[i].checked){
       		 	aTVal = addType[i].value;
	   	     }
    	}
	    
	    with (suit){
	    	if(value.length != 0)
    			nadd = address.value+" &#35; "+suit.value;
		    else
		    	nadd = address.value;
	    }
		var newData = aTVal+"*-*"+shipTo.value+"*-*"+nadd+"*-*"+zip.value;
		getAddUpdated(newData); return false
	}
}

function validate_creditcard(thisform){
	with (thisform){
		if (validate_dropdown(pay_type,"Choose a creditcard")==false){
			card_num.focus();return false
		} else if (validate_dependency_cardnumber(card_num, pay_type, "Credit card not valid")==false){
			card_num.focus();return false
		} else if (validate_dependency_cvv(cvv, pay_type, "cvv valid")==false){
			cvv.focus();return false
		} else if (validate_dropdown(pay_month,"Choose a Expiration Month")==false){
			cvv.focus();return false
		} else if (validate_dropdown(pay_year,"Choose a Expiration Year")==false){
			cvv.focus();return false
		}
		var payDat = namecc.value+"*-*"+pay_type.value+"*-*"+card_num.value+"*-*"+cvv.value+"*-*"+pay_month.value+"*-*"+pay_year.value;
		getPaymentProc(payDat,pay_year.value); return false
	}
}

function validate_kcreditcard(thisform){
	with (thisform){
		if (validate_required(namecc, 2,"Fill Name On Card!")==false){
			namecc.focus();return false
		} else if (validate_dropdown(pay_type,"Choose a creditcard")==false){
			pay_type.focus();return false			
		} else if (validate_dependency_cardnumber(card_num, pay_type, "Credit card not valid")==false){
			card_num.focus();return false
		} else if (validate_dependency_cvv(cvv, pay_type, "cvv valid")==false){
			cvv.focus();return false
		} else if (validate_dropdown(pay_month,"Choose a Expiration Month")==false){
			pay_month.focus();return false
		} else if (validate_dropdown(pay_year,"Choose a Expiration Year")==false){
			pay_year.focus();return false
		}
	    Element.hide('btnH');
	}
}

function validate_formUpdate(thisform){
	with (thisform){
		if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_required(city, 2,"Fill in the City")==false){
			city.focus();return false
		} else if (validate_dropdown(state,"State not selected!")==false){
			year.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_dropdown(month,"Month of birth not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day of birth not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year of birth not selected!")==false){
			year.focus();return false
		} else if (validate_radio(gender,"Select a gender!")==false){
			comm.focus();return false
		}
	}
}

function validate_changePass(thisform){
	with (thisform){
		if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		}
	}
}

function validate_new_inst(thisform){
	with (thisform){
		if (validate_dropdown(status,"Status not selected!")==false){
			status.focus();return false
		} else if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		}
	}	
}


function validate_new_loc(thisform){
	with (thisform){
		if (validate_dropdown(status,"Status not selected!")==false){
			status.focus();return false
		} else if (validate_required(locationname, 1,"Fill location name!")==false){
			locationname.focus();return false
		} else if (validate_required(locationmanager, 1,"Fill manager name!")==false){
			locationmanager.focus();return false
		} else if (validate_required(locationno, 1,"Fill location number!")==false){
			locationno.focus();return false
		} else if (validate_required(classcost, 1,"Fill location number!")==false){
			classcost.focus();return false
		} else if (validate_required(locationmap, 1,"Fill in map!")==false){
			locationmap.focus();return false
		} else if (validate_required(address, 2,"Fill in address!")==false){
			address.focus();return false
		} else if (validate_dropdown(city,"City not selected!")==false){
			city.focus();return false
		} else if (validate_dropdown(state,"State not selected!")==false){
			state.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(directions, 1,"Fill in directions!")==false){
			directions.focus();return false
		}
	}	
}


function validate_new_inst(thisform){
	with (thisform){
		if (validate_dropdown(status,"Status not selected!")==false){
			status.focus();return false
		} else if (validate_required(fname, 1,"Fill first name!")==false){
			fname.focus();return false
		} else if (validate_required(lname, 1,"Fill last name!")==false){
			lname.focus();return false
		} else if (validate_required(address, 2,"Fill address!")==false){
			address.focus();return false
		} else if (validate_dropdown(city,"City not selected!")==false){
			city.focus();return false
		} else if (validate_dropdown(state,"State not selected!")==false){
			state.focus();return false
		} else if (validate_num(zip,5,"Fill Zip code!")==false){
			zip.focus();return false
		} else if (validate_num(phone01,3,"Fill phone!")==false){
			phone01.focus();return false
		} else if (validate_num(phone02,3,"Fill phone!")==false){
			phone02.focus();return false
		} else if (validate_num(phone03,4,"Fill phone!")==false){
			phone03.focus();return false
		} else if (validate_num(dlicense,8,"Fill driver license number!")==false){
			dlicense.focus();return false
		} else if (validate_email(email,"Fill email!")==false){
			email.focus();return false
		} else if (validate_required(pass, 5,"Fill password!")==false){
			pass.focus();return false
		} else if (validate_required(repass, 5,"Retype password!")==false){
			repass.focus();return false
		} else if (validate_dependency_pass(pass, repass,"Passwords dont match!")==false){
			pass.focus();return false
		}
	}
}


function validate_new_offr(thisform){
	with (thisform){
		if (validate_dropdown(status,"Status not selected!")==false){
			status.focus();return false
		} else if (validate_dropdown(course,"Course not selected!")==false){
			course.focus();return false
		} else if (validate_dropdown(inst,"Instructor not selected!")==false){
			inst.focus();return false
		} else if (validate_dropdown(loc,"Location not selected!")==false){
			loc.focus();return false
		} else if (validate_dropdown(brnch,"Branch not selected!")==false){
			brnch.focus();return false
		} else if (validate_dropdown(month,"Month not selected!")==false){
			month.focus();return false
		} else if (validate_dropdown(day,"Day not selected!")==false){
			day.focus();return false
		} else if (validate_dropdown(year,"Year not selected!")==false){
			year.focus();return false
		} else if (validate_required(start, 1,"Fill in Start Hour!")==false){
			start.focus();return false
		} else if (validate_required(end, 1,"Fill in End Hour!")==false){
			end.focus();return false
		}
	}
}

function validate_examA(thisform){
	with (thisform){
		if (validate_radio(ansID,"Must answer first!")==false){
			nxtQ.focus();return false
		} else 
		exam_mss_radio(ansID)
	}
	offButton();
}



//Count down 

var mins;
var secs;
var GO;

function cd(goTo) // this function must be called from the <body onload=""> event
{
	GO = goTo;
	mins = 1 * m("1"); // change minutes here 
	secs = 0 + s(":31"); // change seconds here (always add an additional second to your total)
	redo(); 
}

function m(obj) 
{
	for(var i = 0; i < obj.length; i++) 
	{
		if(obj.substring(i, i + 1) == ":")
		break;
	}

	return(obj.substring(0, i)); 
}

function s(obj) 
{
	for(var i = 0; i < obj.length; i++) 
	{
		if(obj.substring(i, i + 1) == ":")
		break;
	}

	return(obj.substring(i + 1, obj.length)); 
}

function dis(mins,secs) 
{
	var disp;
	
	if(mins <= 9) 
	{
		disp = " 0";
	}
	else 
	{
		disp = " ";
	}
	
	disp += mins + ":";
	
	if(secs <= 9) 
	{
		disp += "0" + secs;
	}
	else 
	{
		disp += secs;
	}
	
	return(disp); 
}

function redo() 
{
	secs--;
	
	if(secs == -1) 
	{
		secs = 59; 
		mins--; 
	}
	
	document.cd.disp.value = dis(mins,secs); // setup additional displays here.
	
	if((mins == 0) && (secs == 0)) 
	{
		window.alert("Time is up. Press OK to continue."); // change timeout message as required
		window.location = GO // redirects to specified page once timer ends and ok button is pressed
	}
	else 
	{
		cd = setTimeout("redo()",1000); 
	}
}

//End Count Down

