<!--
if (document.images) {

var submiton = new Image();   //Active Images        
submiton.src = "/images/submit_ro.gif"; 

var submitoff = new Image();      //Inactive Images     
submitoff.src = "/images/submit.gif"; 

var subImgon = new Image();   //Active Images        
subImgon.src = "/images/submit_ro.gif"; 

var subImgoff = new Image();      //Inactive Images     
subImgoff.src = "/images/submit.gif"; 

var dataon = new Image();   //Active Images        
dataon.src = "/images/datapro_ro.gif"; 

var dataoff = new Image();      //Inactive Images     
dataoff.src = "/images/datapro.gif"; 

}

function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "on.src");
        }
}

function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "off.src");
        }
}


function validateAddressDetails(theForm){
	var blnResult = false

	if(theForm.NOCACHEAddress)
	{
		var regExp = /\S/;
		if(theForm.NOCACHEAddress.value == "")
			warnUser("please enter an Address")
		else if(regExp.test(theForm.NOCACHEAddress.value)==false){
			warnUser("please enter an Address")}
		else if(theForm.NOCACHEAddress.value.length > 260)
			warnUser("sorry, your Address is too long")
		else
			blnResult = true
	}

	return blnResult;
}


function validateContactDetails(theForm){
	var blnResult = false

	var name_no_regExp = /[^a-zA-Z \-'()]/
//disallow everything in email adress except @, hyphen, ', ., and word chars (alphanum and _)
	var email_no_regExp = /[^@\-'.\w]/
	var email_yes_regExp = /@.*\./
	var email_dot_regExp = /\./
	var phone_no_regExp = /[^0-9()+ ]/
	
	
	if (theForm.NOCACHEFirst_Name.value==""){
		warnUser("please enter your first name")
	}else if (theForm.NOCACHELast_Name.value==""){
		warnUser("please enter your last name")
	}else if (theForm.NOCACHEEmail.value==""){
		warnUser("please enter your email")
	}else if(name_no_regExp.test(theForm.NOCACHEFirst_Name.value)){
		warnUser("your first name cannot contain special characters")
	}else if(name_no_regExp.test(theForm.NOCACHELast_Name.value)){
		warnUser("your last name cannot contain special characters")
	}else if(email_no_regExp.test(theForm.NOCACHEEmail.value)|| !email_yes_regExp.test(theForm.NOCACHEEmail.value)){
		warnUser("please enter a valid e-mail address")
	}else{
		if(theForm.NOCACHEContact_Phone_1 && theForm.NOCACHEContact_Phone_2){
			if(phone_no_regExp.test(theForm.NOCACHEContact_Phone_1.value) || phone_no_regExp.test(theForm.NOCACHEContact_Phone_2.value)){
				warnUser("your contact numbers must contain only numbers")
			}else{
				blnResult = true;
			}
		}else{
			blnResult = true;
		}
	}

//	blnResult = true;//temp

	return blnResult;

}

//function for contact details form in siteinfo
function validateContactDetailsSiteinfo(theForm){
	var blnResult = false

	var name_no_regExp = /[^a-zA-Z \-'()]/
//disallow everything in email adress except @, hyphen, ', ., and word chars (alphanum and _)
	var email_no_regExp = /[^@\-'.\w]/
	var email_yes_regExp = /@.*\./
	var email_dot_regExp = /\./
	var phone_no_regExp = /[^0-9()+ ]/
	
	
	if (theForm.NOCACHEEmail.value==""){
		warnUser("please enter your email")
	}else if (theForm.NOCACHEFirst_Name.value==""){
		warnUser("please enter your first name")
	}else if (theForm.NOCACHELast_Name.value==""){
		warnUser("please enter your last name")
	}else if(name_no_regExp.test(theForm.NOCACHEFirst_Name.value)){
		warnUser("your first name cannot contain special characters")
	}else if(name_no_regExp.test(theForm.NOCACHELast_Name.value)){
		warnUser("your last name cannot contain special characters")
	}else if(email_no_regExp.test(theForm.NOCACHEEmail.value)|| !email_yes_regExp.test(theForm.NOCACHEEmail.value)){
		warnUser("please enter a valid e-mail address")
	}else{
		if(theForm.NOCACHEContact_Phone_1 && theForm.NOCACHEContact_Phone_2){
			if(phone_no_regExp.test(theForm.NOCACHEContact_Phone_1.value) || phone_no_regExp.test(theForm.NOCACHEContact_Phone_2.value)){
				warnUser("your contact numbers must contain only numbers")
			}else{
				blnResult = true;
			}
		}else{
			blnResult = true;
		}
	}

//	blnResult = true;//temp

	return blnResult;

}


function providedContactNumber(theForm){
	var blnResult = true
	
	if(theForm.NOCACHEContact_Phone_1&&theForm.NOCACHEContact_Phone_2){
		if(theForm.NOCACHEContact_Phone_1.value==""&&theForm.NOCACHEContact_Phone_2.value=="")
			blnResult = false
	}


	if(!blnResult)
		warnUser("please enter a contact number")

	return blnResult

}


function providedContactNumberSiteinfo(theForm){
	var blnResult = false
	
	if(theForm.NOCACHEContact_Phone_1){
		if(theForm.NOCACHEContact_Phone_1.value!="")
			blnResult = true
	}
	if(theForm.NOCACHEContact_Phone_2){
		if(theForm.NOCACHEContact_Phone_2.value!="")
			blnResult = true
	}
		
	if(!blnResult)
		warnUser("please enter a contact number")

	return blnResult

}

function warnUser(sString){
	alert(sString)

}

function validateNewResearchDetails(theForm){
	
	/*if(!(checkExistsAndChosen(theForm.NOCACHESecResElm) || checkExistsAndChosen(theForm.NOCACHESecRuralElm) || checkExistsAndChosen(theForm.NOCACHESecComElm) || checkExistsAndChosen(theForm.NOCACHESecFinElm))){
		warnUser("please choose a sector of interest")
		return false
	}
*/
	if(!(checkExistsAndChosen(theForm.NOCACHERegUKElm) || checkExistsAndChosen(theForm.NOCACHERegIntElm) || checkExistsAndChosen(theForm.NOCACHERegEurElm) || checkExistsAndChosen(theForm.NOCACHERegAPElm))){
		warnUser("please choose a region of interest")
		return false
	}


	if(!(checkExistsAndChosen(theForm.NOCACHERegResElm) || checkExistsAndChosen(theForm.NOCACHERegServicedApartments_Elm) || checkExistsAndChosen(theForm.NOCACHERegHotelsElm) || checkExistsAndChosen(theForm.NOCACHERegAgrElm) || checkExistsAndChosen(theForm.NOCACHERegRetail_WarehouseElm) || checkExistsAndChosen(theForm.NOCACHERegLeisureElm) || checkExistsAndChosen(theForm.NOCACHERegOfficesElm) || checkExistsAndChosen(theForm.NOCACHERegIndustrialElm) || checkExistsAndChosen(theForm.NOCACHERegMixed_UseElm) || checkExistsAndChosen(theForm.NOCACHERegProp_FinanceElm) || checkExistsAndChosen(theForm.NOCACHERegDev_LandElm))){
		warnUser("please choose a sector of interest")
		return false
	}		
	return true

}

function checkExistsAndChosen(oFromEl){
	if(oFromEl){
		//if (oFromEl.type.toUpperCase() == "CHECKBOX"){
		if (document.images){
			if(oFromEl.checked) return true
		}
		//else{
		//	if(oFromEl.value == "on") return true
		//}
	}
	return false
}