File: /home/barbeatleanalyti/public_html/manage.beatleanalytics.com/theme/black/js new--/ajax.js
$(document).ready(function(e){$("#State").change(function(e){var id=this.value;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("Location").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchAllCityList&pg=admin&val1="+id),true);xmlhttp.send();});$("#AddressOptionsY").change(function(){var AddressOptions=$("AddressOptions").is(":checked");var StateCheckedVal=$("#PresentAddState").val();var CityCheckedVal=$("#PresentAddCity").val();$("#PermanentAdd1").val($("#PresentAdd1").val());$("#PermanentAdd2").val($("#PresentAdd2").val());$("#PermanentCompanyPhone").val($("#PresentCompanyPhone").val());$("#PermanentCompanyEmail").val($("#PresentCompanyEmail").val());var objState=document.getElementById('PermanentAddState');var StateLength=objState.options.length;for(var i=0;i<StateLength;i++){if(objState.options[i].value==StateCheckedVal){objState.options[i].selected=true;break;}}
var sel=0;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("PermanentAddCity").innerHTML=xmlhttp.responseText;sel=1;}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchAllCityList&pg=location&val1="+StateCheckedVal),true);xmlhttp.send();var objCity1=document.getElementById('PermanentAddCity');var CityLength=objCity1.options.length;var PresentCityID=document.getElementById('PresentAddCity').value;for(var pc=0;pc<CityLength;pc++){if(objCity1.options[pc].value==PresentCityID){objCity1.options[pc].selected=true;break;}}
$("#PermanentAddZipCode").val($("#PresentAddZipCode").val());});var PermanentAdd1Val=$("#PermanentAdd1").val();var PermanentAdd2Val=$("#PermanentAdd2").val();var PermanentStateCheckedVal=$("#PermanentAddState").val();var PermanentCityCheckedVal=$("#PermanentAddCity").val();var PermanentAddZipCodeVal=$("#PermanentAddZipCode").val();$("#AddressOptionsN").click(function(){$("#PermanentAdd1").val(PermanentAdd1Val);$("#PermanentAdd2").val(PermanentAdd2Val);var objState=document.getElementById('PermanentAddState');var StateLength=objState.options.length;for(var i=0;i<StateLength;i++){if(objState.options[i].value==PermanentStateCheckedVal){objState.options[i].selected=true;break;}}
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("PermanentAddCity").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchAllCityList&pg=location&val1="+PermanentStateCheckedVal),true);xmlhttp.send();$("#PermanentAddZipCode").val(PermanentAddZipCodeVal);});$("#PresentAdd1").keyup(function(){var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==true){$("#PermanentAdd1").val("");$("#PermanentAdd1").val(this.value);}});$("#PresentCompanyPhone").keyup(function(){var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==true){$("#PermanentCompanyPhone").val("");$("#PermanentCompanyPhone").val(this.value);}});$("#PresentCompanyEmail").keyup(function(){var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==true){$("#PermanentCompanyEmail").val("");$("#PermanentCompanyEmail").val(this.value);}});$("#PresentAdd1").blur(function(){var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==true){$("#PermanentAdd1").val("");$("#PermanentAdd1").val(this.value);}});$("#PresentAdd2").keyup(function(){var val=$("#AddressOptionsY").is(":checked");if(val==true){$("#PermanentAdd2").val("");$("#PermanentAdd2").val(this.value);}});$("#PresentAdd2").blur(function(){var val=$("#AddressOptionsY").is(":checked");if(val==true){$("#PermanentAdd2").val("");$("#PermanentAdd2").val(this.value);}});$("#PresentAddZipCode").keyup(function(){var val=$("#AddressOptionsY").is(":checked");if(val==true){$("#PermanentAddZipCode").val("");$("#PermanentAddZipCode").val(this.value);}});$("#PresentAddState").change(function(){var id=this.value;var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==true){var objState=document.getElementById('PermanentAddState');var StateLength=objState.options.length;for(var i=0;i<StateLength;i++){if(objState.options[i].value==id){objState.options[i].selected=true;break;}}}
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("PresentAddCity").innerHTML=xmlhttp.responseText;if(PAVal==true){document.getElementById("PermanentAddCity").innerHTML=xmlhttp.responseText;}}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchAllCityList&pg=location&val1="+id),true);xmlhttp.send();})
$("#PresentAddCity").change(function(){var PAVal=$("#AddressOptionsY").is(":checked");var PermanentCityCheckedVal=this.value;if(PAVal==true){var objCity=document.getElementById('PermanentAddCity');var CityLength=objCity.options.length;for(var i=0;i<CityLength;i++){if(objCity.options[i].value==PermanentCityCheckedVal){objCity.options[i].selected=true;break;}}}})
$("#IsMarriedY").change(function(){alert("please fill the Spouse details.");$("#SpouseFirstName").addClass("required");$("#SpouseMiddleName").addClass("required");$("#SpouseLastName").addClass("required");$("#SpouseDOB").addClass("required");})
$("#IsMarriedN").change(function(){$("#SpouseFirstName").removeClass("required");$("#SpouseMiddleName").removeClass("required");$("#SpouseLastName").removeClass("required");$("#SpouseDOB").removeClass("required");})
$("#Client").change(function(){var posid=this.value;if(posid!=0&&posid!=""){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("Designation").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchPositionData&pg=employee&val1="+posid),true);xmlhttp.send();}})
$("#Location").change(function(){var cityid=this.value;if(cityid!=""){if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200)
{document.getElementById("Branch").innerHTML=xmlhttp.responseText;}}
xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchBranchData&pg=addbranch&val1="+cityid),true);xmlhttp.send();}})});$(document).ready(function(e){$("#LogiIn").click(function(){document.getElementById("login").value='login';})
$("#LogOut").click(function(){document.getElementById("login").value='logout';})});$(document).ready(function(){$("#PermanentAddState").change(function(){document.getElementById('AddressOptionsN').checked=true;var id=this.value;var PAVal=$("#AddressOptionsY").is(":checked");if(PAVal==false){var objState=document.getElementById('PermanentAddState');var StateLength=objState.options.length;for(var i=0;i<StateLength;i++){if(objState.options[i].value==id){objState.options[i].selected=true;break;}}
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById("PermanentAddCity").innerHTML=xmlhttp.responseText;if(PAVal==false){document.getElementById("PermanentAddCity").innerHTML=xmlhttp.responseText;}}};xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=FetchAllCityList&pg=location&val1="+id),true);xmlhttp.send();}})});function setToggele(toggleVal,empid){var nextval='n';if(toggleVal=="n"){nextval='y';}
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){$("[data-toggle='offcanvas']").removeAttr('onclick');$("[data-toggle='offcanvas']").attr('onclick','return setToggele("'+nextval+'")');}};xmlhttp.open("GET","runajax.php?data="+base64_encode("acn=SetLeftToggle&&val1="+toggleVal),true);xmlhttp.send();}
function OnlyCharactor(field){var $th=$("#"+field);$th.val($th.val().replace(/[^a-zA-Z]/g,function(str){alert('Please use only letters like A to Z Or a to z.');return'';}));}