var glob1 = 0;
var glob2 = 0;
function change(x)
{
	var designation = x;//document.getElementById("country").value;
	//alert(designation);
	
//	if(designation =="")
	//	designation = x;
//alert(designation);
	if(designation == "--")
	{
	
	}
	else
	{
		//alert(designation);
		showDesigEmployee(designation);
	}
	
}



function change_subrub(x)
{
//	if(document.all)
	var designation = x;//document.getElementById("city").value;
	//else
	//var designation = document.getElementById("get_city").getElementsByTagName("select")[0].value;
	
	//if(designation =="")
		//designation = x;
	
	//alert(designation);
	if(designation == "--")
	{
	
	}
	else
	{
		//alert(designation);
		showDesigEmployee1(designation);
	}
	
}




function change_subrub1(x)
{
	//if(document.all)
	var designation = x;//document.getElementById("sub_rub").value;
//	else
	//var designation = document.getElementById('subrub').getElementsByTagName("select")[0].value;
	
	//if(designation =="")
		//designation = x;

	//alert(designation);
	if(designation == "--")
	{
	
	}
	else
	{
		//alert(designation);
		showDesigEmployee2(designation);
	}
	
}



var xmlHttp_combo
function showDesigEmployee(str)
{ 
	//alert();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="./ajax/get_city.php";
	url=url+"?query="+str;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged_combo;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged_combo() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("get_city").innerHTML=xmlHttp.responseText;
		//document.getElementById("get_combo_employee").innerHTML=document.getElementById("optional_desegnetion").value;
		if(glob1 > 0)
			change_subrub(glob1);
//	alert(glob2);
}
	else
	{
		document.getElementById("get_city").innerHTML="Please Wait while loading ...";
	}

}


//get subrub///////////////////////////////////////
var xmlHttp_combo1
function showDesigEmployee1(str)
{ 
	//alert();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="./ajax/get_subrub.php";
	url=url+"?query="+str;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged_combo1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged_combo1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("subrub").innerHTML=xmlHttp.responseText;
		//document.getElementById("get_combo_employee").innerHTML=document.getElementById("optional_desegnetion").value;
		if(glob2 > 0)
			change_subrub1(glob2);

	
	}
	else
	{
		document.getElementById("subrub").innerHTML="Please Wait while loading ...";
	}
}
///////////////////////////////////////////////////


//get subrub2///////////////////////////////////////
var xmlHttp_combo1
function showDesigEmployee2(str)
{ 
	//alert();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="./ajax/get_city1.php";
	url=url+"?query="+str;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=stateChanged_combo2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged_combo2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("get_city1").innerHTML=xmlHttp.responseText;
		//document.getElementById("get_combo_employee").innerHTML=document.getElementById("optional_desegnetion").value;
	}
	else
	{
		document.getElementById("get_city1").innerHTML="Please Wait while loading ...";
	}
}
///////////////////////////////////////////////////

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;
}
///////////////////////////////////////////////////////////////////////
