/*function explode( delimiter, string, limit ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: kenneth
    // +     improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: d3x
    // +     bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: explode(' ', 'Kevin van Zonneveld');
    // *     returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
    // *     example 2: explode('=', 'a=bc=d', 2);
    // *     returns 2: ['a', 'bc=d']
 
    var emptyArray = { 0: '' };
    
    // third argument is not required
    if ( arguments.length < 2 ||
        typeof arguments[0] == 'undefined' ||
        typeof arguments[1] == 'undefined' )
    {
        return null;
    }
 
    if ( delimiter === '' ||
        delimiter === false ||
        delimiter === null )
    {
        return false;
    }
 
    if ( typeof delimiter == 'function' ||
        typeof delimiter == 'object' ||
        typeof string == 'function' ||
        typeof string == 'object' )
    {
        return emptyArray;
    }
 
    if ( delimiter === true ) {
        delimiter = '1';
    }
    
    if (!limit) {
        return string.toString().split(delimiter.toString());
    } else {
        // support for limit argument
        var splitted = string.toString().split(delimiter.toString());
        var partA = splitted.splice(0, limit - 1);
        var partB = splitted.join(delimiter.toString());
        partA.push(partB);
        return partA;
    }
}*/
function createXMLHttpRequesthotel() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	else if (window.XMLHttpRequest) { 
		xmlHttp = new XMLHttpRequest();
	}
}

function createXMLHttpRequesthotelFrom() {
	if (window.ActiveXObject) {
		xmlHttpFrom = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	else if (window.XMLHttpRequest) { 
		xmlHttpFrom = new XMLHttpRequest();
	}
}

//------------------------------------
function hotel_city(lang)
{
	document.getElementById("loading_hotel").style.display='block';	
	createXMLHttpRequesthotel();
	createXMLHttpRequesthotelFrom();
	var xml ='';
	var xmlFrom ='';
	var url = document.getElementById("ajaxurl").value;
	url+="/"+document.getElementById("city_pickup").options[document.getElementById('city_pickup').selectedIndex].value;
	
	var urlFrom = document.getElementById("ajaxurlfrom").value;
	urlFrom+="/"+document.getElementById("city_pickup").options[document.getElementById('city_pickup').selectedIndex].value;
	
	xmlHttp.open("POST", url, true); 
	xmlHttp.setRequestHeader("accept-charset","utf-8");
	xmlHttp.setRequestHeader("Content-Type","text/html; charset=utf-8");
	xmlHttp.onreadystatechange = hotel_city_callback; 
	xmlHttp.send(xml);
	
	xmlHttpFrom.open("POST", urlFrom, true); 
	xmlHttpFrom.setRequestHeader("accept-charset","utf-8");
	xmlHttpFrom.setRequestHeader("Content-Type","text/html; charset=utf-8");
	xmlHttpFrom.onreadystatechange = hotel_city_callback_From;
	xmlHttpFrom.send(xmlFrom);
}
//---------------------------------------
function hotel_city_callback()
{
	if (xmlHttp.readyState == 4) 
	{ 
		if (xmlHttp.status == 200) 
		{ 	
			//array=explode('alaa',xmlHttp.responseText);
			//alert(array[0]);
			document.getElementById("message_hotel").innerHTML=xmlHttp.responseText;
			document.getElementById("loading_hotel").style.display='none';
			transporthotelLeftForm();
			//explode=explode('alaa',xmlHttp.responseText);
			
		}
	}
} 
function hotel_city_callback_From()
{
	if (xmlHttpFrom.readyState == 4) 
	{ 
		if (xmlHttpFrom.status == 200) 
		{ 	
			//array=explode('alaa',xmlHttp.responseText);
			//alert(array[0]);
			document.getElementById("fromselect").innerHTML=xmlHttpFrom.responseText;
			document.getElementById("nametdhotel").style.display='block';
			//explode=explode('alaa',xmlHttp.responseText);
			
		}
	}
} 