
var ajaxId;

function GetXmlHttpObject(){

  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function stateChanged(){

	if (xmlHttp.readyState==4)
	{

		document.getElementById(ajaxId).innerHTML = xmlHttp.responseText;
		
		closeLoadWin();
	}
}// end fx
function valueChange(){

	if (xmlHttp.readyState==4)
	{

		document.getElementById(ajaxId).value = xmlHttp.responseText;
		
	}
}// end fx

function openLoadWin(){
	
	loadWinObj = document.getElementById('loadingBox');
	loadWinObj.style.visibility = "visible";
    loadWinObj.style.top = "45%";
    loadWinObj.style.left = "35%";
    loadWinObj.style.width = "150px";
    loadWinObj.style.height = "150px";
 
     loadStr = '<div style="margin:30px;margin-left:10px;margin-right:auto;">';
    loadStr = loadStr + '<img src="loader2.gif" />&nbsp;&nbsp;&nbsp;&nbsp;Loading...</div>';
    
    loadWinObj.innerHTML = loadStr;

}//edn fx

function closeLoadWin(){

	loadWinObj = document.getElementById('loadingBox');
	loadWinObj.style.visibility = "hidden";
    loadWinObj.style.top = "0px";
    loadWinObj.style.left = "0px";
    loadWinObj.style.width = "1px";
    loadWinObj.style.height = "1px";
    loadStr = '<div>boo!</div>';
    
    loadWinObj.innerHTML = loadStr;
	
}

function loadStrip(whoMe,myAjax){
	
	str = whoMe;
	
		ajaxId = myAjax;
		
		openLoadWin();
	
	
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  //alert ("Your browser does not support AJAX!");
		  return true;
		  }
		var url="qt_ajax/strip_search.php";
		url=url+"?id="+str+"&ajid="+ajaxId;
		xmlHttp.onreadystatechange=stateChanged;
		
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return false;
	
}/// end fx

function searchStrips(whoMe,myAjax){
	
	myObj = document.getElementById('search_date'+whoMe);
	str = myObj.value;
	
	if((str != 'mm/dd/yyyy') && (str != '')){
	
		ajaxId = myAjax;
		
		openLoadWin();
	
	
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  //alert ("Your browser does not support AJAX!");
		  location.href="?date="+str;
		  return false;
		  }
		var url="qt_ajax/strip_search.php";
		url=url+"?date="+str+"&ajid="+ajaxId;
		xmlHttp.onreadystatechange=stateChanged;
		
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return false;
	}//edn if val
	else{
		alert("Please select a date.");
		myObj.focus();
		
	}//end else
	
}/// end fx


