
function validate(){
	var pass=1;
	var passEmail=1;
	var passEmail2=1;
	
	for(i=0; i<document.emailEnquiry.elements.length; i++){
			elTextField=document.emailEnquiry.elements[i].name;
						if( document.getElementById(elTextField)){
								if ((document.getElementById(elTextField).value=="") && (document.getElementById(elTextField).className=='formInputRequired')) {
										pass=0;
										document.getElementById(elTextField).className='formInputRequiredFailed';
								}else if ((document.getElementById(elTextField).value=="") && (document.getElementById(elTextField).className=='formInputRequiredFailed')) {
										pass=0;
										document.getElementById(elTextField).className='formInputRequiredFailed';
								}else if ((document.getElementById(elTextField).value!="") && (document.getElementById(elTextField).className=='formInputRequiredFailed')) {
										document.getElementById(elTextField).className='formInputRequired';
								}else if (document.getElementById(elTextField).value!=""){
										if (document.getElementById(elTextField).className=='formInputRequired'){
											document.getElementById(elTextField).className='formInputRequired';
										}
								}
								if (elTextField=='strEmail'){
									strEmail1=document.getElementById(elTextField).value;
									var x = document.getElementById(elTextField).value;
									var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
									if (filter.test(x)){
											passEmail=1;
									}else{
											passEmail=0;
											document.getElementById(elTextField).className='formInputRequiredFailed';
									}
								}
								
								
								
								
								if (elTextField=='strEmail2'){
									strEmail1=document.getElementById(elTextField).value;
									var x = document.getElementById(elTextField).value;
									var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
									if (filter.test(x)){
											passEmail2=1;
									}else{
											passEmail2=0;
											document.getElementById(elTextField).className='formInputRequiredFailed';
									}
								}
								
								
								
								
								
						}
	}
	
	if (document.getElementById("strEmail2")){
	
				if (pass==1 && passEmail ==1 && passEmail2 ==1){
					return true;
				}else{
					if (passEmail ==0){
						document.getElementById("emailFail").style.display='inline'; 
					}else{
						document.getElementById("emailFail").style.display='none'; 
					}
					
					if (passEmail2 ==0){
						document.getElementById("emailFail2").style.display='inline'; 
					}else{
						document.getElementById("emailFail2").style.display='none'; 
					}
					
					rresponse="Required Fields are outlined in Red";
					document.getElementById("page_overlay").style.display='inline'; 
					document.getElementById("Warning2").style.display='inline';
					document.getElementById("warningText").style.display='inline';
					document.getElementById("warningText").innerHTML=rresponse;
					return false;
				}
	
	
	
	}else{
	
				if ((pass==1) && (passEmail ==1)){
					return true;
				}else{
					if (passEmail ==0){
						document.getElementById("emailFail").style.display='inline'; 
					}else{
						document.getElementById("emailFail").style.display='none'; 
					}
					rresponse="Required Fields are outlined in Red";
					window.parent.document.getElementById("page_overlay").style.display='inline'; 
					window.parent.document.getElementById("Warning2").style.display='inline';
					window.parent.document.getElementById("warningText").style.display='inline';
					window.parent.document.getElementById("warningText").innerHTML=rresponse;
					return false;
				}
	}
	
	
}


function establishfocus(){
	document.emailEnquiry.strFirstName.focus();
	document.emailEnquiry.strFirstName.select();
}


function hideWarning(warningName){
	document.getElementById(warningName).style.display='none'; 
	document.getElementById("page_overlay").style.display='none'; ; 

}



function showSendToAFriend(){
	new Effect.Appear (document.getElementById('sendToAFriend'));
		
	document.getElementById('strName').select();
}