
function checkSponsor(that) {
	
	if(that.value == 2) {
		for(i = 0; i < that.form.checkWhere.length; i++) {
			that.form.checkWhere[i].checked = false;
			that.form.checkWhere[i].disabled = true; 
			that.form.checkWhere[i].readOnly = true;
		}
	} else {
		for(i = 0; i < that.form.checkWhere.length; i++) {
			that.form.checkWhere[i].disabled = false; 
			that.form.checkWhere[i].readOnly = false;
		}
	}
}


function checkChecks(that, off) {
	if(off == 1) {
		if(that.checked == true) { 
			for(i = 0; i < that.form.checkWhere.length - 1; i++) {
				that.form.checkWhere[i].checked = false; 
			}
		}	
	} else {
		if(that.checked == true) { 
			that.form.checkWhere[that.form.checkWhere.length - 1].checked = false; 
		}
	} 
}
					
function validate(){
	if (trimSpaces(window.document.frmInsert.Email.value)==""){
		window.alert ("Please enter an e-mail address.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.Full_Name.value)==""){
		window.alert ("Please enter your full name.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.Top_Markets.value)==""){
		window.alert ("Please enter your Agency name.");
		return false;
	} 	
	if (trimSpaces(window.document.frmInsert.Agency_Name.value)==""){
		window.alert ("Please enter your Agency name.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.Phone1.value)==""){
		window.alert ("Please enter an phone number.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.Address.value)==""){
		window.alert ("Please enter an address.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.City.value)==""){
		window.alert ("Please enter a city.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.Zip.value)==""){
		window.alert ("Please enter a zip code.");
		return false;
	} 
	if (trimSpaces(window.document.frmInsert.ARC_Number.value)==""){
		window.alert ("Please enter an ARC number.");
		return false;
	} 				
	if (trimSpaces(window.document.frmInsert.Record_Locator.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 	
	if (trimSpaces(window.document.frmInsert.Record_Locator2.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 	
	if (trimSpaces(window.document.frmInsert.Record_Locator3.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 			
	if (trimSpaces(window.document.frmInsert.Record_Locator4.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator5.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator6.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator7.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator8.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator9.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 		
	if (trimSpaces(window.document.frmInsert.Record_Locator10.value)==""){
		window.alert ("Please enter all 10 booking numbers.");
		return false;
	} 					
	//Email Validation - start
	var email = window.document.frmInsert.Email.value

	var invalid = ' /:,;'

	for(var i=0; i<invalid.length; i++)
	{
		var badChar = invalid.charAt(i)

		if (email.indexOf(badChar,0) != -1)
		{
			alert( 'The e-mail address you entered \ncontains one or more invalid characters.' )
			return false;
		}
	}

	var atSignPos = email.indexOf('@',1)

	if (atSignPos == -1)
	{
		alert( 'The e-mail address you entered \nis missing its @ sign.' )
		return false;
	}
	else if (email.indexOf('@',atSignPos+1) != -1)
	{
		alert( 'The e-mail address you entered \ncontains too many @ signs.' )
		return false;
	}

	var dotPos = email.indexOf('.',atSignPos+2)

	if (dotPos == -1)
	{
		alert( 'The e-mail address you entered \nis missing its extension.' )
		return false;
	}
	else if (dotPos+3 > email.length)
	{
		alert( 'The e-mail address you entered appears\nto use an invalid extension.' )
		return false;
	}
	// Validation - end
	
	/*if (trimSpaces(window.document.frmInsert.Phone.value)==""){
		window.alert ("Please enter a phone number.");
		return false;
	}
	
	
	if (window.document.frmInsert.readrules.checked == false){
		window.alert ("Please acknowledge reading the rules of this promotion.");
		return false;
	}*/
	
	
window.document.frmInsert.hdnSubmit.value = 'Submit';
window.document.frmInsert.btnSubmit.value = 'Please wait....';	

 return true;
} 

//this function will strip preceding and following 
//spaces
//
function trimSpaces(sDataToTrim)
{
	var sReturnDataF = '';
	var sReturnDataE = '';
	var bFrontDone = false;
	var bEndDone = false;

	//strip leading spaces
	//
	for(x=0;x<sDataToTrim.length;x++)
	{
		//if not a space, append to the return
		//value
		//
		if(sDataToTrim.charAt(x)!=' ')
		{
			sReturnDataF = sReturnDataF + sDataToTrim.charAt(x);
			bFrontDone = true;
		}
		else
		{
			if(bFrontDone)
				sReturnDataF = sReturnDataF + sDataToTrim.charAt(x);
		}	
	}

	//strip trailing spaces
	//
	for(x=sReturnDataF.length-1;x>=0;x--)
	{
		//if not a space, append to the return
		//value
		//
		if(sReturnDataF.charAt(x)!=' ')
		{
			sReturnDataE = sReturnDataF.charAt(x) + sReturnDataE;
			bEndDone = true;
		}
		else
		{
			if(bEndDone)
				sReturnDataE = sReturnDataF.charAt(x) + sReturnDataE;
		}	
	}
	return sReturnDataE;
}

ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4));
function mouseOnBlack()
{if (ie4) {event.srcElement.style.color = "#000000";}}
function mouseOffBlack()
{if (ie4){event.srcElement.style.color = "#FFFFFF";}}