// JavaScript Document
//Aamir Yousuf
//Dated 19-01-2009
//Web Team - J&K Bank
function getATMInfo(frmObj,actionid)
{


		document.getElementById(actionid).innerHTML="<div align='left' class='blu' ><b><img src='images/ajax-loader.gif' border='0' align='absbottom'> Loading...</b>";
		url="getBranch.php?op=atmlist&atmid="+frmObj.value+"&loc="+document.getElementById("locval").value;
		ajaxFunction(url,actionid);
		
	
}
function submform(obj)
{
	if(obj.value!="")
	{
		frmbr.submit();	
	}
}

function getBranches(frmObj,actionid)
{

	if(frmObj.value!="")
	{
		document.getElementById(actionid).innerHTML="<div align='left' class='blu' ><b><img src='images/ajax-loader.gif' border='0' align='absbottom'> Loading...</b>";
		document.getElementById("branchdetail").innerHTML="";
		url="getBranch.php?op=branchlist&cric="+frmObj.value+"&loc="+document.getElementById("locval").value;
		//alert(url);
		ajaxFunction(url,actionid);
		
	}
}

function getBranchInfo(frmObj,actionid)
{

	if(frmObj.value!="")
	{
		document.getElementById("branchdetail").innerHTML="<div align='center' class='blu' ><b><img src='images/ajax-loader.gif' border='0' align='absbottom'> Loading...</b>";
		document.getElementById("branchdetail").style.display="block";
		document.getElementById("branchdetail").style.visibility="visible";
		url="getBranch.php?op=branch&sol="+frmObj.value
		//alert(url);
		ajaxFunction(url,"branchdetail");
		
	}
}
function loadResults(key1,key2)
{
//	alert(res);
	retrievedObject = window[key1];
	//alert(retrievedObject.prop2);
	//alert(retrievedObject.prop1);
	document.getElementById(retrievedObject.prop2).innerHTML=retrievedObject.prop1;
}
function ajaxFunction(url,action)
{
	
	
//	alert(url);
	try
  	{
  // Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
  	{
  		// Internet Explorer
  		try
   		 {
   			 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
   		 }
 		 catch (e)
  		  {
  			  try
  			   {
    			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    		  }
   			   catch (e)
    		  {
     				 alert("undefined error");
      				 return false;
      			}
   			 }
  	}
 
  xmlHttp.onreadystatechange=function()
  {
    if(xmlHttp.readyState==4)
      {
		
		res= xmlHttp.responseText;
//	
	
		if (xmlHttp.status==200) 
		{	
		//alert(res);
		//loadResults(res,action);
		//window.setTimeout('loadResults(\''+res+'\')',3000);
		
		//window.setTimeout("alert(" + res + ");", 1000);
		//window.setTimeout('loadResults(\''+res+'\','+action+')',10);
		//window.setTimeout(function loadResults(res,action){alert(res);//document.getElementById(action).innerHTML=res;;
//},1000);
		var key1="1234";
		var key2="4321";
		
		window[key1] = new Object();	
		window[key1].prop1 = res;;
		window[key1].prop2 = action;;
		window.setTimeout("loadResults('" + key1 + "')",2500);
//function timeoutTest(key){	retrievedObject = window[key];	alert(retrievedObject.prop1);}

		
		}
		//document.getElementById(action).innerHTML=res;;
		//document.getElementById("loader").style.visibility="hidden";
		//res="";
		//if (xmlHttp.status==200) {
            // we use a delay only for this example
            //;
       // }

		
		}
		
		
	
    }
	//return (res);
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
  //return (res);
  }

