
function pre_submitAreaForm(){var firstname=document.getElementById('firstname').value;var sname=document.getElementById('surname').value;var age_from=document.getElementById('agefrom').value;var area=document.getElementById('location').value;var managed=document.getElementById('managed').value;var sex=document.getElementById('sex').value;submitAreaForm(firstname,sname,managed,area,sex)}
function submitAreaForm(firstname,sname,managed,area,sex){xmlHttp=null;xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Your browser does not support AJAX!");return;}
var url="http://www.basemodels.co.uk/wp-content/themes/Base/model_area_search.php?";url=url+"firstname="+firstname;url=url+"&sname="+sname;url=url+"&managed="+managed;url=url+"&location="+area;url=url+"&sex="+sex;url=url+"&sid="+Math.random();xmlHttp.onreadystatechange=stateChangedA;xmlHttp.open("GET",url,true);xmlHttp.send(null);}function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
function stateChangedA()
{if(xmlHttp.readyState==4)
{document.getElementById("txtHint").innerHTML="<h4>Your Search Results:</h4>"+xmlHttp.responseText;}
if(xmlHttp.readyState==1)
{document.getElementById("txtHint").innerHTML='<div id="loader"><img src="http://www.basemodels.co.uk/wp-content/themes/Base/img/loading.gif" border="0" alt="Loading, please wait..." /></div>';}}
function showModel(sex,area,from,limit,firstname,sname)
{var baseref='http://www.basemodels.co.uk/wp-content/themes/Base';if(area.length==0)
{document.getElementById("txtHint").innerHTML="";alert('no area');return;}
xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Your browser does not support AJAX!");return;}
var url=baseref+"/model_list.php";url=url+"?sex="+sex;url=url+"&location="+area;url=url+"&from="+from;url=url+"&limit="+limit;url=url+"&firstname="+firstname;url=url+"&sname="+sname;url=url+"&sid="+Math.random();xmlHttp.onreadystatechange=stateChanged;xmlHttp.open("GET",url,true);xmlHttp.send(null);}
function stateChanged()
{if(xmlHttp.readyState==4)
{document.getElementById("txtHint").innerHTML=xmlHttp.responseText;}
if(xmlHttp.readyState==1)
{document.getElementById("txtHint").innerHTML='<div id="loader"><img src="http://basemodels.co.uk/imgc/loading.gif" border="0" alt="Loading, please wait..." /></div>';}}
function MM_showHideLayers(){var i,p,v,obj,args=MM_showHideLayers.arguments;for(i=0;i<(args.length-2);i+=3)
with(document)if(getElementById&&((obj=getElementById(args[i]))!=null)){v=args[i+2];if(obj.style){obj=obj.style;v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}


// Reload Image Frame
function reload_images(){
window.image_frame_iframe.location.reload(true);
}

//Reload Review Frame
function reload_review(){
window.review.location.reload(true);
}

//Reload Review Frame
function reload_finish(){
window.finish_frame.location.reload(true);
}

// Validate All.			
function validate_everything(form){

 //Return Validate Contact Details
if(!validate_contact_details(form)){
return false;
} 

//Return Validate Personal Details		
if(!validate_personal_details(form)){
return false;
} 

return true;	

}// end validate all

function validate_contact_details(form){

//Change all inputs to white
// var inputs = document.getElementsByTagName("input");
// for (var i = 0; i < inputs.length; i++) {	inputs[i].style.border="2px solid #FFF"; 		}

// Start validation 

if(!IsEmpty(form.first_name)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');
alert('You have not entered your first name') 
document.getElementById("first_name").style.border="2px dotted #FF0000";
form.first_name.focus(); 
return false;
}

if(!IsEmpty(form.surname)){
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered your surname') 
document.getElementById("surname").style.border="1px dotted #FF0000";
form.surname.focus(); 
return false;	 
}			 

if(!IsEmpty(form.addressline1)){
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered your address')
document.getElementById("addressline1").style.border="1px dotted #FF0000";
form.addressline1.focus(); 
return false;
}

if(!IsEmpty(form.city)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered a city') 
document.getElementById("city").style.border="1px dotted #FF0000";
form.city.focus(); 
return false;
}

if(!IsEmpty(form.county)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered a county') 
document.getElementById("county").style.border="1px dotted #FF0000";
form.county.focus(); 
return false;
}

if(!IsEmpty(form.postcode)){
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered your postcode') 
document.getElementById("postcode").style.border="1px dotted #FF0000";
form.postcode.focus(); 
return false;
}

if(!IsEmpty(form.email)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered your email address') 
document.getElementById("email").style.border="1px dotted #FF0000";
form.email.focus(); 
return false;
}

if (isValidEmail(form.email.value) > 0) { 
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

form.email.focus();
alert('You have not entered a valid email address') 
document.getElementById("email").style.border="1px dotted #FF0000";
form.email.select();
return false;
}

if(!IsEmpty(form.mobile)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('You have not entered your mobile telephone number') 
form.mobile.focus(); 
document.getElementById("mobile2").style.border="1px dotted #FF0000";
return false;
}

if (!IsNumeric(form.mobile.value)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('Please enter only numbers in the mobile telephone field. - No Spaces please.') ;
form.mobile.focus(); 
document.getElementById("mobile2").style.border="1px dotted #FF0000";
return false;
}

if (!IsNumeric(form.telephone.value)) {
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('Please enter only numbers in the telephone field - No Spaces please.') ;
form.telephone.focus(); 
document.getElementById("telephone").style.border="1px dotted #FF0000";
return false;
}

if (form.email.value!=form.email2.value){
MM_showHideLayers('contact-div','','show','upload-div','','hide','personal-div','','hide','revapp','','hide','finish','','hide');

alert('Your email address does not match. Please check your spelling.');
return false;
}
 
return true;
}

function validate_personal_details(form)		{
if(!IsEmpty(form.day)) 
{ 
MM_showHideLayers('contact-div','','hide','upload-div','','hide','personal-div','','show','revapp','','hide','finish','','hide');

alert('Please enter the your date of birth'); 
document.getElementById('day').style.border="1px dotted #FF0000";
form.day.focus();
return false;
}

if(!IsEmpty(form.month)) 			
{ 
MM_showHideLayers('contact-div','','hide','upload-div','','hide','personal-div','','show','revapp','','hide','finish','','hide');

alert('Please enter the your month of birth') ;
document.getElementById("month").style.border="1px dotted #FF0000";
form.month.focus();
return false;
}

if(!IsEmpty(form.year)) 
{MM_showHideLayers('contact-div','','hide','upload-div','','hide','personal-div','','show','revapp','','hide','finish','','hide');
alert('Please enter the your year of birth'); 
document.getElementById("year").style.border="1px dotted #FF0000";
form.year.focus();
return false;
}
return true;
}
