﻿// JScript File
var ext=".htm";
var MenuXml;
var pagenameHotelId=document.getElementById("pageName").value;
var pageNameID=new Array();
pageNameID=pagenameHotelId.split('|');
var loc="No";
var pageName=pageNameID[1];
var HotelIDMenu;//=pageNameID[0];
var currentPage=pageNameID[2]
var motionUrl;
var previd="0imgo";
var prevancid="0anct";
var prev="Overview";
var eventtype=null;

if(querySt("page")!=undefined)
{
    if(querySt("page")!="home")
    {
    currentPage=querySt("page");
    prev=querySt("page");
    }
}
Read();

if(querySt("hotelId")!=undefined)
{

HotelIDMenu=querySt("hotelId");
}
//Read();

function LeftMenu()
{

var Design="<table width='220px' border='0' cellspacing='0' cellpadding='0'>";
Design+="<tr><td style='width:35px;' rowspan='2'>&nbsp;</td><td style='height:41px;width=185px;'>&nbsp;</td></tr>";
Design+="<tr><td><table style='width:100%' border='0' cellspacing='0' cellpadding='0'>";
pageName="Overview";

var xmlObj=MenuXml.documentElement;
var strMainMenu=MenuXml.getElementsByTagName(pageName);
if(querySt("hotelId")!=undefined)
HotelIDMenu=querySt("hotelId");
strSubMenu=strMainMenu[0].getElementsByTagName("SubMenu");
if(querySt("page")!=undefined)
 Design+="<tr id='overviewtop'><td style='width:10px'></td><td height='5px' bgcolor='#FFFFFF'></td></tr>";
 else
 Design+="<tr id='overviewtop'><td style='width:10px'></td><td height='1px' bgcolor='#FFFFFF'></td></tr>";
 for(i=0;i<strSubMenu.length;i++)
 {
    var strChildMenu=strSubMenu[i].getElementsByTagName("ChildMenu");
  
       if(i==1)
       {
         if(querySt("page")!=undefined)
         Design+="<tr id='overviewbottom'><td style='width:10px'></td><td bgcolor='#FFFFFF' style='height:5px;width:180px;' ></td></tr>";
         else
         Design+="<tr id='overviewbottom'><td style='width:10px'></td><td bgcolor='#FFFFFF' style='height:1px;width:180px;' ></td></tr>";
         
       }
        if(strSubMenu.length-1==i) 
        {  
         Design+="<tr style='height:28px;'><td colspan='2' style='height:28px;'  id='"+i+"td'><a target='_blank' href='"+strSubMenu[i].getAttribute("link")+"' class='location"+i+"' ><img border='0' style='height:28px;' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+" onmouseover=changeover('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); onmouseout=changeout('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+"','"+i+"arrow'); /></a></td></tr>";     
        }
        else
        {
          if(i==0)
          {
           if(querySt("page")!=undefined)
           {
           if(querySt("page")=="location")
           {
           Design+="<tr style='height:28px;'><td colspan='2'  style='height:28px;'  id='"+i+"td'><img style='height:28px;' border='0' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+" onmouseover=changeover('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); onmouseout=changeout('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); /></td></tr>";     
           loc=="Yes";
           }
           else
           {
           Design+="<tr style='height:28px;'><td colspan='2'  style='height:28px;'  id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"' class='location"+i+"'><img style='height:28px;' border='0' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("txtimg")+" onmouseover=changeover('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); onmouseout=changeout('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+"','"+i+"arrow'); /></a></td></tr>";     
           loc="YM";
           }
           }
           else
           {
           Design+="<tr style='height:28px;'><td colspan='2'  style='height:28px;'  id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"' class='location"+i+"'><img style='height:28px;' border='0' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+" onmouseover=changeover('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); onmouseout=changeout('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+"','"+i+"arrow'); /></a></td></tr>";     
           }
          }
          else
          {
          Design+="<tr style='height:28px;'><td colspan='2'  style='height:28px;'  id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"' class='location"+i+"'><img style='height:28px;' border='0' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+" onmouseover=changeover('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+"','"+i+"arrow'); onmouseout=changeout('"+i+"img','"+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("img")+"','"+i+"arrow'); /></a></td></tr>";     
          }
        }
     
  
           
       if(i!=0)
       Design+="<tr><td style='width:10px'></td><td height='1' bgcolor='#FFFFFF'></td></tr>";
   
   if(strChildMenu!=null)
    {
        var j=0;
       
        for(j=0;j<strChildMenu.length;j++)
            {
             
                if(j==0)
                {
                Design+="<tr><td></td><td style='width:185px'>";
                if(querySt("page")!=undefined)
                {
                if(querySt("page")=="location")
                Design+="<table width='165px' border='0' align='right' cellpadding='0' cellspacing='0' id='subtab' style='display:none'>";
                else
                Design+="<table width='165px' border='0' align='right' cellpadding='0' cellspacing='0' id='subtab' style='display:block'>";
                }
                else
                {
                Design+="<table width='165px' border='0' align='right' cellpadding='0' cellspacing='0' id='subtab' style='display:none'>";
                }
                
                }
     
              if(strChildMenu[j].getAttribute("hide")!="no")
              {
                 if(CheckHotelId(strChildMenu[j].getAttribute("hid")))
                 {
                  if(strChildMenu[j].getAttribute("name")==currentPage)
                     Design+="<tr style='height:25px;'><td colspan='2' style='height:25px;'  id='"+j+"tdo'><img style='height:25px;' id='"+j+"imgo' border='0' src="+strChildMenu[j].getAttribute("focusimg")+" /></td></tr>";
                     else
                    Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><a id='"+j+"anct' href=javascript:redirectpage('"+HotelIDMenu+"','"+strChildMenu[j].getAttribute("link")+"','"+j+"anct'); ><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("img")+" onmouseover=changeover('"+j+"imgo','"+strChildMenu[j].getAttribute("focusimg")+"','"+j+"arrowo'); onmouseout=changeout('"+j+"imgo','"+strChildMenu[j].getAttribute("img")+"','"+j+"arrowo'); /></a></td></tr>";
                 
                    Design+="<tr><td bgcolor='#FFFFFF' style='height:1px;width:180px;'></td></tr>";
                 } 
              }    
                 else
                  {
                 
                
                  if(strChildMenu[j].getAttribute("name")==currentPage)
                  {
                  Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("focusimg")+"  /></td></tr>";
                  previd=j+"imgo";
                  }
                     // Design+="<tr style='height:25px;'><td colspan='2' style='height:25px;'  id='"+j+"tdo'><img style='height:25px;' id='"+j+"imgo' border='0' src="+strChildMenu[j].getAttribute("focusimg")+" /></td></tr>";
                     else
                     {
                       if(strChildMenu[j].getAttribute("name")=="Overview" || strChildMenu[j].getAttribute("name")=="Dining" || strChildMenu[j].getAttribute("name")=="Rooms" || strChildMenu[j].getAttribute("name")=="Conveniences" || strChildMenu[j].getAttribute("name")=="EventSpace")
                       Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><a class='linkclass' id='"+j+"anct' href=javascript:redirectpage1('"+j+"imgo','"+HotelIDMenu+"','"+strChildMenu[j].getAttribute("link")+"','"+j+"anct');><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("img")+" onmouseover=changeover('"+j+"imgo','"+strChildMenu[j].getAttribute("focusimg")+"','"+j+"arrowo'); onmouseout=changeout('"+j+"imgo','"+strChildMenu[j].getAttribute("img")+"','"+j+"arrowo');  /></a></td></tr>";
                       else
                       {
                       if(strChildMenu[j].getAttribute("name")=="Gallery")
                       {
                       var galurl=HotelIDMenu+"_Gallery.htm";
                       Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><a href='"+galurl+"'><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("img")+" onmouseover=changeover('"+j+"imgo','"+strChildMenu[j].getAttribute("focusimg")+"','"+j+"arrowo'); onmouseout=changeout('"+j+"imgo','"+strChildMenu[j].getAttribute("img")+"','"+j+"arrowo'); /></a></td></tr>";
                       }
                       else
                       {
                       var loc_url=HotelIDMenu+"_Cityfacts.htm";
                       Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><a href='"+loc_url+"'><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("img")+" onmouseover=changeover('"+j+"imgo','"+strChildMenu[j].getAttribute("focusimg")+"','"+j+"arrowo'); onmouseout=changeout('"+j+"imgo','"+strChildMenu[j].getAttribute("img")+"','"+j+"arrowo'); /></a></td></tr>";
                       //Design+="<tr style='height:25px;'><td colspan='2'  style='height:25px;'  id='"+j+"tdo'><a class='linkclass' href=javascript:redirectpage('"+HotelID+"','"+strChildMenu[j].getAttribute("link")+"'); ><img style='height:25px;' border='0' id='"+j+"imgo' src="+strChildMenu[j].getAttribute("img")+" onmouseover=changeover('"+j+"imgo','"+strChildMenu[j].getAttribute("focusimg")+"','"+j+"arrowo'); onmouseout=changeout('"+j+"imgo','"+strChildMenu[j].getAttribute("img")+"','"+j+"arrowo'); /></a></td></tr>";
                       }
                       }
                    }
                 
                   //Design+=generate(strChildMenu,j);
                   if(strChildMenu.length-1!=j)
                   ///flg=0;
                    Design+="<tr><td bgcolor='#FFFFFF' style='height:1px;width:180px;'></td></tr>";
                   else
                   flg=1;
                   //Design+="<tr><td height='5' bgcolor='#FFFFFF'></td></tr>";
                   }
                 var strChildSubMenu=strChildMenu[j].getElementsByTagName("ChildSubMenu");
                
             if(j==strChildMenu.length-1)
            Design+="</table>";
            }
          
     }
     
  
     Design+="</td></tr>";
   }
 var imgBanner=null;
if(HotelIDMenu!='TJAIRL')
{
 imgBanner="<tr style='height:10px;'><td colspan='2'></td></tr><tr><td></td>";
 imgBanner+="<td style='padding-left:10px;'>";
 imgBanner+="<a href='http://www.tajhotels.com/Tajinnercircle/default.aspx' target='_blank'>";
 imgBanner+="<img alt='Book Your Stays On-Line' src='images/Gateway_page_banner.jpg' style='border: 0px' /></a>";
 imgBanner+="<td></tr>";
 }
 
//Code for Taj Inner Circle Banner Image


  if(querySt("page")==undefined || querySt("page")=="Overview")
  {
  if(imgBanner!=null)
  Design+="</table></td></tr>"+imgBanner+"</table>";  
  else
  Design+="</table></td></tr></table>";  
  }
  else
  Design+="</table></td></tr></table>";  


document.getElementById("menu").innerHTML=Design;
MenuXml=null;


}

function Read()
 {
 
   if(navigator.appName=="Microsoft Internet Explorer")
    {
      ReadXml1();
    }
    else
    {
       ReadXml()
    }
 }
function ReadXml()
 {
     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/left_link.xml", false);
XmlHTTP.send("");
MenuXml = XmlHTTP.responseXML;
 LeftMenu(); 
		
}
  
function ReadXml1() 
{ 

	if( window.ActiveXObject && /Win/.test(navigator.userAgent) )
	{ 
		MenuXml = new ActiveXObject("Msxml.DOMDocument"); 
		MenuXml.async = false; 
		MenuXml.onreadystatechange = function () 
		{ 
		    if (MenuXml.readyState == 4)
		    {  
		      LeftMenu(); 
		      
		    }
		
		} 
		MenuXml.load("Common_Inc/left_link.xml"); 
	} 
	else if( document.implementation && document.implementation.createDocument ) 
	{ 
		MenuXml = document.implementation.createDocument("","",null); 
		MenuXml.async=false; 
		var loaded = MenuXml.load("Common_Inc/left_link.xml"); 
		moz=1;
		if (loaded) 
		{ 
			 
		            LeftMenu(); 
		      
		} 
	} 
	else 
	{ 
		alert("Your browser can\'t handle this script"); 
		return; 
	} 
}
 
function CheckHotelId(Ids)
{
 var cnt=0;
 var HotelId=new Array();
 HotelId=Ids.toString().split('|');
 for(m=0;m<HotelId.length;m++)
  {
    if(HotelId[m]==HotelIDMenu)
     {
     cnt++;
     }
  
  }
  if(cnt>0) 
   return false;
  else
   return true; 

} 
 
 function generate(strNode,f)
 {
 var des="@";
 if(strNode[f].getAttribute("name")==currentPage)
 des+="<tr><td height='2' bgcolor='#FFFFFF'></td></tr>";
 else
 {

 if(f<strNode.length-1)
      {
            if(strNode[f+1].getAttribute("name")==currentPage)
            des+="<tr><td height='2' bgcolor='#FFFFFF'></td></tr>";
            else
            des+="<tr><td height='1' bgcolor='#FFFFFF'></td></tr>";
          
      }
 else
      {
             des+="<tr><td height='1' bgcolor='#FFFFFF'></td></tr>";
      }  
 
 }
 des=des.substring(1,des.length);
 return des;
 
 
 }
 
function redirectpage(Id,pname)
{
pagenameHotelId=document.getElementById("pageName").value;
pageNameID=new Array();
pageNameID=pagenameHotelId.split('|');
pageName=pageNameID[1];
HotelID=pageNameID[0];
if(querySt("hotelId")!=undefined)
HotelIDMenu=querySt("hotelId");
//alert("qry="+HotelID);
//alert(pname);
//alert(HotelID+"_"+pname+ext);
currentPage=pageNameID[2]
 //motionUrl=HotelID+"_"+pname+ext; 
currentPage=pname;
var urlstr=HotelIDMenu+"_"+pname+".htm";
document.location.href=urlstr;

}


 function changeover(imgid,imgname,arrowname)
 {
  document.getElementById(imgid).src=imgname;
 }
 function changeout(imgid,imgname,arrowname)
 {
   document.getElementById(imgid).src=imgname;
  /* document.getElementById(previd).src="images/menu_images/"+currentPage+"_over.gif";*/
   if(loc=="Yes")
   document.getElementById("0img").src="images/menu_images/locations_Over.gif";
   if(loc=="YM")
   document.getElementById("0img").src="images/menu_images/locations_Text.gif";
 //alert(document.getElementById("0img").src);
    
 }
  function changeover1(imgid,imgname,arrowname)
 {
 document.getElementById(imgid).src=imgname;
 //document.getElementById(arrowname).src="images/menu_images/Arrow.jpg";
 }
 function changeout1(imgid,imgname,arrowname)
 {
 document.getElementById(imgid).src=imgname;
 
 //document.getElementById(arrowname).src="images/menu_images/Arrow_over.jpg";
 }
 
 function redirectpage1(ImgId,Id,pname,ancta)
 {
pagenameHotelId=document.getElementById("pageName").value;
pageNameID=new Array();
//pageNameID=pagenameHotelId.split('|');
//pageName=pageNameID[1];
if(querySt("hotelId")!=undefined)
HotelIDMenu=querySt("hotelId");
currentPage=pageNameID[2]
//motionUrl=HotelID+"_"+pname+ext; 
motionUrl="index.htm?hotelId="+HotelIDMenu+"&page="+pname;
currentPage=pname;
// document.getElementById(previd).src="images/menu_images/"+prev+".gif";
// document.getElementById(ImgId).src="images/menu_images/"+pname+"_over.gif";
 //previd=ImgId;
 //document.getElementById(ancta).removeAttribute("href")
 //document.getElementById(ancta).className="";
// document.getElementById(prevancid).setAttribute("href","#top");
 //document.getElementById(prevancid).className="linkclass";
 //prevancid=ancta;
 //prev=currentPage;
 if(document.getElementById('cmdCityhotel')!=null)
 document.getElementById('cmdCityhotel').options[document.getElementById('cmdCityhotel').selectedIndex].value="HL"+HotelIDMenu;
 //document.getElemenById(tedid).innerHTML="<img style='height:25px;' id='"+ImgId+'" border=0 src="images/menu_images/"+pname+"_over.gif" />"
 }
 /* if(document.getElementById(prevancid)!=null)
 {
 
 document.getElementById(prevancid).setAttribute("href","#top");
 }
 
*/
 function clickforlocation()
 {
 loc="Yes";
document.getElementById("0img").src="images/menu_images/locations_over.gif"
 document.getElementById("overviewtop").style.height=5+"px";
document.getElementById("overviewbottom").style.height=5+"px";
document.getElementById("subtab").style.display="none";
document.getElementById("0img").removeAttribute("href");
 }
 