
var strTitle="";
 var LoadXmlChk;
var countId="";
var cityId="";

function ReadCheckAvail(Id)
 {
  
  if(navigator.appName=="Microsoft Internet Explorer")
    {
     ReadChkXml(Id);
    }
    else
    {
       ReadChkXml1(Id)
    }
   
 }


 
		  function ReadChkXml(Id) 
{ 

	if( window.ActiveXObject && /Win/.test(navigator.userAgent) )
	{ 
		LoadXmlChk = new ActiveXObject("Msxml.DOMDocument"); 
		LoadXmlChk.async = false; 
		LoadXmlChk.onreadystatechange = function () 
		{ 
		    if (LoadXmlChk.readyState == 4) ManipulateXMLChk(Id); 
		} 
		LoadXmlChk.load("../../common_inc/CheckAvaillink.xml"); 
	} 
	else if( document.implementation && document.implementation.createDocument ) 
	{ 
		LoadXmlChk = document.implementation.createDocument("","",null); 
		LoadXmlChk.async=false; 
		var loaded = LoadXmlChk.load("../../common_inc/CheckAvaillink.xml"); 
		moz=1;
		if (loaded) 
		{ 
			ManipulateXMLChk(Id);
		} 
	} 
	else 
	{ 
		alert("Your browser can\'t handle this script"); 
		return; 
	} 
}

function ReadChkXml1(Id)
 {
    var XmlHTTP = null;
    var Possibles = {0: "XMLHttpRequest()", 1: "ActiveXObject('Microsoft.XMLHttp')", 2:"ActiveXObject('MSXML2.XMLHttp')", 3:"ActiveXObject('MSXML2.XMLHttp.3.0')", 4:"ActiveXObject('MSXML2.XMLHttp.4.0')", 5:"ActiveXObject('MSXML2.XMLHttp.5.0')", 6:"ActiveXObject('MSXML2.XMLHttp.6.0')",7:"ActiveXObject('Msxml.DOMDocument')", 8:""};
    var Option = 0;
    while(XmlHTTP === null){
        XmlHTTP = eval("new " + Possibles[Option]);
       
    }
   if(XmlHTTP === null)
    return false;
XmlHTTP.open("get", "../../common_inc/CheckAvaillink.xml", false);
XmlHTTP.send("");
LoadXmlChk = XmlHTTP.responseXML;
ManipulateXMLChk(Id);

}




function ManipulateXMLChk(resortid)
{

strTitle = LoadXmlChk.getElementsByTagName("HotelLinks")[0]; 
if(strTitle.getElementsByTagName('Hotel').length>0)
{
for(var i=0; i<strTitle.getElementsByTagName('Hotel').length; i++) 
{
if(strTitle.getElementsByTagName('Hotel')[i].getAttribute("HotelId")==resortid)
{
countId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("countryId");
cityId=strTitle.getElementsByTagName('Hotel')[i].getAttribute("CityId");
}
}
}
} 




var propertyId=document.getElementById('propId').value;

//ReadCheckAvail(propertyId);

//alert(countId+ " " + cityId);
//document.write("<A href='https://www.trustinternational.com/mBooker/taj/2B?LANGUAGE=en&property=TXL-TJ-" + propertyId + "'><IMG id='IMG2' height=14 src='../images/checkrate.gif' width='164' border=0></A>");
//alert("https://beta.yourreservation.net/ibe/TajHolidays/main.html?ccpSelectCity=" +cityId +"&ccpSelectCountry="+countId+"&ccpSelectHotel=TJ%2D"+propertyId+"&language=EN&quick=page1");
//if(propertyId=="HLTJAIRP" || propertyId=="HLTUDRTL" || propertyId=="HLTJDHTH" || propertyId=="HLTJDHUB" || propertyId=="HLTJAIJM")


if (propertyId == "HLTNYCTP")
    document.write("<A onclick='o_chkRatesAvailability()' href='javascript:opencheckAvailability()'><IMG id='IMG2' height=14 src='../images/checkrate.gif' width='164' border=0></A>");
else
    document.write("<A href='javascript:opencheckAvailability()'><IMG id='IMG2' height=14 src='../images/checkrate.gif' width='164' border=0></A>");
//else
//document.write("<A href='https://www.yourreservation.net/ibe/TajHolidays/main.html?ccpSelectCity=" +cityId +"&ccpSelectCountry="+countId+"&ccpSelectHotel=TJ%2D"+propertyId+"&language=EN&quick=page1'><IMG id='IMG2' height=14 src='../images/checkrate.gif' width='164' border=0></A>");



function opencheckAvailability()
{
var hotelID=document.getElementById('propId').value;
 window.open("https://www.yourreservation.net/ibe/02_taj/main.htm?ccpSelectHotel=TJ-"+hotelID+"&quick=page1");
}
