File: /home/barbeatleanalyti/public_html/manage.beatleanalytics.com/theme/black/js new--/ajax - Copy.js
$(document).ready(function(e) {
$("#State").change(function(e) {
var id = this.value;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
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());
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) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
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();
//$("#PermanentAddZipCode").val(PermanentAddZipCodeVal);
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){
alert("Notification\nYou selected permanent address is same as present addres !");
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);
//$("#PermanentAddState").prop('selectedIndex', PermanentStateCheckedVal);
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;
}
}
/* 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;
}
}
*/
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
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);
}
});
$("#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){
// Code for select permanent state
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;
}
}
}
// Code for select permanent city
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
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){
// Code for select permanent state
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");
})
$("#PresentAdd1").keypress(function(e){
if( e.which == 44){
return false;
}
})
$("#Client").change(function(){
var posid = this.value;
if(posid != 0 && posid != ""){
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
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();
}
})
}); ///// $(document).ready(function(e) complete /////
$(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();
}
})
});