var ajaxObject=null;
var scrX =null;
var scrY=null;

function ajaxObjectInitilize(){
	try{  
   		ajaxObject=new XMLHttpRequest(); 
    }catch (e){
    	try{
        ajaxObject=new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e){
        try{
              ajaxObject=new ActiveXObject("Microsoft.XMLHTTP");     
           }catch (e){
                         alert("Your browser does not support AJAX!");     
                          return false;      
                     } 
         }
      }
}


function callingProductDetails(id){
		ajaxObjectInitilize();
		ajaxObject.onreadystatechange = productDisplay;
		ajaxObject.open("GET","/WEB-INF/jsp/productdetails.jsp?id="+id+"&ran="+Math.random(),true);
		ajaxObject.send(null);
}
                 
function productDisplay(){
	if(ajaxObject.readyState){
		document.getElementById("floatingdiv").innerHTML=ajaxObject.responseText;
		document.getElementById("floatingdiv").style.visibility="true";
		document.getElementById("floatingdiv").style.position="absolute";
		document.getElementById("floatingdiv").style.left=scrX;
		document.getElementById("floatingdiv").style.top=scrY;
		
	}
}

function pos(event){
		scrX=event.screenX;
		scrY=event.screenY;
 }

 
 function sendingBillOnMobile(){
 			ajaxObjectInitilize();
 			id = document.getElementById("cellId").value;
			ajaxObject.onreadystatechange = billSentReply;
			ajaxObject.open("GET","SmsServlet?cellId="+id+"&ran="+Math.random(),true);
			ajaxObject.send(null);
 }
 
  function sendingAuthorizationCode(){
 			ajaxObjectInitilize();
 			id = document.getElementById("auth_code").value;
			ajaxObject.onreadystatechange = billSentReply;
			ajaxObject.open("GET","SmsServlet?auth_code="+id+"&ran="+Math.random(),true);
			ajaxObject.send(null);
 }
 
 function billSentReply(){
 			if(ajaxObject.readyState){
					document.getElementById("billSending").innerHTML=ajaxObject.responseText;
					}
 }
 
 function checkingBill(billId){
 			ajaxObjectInitilize();
 			ajaxObject.onreadystatechange = billSentReply;
			ajaxObject.open("POST","SmsServlet?billId="+billId+"&ran="+Math.random(),true);
			ajaxObject.send("billId="+billId+"&ran="+Math.random());
 }
 
 function resetPasscode(){
 			ajaxObjectInitilize();
 			id = document.getElementById("cellId").value;
			ajaxObject.onreadystatechange = billSentReply;
			ajaxObject.open("GET","ResetPasscode?cellId="+id+"&ran="+Math.random(),true);
			ajaxObject.send(null);
 }
 
 function resetPasscodeSecurityQuestionAndEmail(){
 			ajaxObjectInitilize();
 			var flag = document.getElementById("flag").value;
 			var ans=null;
 			
 			if(flag=="answer")
 				ans =document.getElementById("answer").value;
 			else if(flag=="email")
 				ans =document.getElementById("email").value;
 			else if(flag=="mobile")
 				ans =document.getElementById("mobile").value;
 				
 			ajaxObject.onreadystatechange = billSentReply;
			ajaxObject.open("POST","ResetPasscode?answer="+ans+"&flag="+flag+"&ran="+Math.random(),true);
			ajaxObject.send("answer="+ans+"&flag="+flag+"&ran="+Math.random());
 }
 
 
 
 