//  first ajax request
var http = createRequestObject();
var objectId = '';


function createRequestObject(htmlObjectId){
    var obj;
    var browser = navigator.appName;
    
    objectId = htmlObjectId;
    
	if(window.ActiveXObject) {
	  // Instantiate the latest Microsoft ActiveX Objects
	  if(_XML_ActiveX) {
   		obj = new ActiveXObject(_XML_ActiveX);
  	  } else {
		   // loops through the various versions of XMLHTTP to ensure we're using the latest
		   var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];
		   for(var i = 0; i < versions.length ; i++) {
			    try {
				     // Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
				     obj = new ActiveXObject(versions[i]);
				     if(obj) {
					      var _XML_ActiveX = versions[i];
					      break;
				     }
			    } catch (e) {
			     // TRAP
			    };
	   		};
  	   }
 	} // Well if there is no ActiveXObject available it must be firefox, opera, or something else
 	if(!obj && typeof XMLHttpRequest != 'undefined') {
  		try {
   			obj = new XMLHttpRequest();
  		} catch (e) {
   			obj = false;
  		}
 	 }
     /*if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObject("Microsoft.XMLHTTP");
     }
     else{
        obj = new XMLHttpRequest();
     }*/
     return obj;    
}

function sendReq(serverFileName, variableNames, variableValues) {
	var paramString = '';
	
	variableNames = variableNames.split(',');
	variableValues = variableValues.split(',');
	
	for(i=0; i<variableNames.length; i++) {
		paramString += variableNames[i]+'='+variableValues[i]+'&';
	}
	paramString = paramString.substring(0, (paramString.length-1));
	if (paramString.length == 0) {
	   	http.open('get', serverFileName);
	}
	else {
		http.open('get', serverFileName+'?'+paramString);
	}
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
	
	if(http.readyState == 4){
		responseText = http.responseText;
		//alert('first response '+responseText);
		document.getElementById(objectId).innerHTML = responseText;
    }
}

///////////////// /// End First ajax request //////////////////////////////
//////////////////// Start second ajax request //////////////////////////////

//  second ajax request
var http1 = createRequestObject1();
var objectId1 = '';


function createRequestObject1(htmlObjectId){
    var obj1;
    var browser = navigator.appName;
    
    objectId1 = htmlObjectId;
	if(window.ActiveXObject) {
	  // Instantiate the latest Microsoft ActiveX Objects
	  if(_XML_ActiveX) {
   		obj1 = new ActiveXObject(_XML_ActiveX);
  	  } else {
		   // loops through the various versions of XMLHTTP to ensure we're using the latest
		   var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];
		   for(var i = 0; i < versions.length ; i++) {
			    try {
				     // Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
				     obj1 = new ActiveXObject(versions[i]);
				     if(obj1) {
					      var _XML_ActiveX = versions[i];
					      break;
				     }
			    } catch (e) {
			     // TRAP
			    };
	   		};
  	   }
 	} // Well if there is no ActiveXObject available it must be firefox, opera, or something else
 	if(!obj1 && typeof XMLHttpRequest != 'undefined') {
  		try {
   			obj1 = new XMLHttpRequest();
  		} catch (e) {
   			obj1 = false;
  		}
 	 }
     /*if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObjecxmlhttpt("Microsoft.XMLHTTP");
     }
     else{
        obj = new XMLHttpRequest();
     }*/
    return obj1;    
}

function sendReq1(serverFileName, variableNames, variableValues) {
	var paramString = '';
	
	variableNames = variableNames.split(',');
	variableValues = variableValues.split(',');
	
	for(i=0; i<variableNames.length; i++) {
		paramString += variableNames[i]+'='+variableValues[i]+'&';
	}
	paramString = paramString.substring(0, (paramString.length-1));
	if (paramString.length == 0) {
	   	http1.open('get', serverFileName);
	}
	else {
		
		http1.open('get', serverFileName+'?'+paramString);
	}
    http1.onreadystatechange = handleResponse1;
    http1.send(null);
}

function handleResponse1() {
	if(http1.readyState == 4){
		responseText = http1.responseText;
		//alert(responseText);
		//document.write('second response '+responseText);
		//alert('second response '+responseText);
		document.getElementById(objectId1).innerHTML = responseText;
    }
}
///////////////// /// End second ajax request //////////////////////////////
//////////////////// Start third ajax request //////////////////////////////
//  Third ajax request
var http2 = createRequestObject2();
var objectId2 = '';

function createRequestObject2(htmlObjectId){
    var obj2;
    var browser = navigator.appName;
    
    objectId2 = htmlObjectId;
	if(window.ActiveXObject) {
	  // Instantiate the latest Microsoft ActiveX Objects
	  if(_XML_ActiveX) {
   		obj2 = new ActiveXObject(_XML_ActiveX);
  	  } else {
		   // loops through the various versions of XMLHTTP to ensure we're using the latest
		   var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];
		   for(var i = 0; i < versions.length ; i++) {
			    try {
				     // Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
				     obj2 = new ActiveXObject(versions[i]);
				     if(obj2) {
					      var _XML_ActiveX = versions[i];
					      break;
				     }
			    } catch (e) {
			     // TRAP
			    };
	   		};
  	   }
 	} // Well if there is no ActiveXObject available it must be firefox, opera, or something else
 	if(!obj2 && typeof XMLHttpRequest != 'undefined') {
  		try {
   			obj2 = new XMLHttpRequest();
  		} catch (e) {
   			obj2 = false;
  		}
 	 }
     /*if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObjecxmlhttpt("Microsoft.XMLHTTP");
     }
     else{
        obj = new XMLHttpRequest();
     }*/
    return obj2;    
}

function sendReq2(serverFileName, variableNames, variableValues) {
	var paramString = '';
	
	variableNames = variableNames.split(',');
	variableValues = variableValues.split(',');
	
	for(i=0; i<variableNames.length; i++) {
		paramString += variableNames[i]+'='+variableValues[i]+'&';
	}
	paramString = paramString.substring(0, (paramString.length-1));
	if (paramString.length == 0) {
	   	http2.open('get', serverFileName);
	}
	else {
		http2.open('get', serverFileName+'?'+paramString);
	}
    http2.onreadystatechange = handleResponse2;
    http2.send(null);
}

function handleResponse2() {
	if(http2.readyState == 4){
		responseText = http2.responseText;
		//alert(responseText);
		//document.write('second response '+responseText);
		//alert('second response '+responseText);
		document.getElementById(objectId2).innerHTML = responseText;
    }
}

///////////////// /// End third ajax request //////////////////////////////
//////////////////// Start forth ajax request //////////////////////////////

//  second ajax request
var http3 = createRequestObject3();
var objectId3 = '';


function createRequestObject3(htmlObjectId){
    var obj3;
    var browser = navigator.appName;
    
    objectId3 = htmlObjectId;
	if(window.ActiveXObject) {
	  // Instantiate the latest Microsoft ActiveX Objects
	  if(_XML_ActiveX) {
   		obj3 = new ActiveXObject(_XML_ActiveX);
  	  } else {
		   // loops through the various versions of XMLHTTP to ensure we're using the latest
		   var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];
		   for(var i = 0; i < versions.length ; i++) {
			    try {
				     // Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
				     obj3 = new ActiveXObject(versions[i]);
				     if(obj3) {
					      var _XML_ActiveX = versions[i];
					      break;
				     }
			    } catch (e) {
			     // TRAP
			    };
	   		};
  	   }
 	} // Well if there is no ActiveXObject available it must be firefox, opera, or something else
 	if(!obj3 && typeof XMLHttpRequest != 'undefined') {
  		try {
   			obj3 = new XMLHttpRequest();
  		} catch (e) {
   			obj3 = false;
  		}
 	 }
     /*if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObjecxmlhttpt("Microsoft.XMLHTTP");
     }
     else{
        obj = new XMLHttpRequest();
     }*/
    return obj3;    
}
var divconfirm;
var divreject;
function sendReq3(serverFileName, variableNames, variableValues,divconfirm1,divreject1) {
	var paramString = '';
	divconfirm = divconfirm1;
	divreject = divreject1;

	variableNames = variableNames.split(',');
	variableValues = variableValues.split(',');
	
	for(i=0; i<variableNames.length; i++) {
		paramString += variableNames[i]+'='+variableValues[i]+'&';
	}
	paramString = paramString.substring(0, (paramString.length-1));
	if (paramString.length == 0) {
	   	http3.open('get', serverFileName);
	}
	else {
		http3.open('get', serverFileName+'?'+paramString);
	}
    http3.onreadystatechange = handleResponse3;
	//responseTxt = handleResponse3;

	http3.send(null);
	//return responseTxt;
}

function handleResponse3() {
	if(http3.readyState == 4){
		responseText = http3.responseText;
		if(responseText == 'true'){
			displayfadeinbox(divconfirm);		
		}
		if(responseText == 'false'){
			displayfadeinbox(divreject);
		}
    }
	//alert(objref);
		setTimeout("hidefadebox_customized();",4000);
}
