// JavaScript Document
var xmlHttp
var baseURL = window.location.protocol + "//" + window.location.host + "/";
//var baseURL = "http://localhost/failtehotels/";

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function showRevbackup(str,hid)
{ 
	if(hid>0)
	{
		hidediv('txtHint');
	}
	showdiv('busy');
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
		 alert ("Review is not available")
		 return
 	}
	
	var url=baseURL+"require/get_review.php"
	url=url+"?q="+str+"&h="+hid
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=function()
	{
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			hidediv('busy');
			showdiv('txtHint');
			document.getElementById("txtHint").innerHTML=xmlHttp.responseText 		
		} 
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function showRev(str,hid)
{ 
	if(hid>0)
	{
		hidediv('txtHint');
	}
	showdiv('busy');
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
		 alert ("Review is not available")
		 return
 	}
	
	var url="require/get_review.php"
	url=url+"?q="+str+"&h="+hid
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=function()
	{
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			hidediv('busy');
			showdiv('txtHint');
			document.getElementById("txtHint").innerHTML=xmlHttp.responseText 		
		} 
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
/*
function showSchedule(HotelId,Arrival,Departure,Nights,Allow)
{ 
	if(HotelId>0)
	{
		hidediv('txtHintS');
	}
	showdiv('busyS');
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
		 alert ("Could not process request")
		 return
 	}
	
//	var url="http://failtehotels.ie/require/get_schedule_MultiSpecialF.php"
	var url="require/get_schedule_MultiSpecialF.php"
	
	url=url+"?Hotel="+HotelId+"&amp;Arrival="+Arrival+"&Departure="+Departure+"&Nights="+Nights+"&Allow="+Allow
	url=url+"&sid="+Math.random()
	
	
	xmlHttp.onreadystatechange=function()
	{
		
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			hidediv('busyS');
			showdiv('txtHintS');
			document.getElementById("txtHintS").innerHTML=xmlHttp.responseText 		
		} 
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
*/

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 load_test(url){
	//var url="http://failtehotels.ie/require/get_schedule_MultiSpecialF.php";	
	url_value="test=1";
	url_value=url_value+"&sid="+Math.random()
// Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send(url_value);
}
function showSchedule(HotelId,Arrival,Departure,Nights,Allow){
try{
var url=baseURL+"require/get_schedule_MultiSpecialF.php";	
load_test(url);
} catch(e) {
var url=baseURL+"require/get_schedule_MultiSpecialF.php";	

}

var xmlHttpReq = false;
    var self = this;
if(HotelId>0)
	{
		hidediv('txtHintS');
	}
	showdiv('busyS');
	
/*	var url="require/get_schedule_MultiSpecialF.php"	
	url=url+"?Hotel="+HotelId+"&amp;Arrival="+Arrival+"&Departure="+Departure+"&Nights="+Nights+"&Allow="+Allow
	url=url+"&sid="+Math.random()
*/

//	var url="http://failtehotels.ie/require/get_schedule_MultiSpecialF.php";	
 //  var url="http://localhost/nuatech/failtehotels.ie/require/get_schedule_MultiSpecialF.php";
	//var url="http://localhost/failtehotels/require/get_schedule_MultiSpecialF.php";  
	url_value="Hotel="+HotelId+"&Arrival="+Arrival+"&Departure="+Departure+"&Nights="+Nights+"&Allow="+Allow
	url_value=url_value+"&sid="+Math.random()


// Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(url_value);
}

function updatepage2(str){
			hidediv('busy');
			showdiv('txtHint');
			document.getElementById("txtHint").innerHTML=str; 		

}

function updatepage(str){
		//    document.getElementById("result").innerHTML = str;
			hidediv('busyS');
			showdiv('txtHintS');
			//alert(str);
			document.getElementById("txtHintS").innerHTML=str; 		

}
////////
