var manual_or_random="manual"
var randomsetting="3 days"
function getCookie(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null}
function setCookie(name,value,days){var expireDate=new Date()
var expstring=(typeof days!="undefined")?expireDate.setDate(expireDate.getDate()+parseInt(days)):expireDate.setDate(expireDate.getDate()-5)
document.cookie=name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";}
function deleteCookie(name){setCookie(name,"moot")}
function setStylesheet(title,randomize){var i,cacheobj,altsheets=[""]
for(i=0;(cacheobj=document.getElementsByTagName("link")[i]);i++){if(cacheobj.getAttribute("rel").toLowerCase()=="alternate stylesheet"&&cacheobj.getAttribute("title")){cacheobj.disabled=true
altsheets.push(cacheobj)
if(cacheobj.getAttribute("title")==title)
cacheobj.disabled=false}}
if(typeof randomize!="undefined"){var randomnumber=Math.floor(Math.random()*altsheets.length)
altsheets[randomnumber].disabled=false}
return(typeof randomize!="undefined"&&altsheets[randomnumber]!="")?altsheets[randomnumber].getAttribute("title"):""}
function chooseStyle(styletitle,days){if(document.getElementById){setStylesheet(styletitle)
setCookie("mysheet",styletitle,days)}}
function indicateSelected(element){if(selectedtitle!=null&&(element.type==undefined||element.type=="select-one")){var element=(element.type=="select-one")?element.options:element
for(var i=0;i<element.length;i++){if(element[i].value==selectedtitle){if(element[i].tagName=="OPTION")
element[i].selected=true
else
element[i].checked=true
break}}}}
if(manual_or_random=="manual"){var selectedtitle=getCookie("mysheet")
if(document.getElementById&&selectedtitle!=null)
setStylesheet(selectedtitle)}
else if(manual_or_random=="random"){if(randomsetting=="eachtime")
setStylesheet("","random")
else if(randomsetting=="sessiononly"){if(getCookie("mysheet_s")==null)
document.cookie="mysheet_s="+setStylesheet("","random")+"; path=/"
else
setStylesheet(getCookie("mysheet_s"))}
else if(randomsetting.search(/^[1-9]+ days/i)!=-1){if(getCookie("mysheet_r")==null||parseInt(getCookie("mysheet_r_days"))!=parseInt(randomsetting)){setCookie("mysheet_r",setStylesheet("","random"),parseInt(randomsetting))
setCookie("mysheet_r_days",randomsetting,parseInt(randomsetting))}
else
setStylesheet(getCookie("mysheet_r"))}}function trim(str)
{return str.replace(/^\s+|\s+$/g,'');}
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 null_value(gg,form_id)
{document.getElementById('job_err_msg').style.display='none';if(form_id=="1")
{var a=document.form_job;}
else if(form_id=="2")
{var a=document.form_job1;}
if(gg==1)
{if(a.email_job.value=='name@companyname.com')
{a.email_job.value='';if(a.phno_job.value=='')
{a.phno_job.value='10 digits mobile no.';}}
else if(a.email_job.value!=''&&a.phno_job.value=='')
{a.phno_job.value='10 digits mobile no.';}}
else if(gg==2)
{if(a.phno_job.value=='10 digits mobile no.')
{a.phno_job.value='';a.phno_job.select();if(a.email_job.value=='')
{a.email_job.value='name@companyname.com';}}}}
function null_value_blur(dd,form_id)
{document.getElementById('job_err_msg').style.display='none';if(form_id=="1")
{var a=document.form_job;}
else if(form_id=="2")
{var a=document.form_job1;}
if(dd==1)
{if(a.email_job.value=='')
{a.email_job.value='name@companyname.com';}}
else if(dd==2)
{if(a.phno_job.value=='')
{a.phno_job.value='10 digits mobile no.';}}}
function validate_jobalert(form_id)
{if(form_id=="1")
{var a=document.form_job;var b="job_err_msg";}
document.getElementById(b).style.display="none";if(trim(a.email_job.value)==""||a.email_job.value=="name@companyname.com")
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Please enter email address.";a.email_job.value="";a.email_job.focus();return false;}
else if((/^([a-zA-Z]([a-z0-9-_\.\+])+([a-z0-9])@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4}))$/).exec(a.email_job.value)==null)
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Invalid email address format.";a.email_job.focus();return false;}
else if((/^[a-zA-Z][a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/).exec(a.email_job.value)==null)
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Invalid email address format.";a.email_job.focus();return false;}
else if((/^([a-zA-Z]([a-z0-9-_\.\+])+([a-z0-9])@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4}))$/).exec(a.email_job.value)==null)
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Invalid email address format.";a.email_job.focus();return false;}
else if(trim(a.phno_job.value)==""||a.phno_job.value=="10 digits mobile no.")
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Please enter mobile no.";a.phno_job.value="";a.phno_job.focus();return false;}
else if(trim(a.phno_job.value).length<10)
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Please enter 10 digit mobile no.";a.phno_job.value="";a.phno_job.focus();return false;}
else if(trim(a.phno_job.value).length>10)
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Please enter 10 digit mobile no.";a.phno_job.value="";a.phno_job.focus();return false;}
else if(isNaN(trim(a.phno_job.value)))
{document.getElementById(b).style.display="block";document.getElementById(b).innerHTML="Please enter numaric mobile no.";a.phno_job.value="";a.phno_job.focus();return false;}
add_jobalert(trim(a.email_job.value),trim(a.phno_job.value));}
function add_jobalert(email,ph)
{xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Your browser does not support AJAX!");return;}
else
{xmlHttp.onreadystatechange=stateChanged_gallery_function;url="ajax-php/insert_jobalert.php?subJobalert=1&email_job="+email+"&phno_job="+ph+"&u="+Math.random();xmlHttp.open("GET",url,true);xmlHttp.send(null);}}
function stateChanged_gallery_function()
{if(xmlHttp.readyState==4)
{var str=xmlHttp.responseText;var str_arr=str.split("~");if(str_arr[0]=="2"){jAlert(str_arr[1],'Job Alert');}
var a=document.form_job;a.phno_job.value="10 digits mobile no.";a.email_job.value="name@companyname.com";return false;}}