function validateMyForm(){if(document.searchformadv.the_input.value=='Search ChefDb'||document.searchformadv.the_input.value=='Find listing'||document.searchformadv.the_input.value==''){document.searchformadv.the_input.focus()
alert('Please enter a search term');return false;}
return true;}
function validateNew(){bSubmit=true;strmessage='';if(document.Submit.theplaceselected.value==''){strmessage=strmessage+"\n Enter the name of the restaurant";bSubmit=false;}
if(document.Submit.thecityselected.value==''){strmessage=strmessage+"\n Enter the city name";bSubmit=false;}
if(document.Submit.thetitleselected.value==''){strmessage=strmessage+"\n Enter the position";bSubmit=false;}
if(document.Submit.durationfrom.value=='--'){strmessage=strmessage+"\n Enter the beginning year";bSubmit=false;}
if(document.Submit.durationto.value=='--'){strmessage=strmessage+"\n Enter the end year";bSubmit=false;}
if(document.Submit.durationto.value<document.Submit.durationfrom.value){strmessage=strmessage+"\n The starting year must be equal to or before than the ending year";bSubmit=false;}
if(strmessage!=''){alert("There is a problem with your submission:\n"+strmessage)}
return bSubmit;}
function validateAdd(){bSubmit=true;strmessage='';if(document.Submit.chefname.value==''){strmessage=strmessage+"\n You must enter your name";bSubmit=false;}
if(document.Submit.city.value==''){strmessage=strmessage+"\n Enter the city name";bSubmit=false;}
if(document.Submit.thetitleselected.value==''){strmessage=strmessage+"\n Enter the position";bSubmit=false;}
if(document.Submit.durationfrom.value=='--'){strmessage=strmessage+"\n Enter the beginning year";bSubmit=false;}
if(document.Submit.durationto.value=='--'){strmessage=strmessage+"\n Enter the end year";bSubmit=false;}
if(document.Submit.durationto.value<document.Submit.durationfrom.value){strmessage=strmessage+"\n The starting year must be equal to or less than the ending year";bSubmit=false;}
if(strmessage!=''){alert("There is a problem with your submission:\n\n"+strmessage)}
return bSubmit;}
function validateEmailFriend(){bSubmit=true;strmessage='';if(document.Submit.name.value==''){strmessage=strmessage+"\n Please enter your name";bSubmit=false;}
if(document.Submit.email.value==''){strmessage=strmessage+"\n Please enter your email address";bSubmit=false;}
if(document.Submit.f_email.value==''){strmessage=strmessage+"\n Please enter your friend's email address";bSubmit=false;}
if(strmessage!=''){alert("There is a problem with your submission:\n\n"+strmessage)}
return bSubmit;}
function validateNewUser(){bSubmit=true;strmessage='';var password=document.newu.password.value;var password2=document.newu.password2.value;if(document.newu.firstname.value==''){strmessage=strmessage+"\n Please enter your first name";bSubmit=false;}
if(document.newu.lastname.value==''){strmessage=strmessage+"\n Please enter your last name";bSubmit=false;}
if(document.newu.username.value==''){strmessage=strmessage+"\n Please enter a username";bSubmit=false;}
if(document.newu.email.value==''){strmessage=strmessage+"\n Please enter your email address";bSubmit=false;}
if(document.newu.password.value==''){strmessage=strmessage+"\n Please enter your password";bSubmit=false;}
if(document.newu.password2.value==''){strmessage=strmessage+"\n Please re-type your password";bSubmit=false;}
if(password!=password2){strmessage=strmessage+"\n Your passwords do not match";bSubmit=false;}
if(password.length<6){strmessage=strmessage+"\n Please use a longer password";bSubmit=false;}
if(document.newu.city.value==''){strmessage=strmessage+"\n Please enter your city";bSubmit=false;}
if(strmessage!=''){alert("There is a problem with your submission:\n"+strmessage)}
return bSubmit;}
function preloadImages(name,src){eval(name+"= new Image()");eval(name+".src ='"+src+"'");}
var timeout=1000;var http=false;if(navigator.appName=="Microsoft Internet Explorer"){http=new ActiveXObject("Microsoft.XMLHTTP");http2=new ActiveXObject("Microsoft.XMLHTTP");http3=new ActiveXObject("Microsoft.XMLHTTP");}else{http=new XMLHttpRequest();http2=new XMLHttpRequest();http3=new XMLHttpRequest();}
function getpeople(person){if(person.length>2){document.getElementById("thepeople").style.visibility='visible';if(navigator.userAgent.indexOf("Firefox")!=-1){document.getElementById("adv").style.display='none';}
http.abort();http.open("GET","/ajax/getpeople.php?input="+escape(person),true);http.onreadystatechange=function(){if(http.readyState==4||http.readyState==0){document.getElementById('thepeople').innerHTML=http.responseText;}else{document.getElementById('thepeople').innerHTML='<img src="/media/ajax-indicator.gif">';}}
http.send(null+'/n');if(document.getElementById('thepeople').value==''){document.getElementById("thepeople").style.visibility='hidden';}}}
function gettopcities(){document.getElementById("topcities").style.visibility='visible';document.getElementById("topcities").style.display='block';http.abort();http.open("GET","/ajax/gettopcities.php",true);http.onreadystatechange=function(){if(http.readyState==4||http.readyState==0){document.getElementById('topcities').innerHTML=http.responseText;}else{document.getElementById('topcities').innerHTML='<img src="/media/ajax-indicator.gif">';}}
http.send(null+'/n');}
function openpopup(number){var output='';if(number=='1'){var popurl="/terms/"
var wide='width=500'
var tall='height=500'}else{if(number=='7'){
var popurl="/privacy/"
var wide='width=500'
var tall='height=320'}else{var popurl='/mailfriend.php?page='+number+'&name='+name
var wide='width=650'
var tall='height=470'}}
winpops=window.open(popurl,'','scrollbars=yes,'+wide+','+tall+',left=40,top=125')}
function launchpopup(url,name,width,height){var ie4final=(navigator.appVersion.indexOf('MSIE 4')!=-1);var msie=(navigator.appVersion.indexOf('MSIE')!=-1);var size="height="+height+",width="+width;mypopwnd=parent.window.open(url,name,size+",status=no,scrollbars=yes,toolbar=no,"+"menubar=no,location=no,resizable=no, left=80, top=60",true);if(ie4final){window.event.returnValue=false;}
if(!msie){mypopwnd.focus();}}
function MM_callJS(jsStr){return eval(jsStr)}
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_validateForm(){var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;for(i=0;i<(args.length-2);i+=3){test=args[i+2];val=MM_findObj(args[i]);if(val){nm=val.name;if((val=val.value)!=""){if(test.indexOf('isEmail')!=-1){p=val.indexOf('@');if(p<1||p==(val.length-1))errors+='- '+nm+' must contain an e-mail address.\n';}else if(test!='R'){num=parseFloat(val);if(isNaN(val))errors+='- '+nm+' must contain a number.\n';if(test.indexOf('inRange')!=-1){p=test.indexOf(':');min=test.substring(8,p);max=test.substring(p+1);if(num<min||max<num)errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';}}}else if(test.charAt(0)=='R')errors+='- '+nm+' is required.\n';}}if(errors)alert('The following error(s) occurred:\n'+errors);document.MM_returnValue=(errors=='');}
function CheckQuote($the_input)
{if(!get_magic_quotes_gpc())
{$the_input=addslashes($the_input);}
return($the_input);}
function checkUncheckAll(theElement){var theForm=theElement.form,z=0;while(theForm[z].type=='chkrss'&&theForm[z].name!='checkall'){theForm[z].checked=theElement.checked;z++;}}
function RSSFeed(instructions,address)
{var instructions;var address;var ranNum=Math.round(Math.random()*4);return ranNum;window.prompt(instructions,address+'?ID='+ranNum);}


function validateMyForm2(type){if(type=='closed'){if(document.closed.closed.checked==false){alert('Please check the box before submitting');return false;}
return true;document.closed.submit;}else{if(type=='city'){if(document.cityselect.cityPeople.value=='Select City'){alert('Please select a city from the dropdown list');return false;}
return true;document.cityselect.submit;}else{if(type=='title'){if(document.titleselect.TitleID.value=='Select Title'){alert('Please select a title from the dropdown list');return false;}
return true;document.titleselect.submit;}else{if(type=='search'){if(document.searchform.the_input.value=='Search ChefDb'||document.searchform.the_input.value==''){alert('Please enter a search term');return false;}
if(document.searchform.the_input.value.length==1||document.searchform.the_input.value=='The '){alert('Please enter a longer search term');return false;}
return true;}}}}}
function validateAddress(){if(document.form1.address.value==''){alert('Please enter an address');return false;}
return true;}
function validateSomething(){if(document.resumeupload.filetoupload.value==''){alert('Please browse to your resume and re-submit');return false;}
return true;}


function CheckBlank(boxtocheck,type)
{var boxtocheck;if(type=='inst'){if(boxtocheck.value!=1){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='cred'){if(boxtocheck.value!=40){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='city'){if(boxtocheck.value!=5){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='province'){if(boxtocheck.value!=3){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='country'){if(boxtocheck.value!=5){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='team'){if(boxtocheck.value!=30){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(type=='comp'){if(boxtocheck.value!=39){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}}else{if(boxtocheck.value!=0){alert('You have already selected a name from the dropdown list.  If you wish to enter a new name, please click the \'Clear\' button above and try again.');boxtocheck.focus()}
return false;}}}}}}}
return true;}
function CheckBlank2(boxtocheck)
{var boxtocheck;if(boxtocheck.value!=""){alert('The new name you entered below will be cleared because you have selected a name from the dropdown list.');boxtocheck.value=""
return false;}
return true;}
function matchname(Chefname){var Chefname
Chefname.value=this.form.FirstName.value+" "+this.form.LastName.value;}
function setProv(prov,country,region){var prov,country,region;document.form.provID.value=+prov;document.form.countryID.value=+country;document.form.regionID.value=+region;}
function setCPCR(city){var city;if(city=='New York'){document.form.provID.value=5;document.form.countryID.value=3;document.form.regionID.value=1;}}
function PersonnelCheck(scope,url,rid){var scope;var url;var rid;var popurl='/pl/'+rid+'/'+url+'/'+scope;window.location.assign(popurl);}
function submitform(formname)
{document.getElementById(formname).submit();}
function toggleGTS(state){if(document.getElementById){var gtsLink=document.getElementById("gtsLink");gtsLink.setAttribute("href","#");var menu=document.getElementById("goToSectionBox").firstChild;while(menu.nodeType!=1){menu=menu.nextSibling;}
setElementClass(gtsLink,state);setElementClass(menu,state);if(document.getElementById("searchType")){if(state=="active"){document.getElementById("searchType").style.visibility="hidden";}else{document.getElementById("searchType").style.visibility="visible";}}}}
function SearchHints(showhide,theelement)
{if(showhide=='show'){document.getElementById(theelement).style.display='block'}else{if(showhide=='hide'){document.getElementById(theelement).style.display='none'}}}
function closeWindow(){document.getElementById("topcities").style.display='none';document.getElementById("closewindow").style.display='none';}
