// JavaScript Document
var xmlHttp
var xmlHttp2
var xmlHttp3
var countryMenu =0; 
var typeMenu = 0;
function filterData(str,menuType,divName,page)
{ 
//alert("filter");

if(menuType =="country" && str !="nocountry")
{
countryMenu =1;
}

if(menuType =="type" && str !="notype")
{
typeMenu =1;
}

xmlHttp=GetXmlHttpObject();
 
if (xmlHttp==null)
{
 
 
alert ("Browser does not support HTTP Request");
 
 
return
 
 
}
 
var url=page;

url=url+"?q="+str+"&menu="+menuType+"&country="+countryMenu+"&type="+typeMenu;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=function () {
           stateChanged(divName);
        };
xmlHttp.open("GET",url,true);
 
xmlHttp.send(null);
//fillCombobox(str,"cityDiv","fillComboBox.php");
}

// will create object from xmlHttpRequest
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;
}


// will fill the div with records from database
function stateChanged(div) 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById(div).innerHTML=xmlHttp.responseText;
 } else{
	
 document.getElementById(div).innerHTML = '<div id="loader" style="display:block; clear:both; padding-top:20px; overflow:hidden; text-align:center  "> <img src="../images/loader.gif" /> </div>';
 }
}




// will poulate the combobox
function fillCombobox(str,type,divName,page)
 
{ 


xmlHttp2=GetXmlHttp2Object();

if(xmlHttp2==null)
{
alert ("Browser does not support HTTP Request");
 
return
}
 
var url=page;

url=url+"?combo="+str+"&type="+type;
url=url+"&sid="+Math.random();

xmlHttp2.onreadystatechange=function () {
           stateChanged2(divName);
        };
xmlHttp2.open("GET",url,true);

xmlHttp2.send(null);
 
} 
 
 

function GetXmlHttp2Object()
{
var xmlHttp2=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp2=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp2;
}


// will fill the div with records from database
function stateChanged2(div) 
{ 
if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 { 

 document.getElementById(div).innerHTML=xmlHttp2.responseText;
 
 } 
}



// will create applicants form
function showApplicants(div,page)
{ 
var txtbox;
txtbox = document.getElementById("app_num").value;
xmlHttp3=GetXmlHttp3Object();

if(xmlHttp3==null)
{
alert ("Browser does not support HTTP Request");
 
return
}
 
var url=page;

url=url+"?app="+txtbox;
url=url+"&sid="+Math.random();

xmlHttp3.onreadystatechange=function () {
           stateChanged3(div);
        };
xmlHttp3.open("GET",url,true);

xmlHttp3.send(null);
 
} 
 
 

function GetXmlHttp3Object()
{
var xmlHttp3=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp3=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp3;
}


// will fill the div with records from database
function stateChanged3(div) 
{ 
if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
 { 

 document.getElementById(div).innerHTML=xmlHttp3.responseText;
 
 } 
}





