﻿// JScript File
var ext=".htm";
var MenuXml;
var pagenameHotelId=document.getElementById("pageName").value;
var pageNameID=new Array();
pageNameID=pagenameHotelId.split('|');

var pageName=pageNameID[1];
var HotelID=pageNameID[0];
var currentPage=pageNameID[2]



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;'>&nbsp;</td></tr>";
Design+="<tr><td><table 'style=width:100%' border='0' cellspacing='0' cellpadding='0'>";
 
//debugger;
var xmlObj=MenuXml.documentElement;
var strMainMenu=MenuXml.getElementsByTagName(pageName);

strSubMenu=strMainMenu[0].getElementsByTagName("SubMenu");

 Design+="<tr><td></td><td height='5' bgcolor='#FFFFFF' style='width:185px;'></td></tr>";
 for(i=0;i<strSubMenu.length;i++)
 {
    var strChildMenu=strSubMenu[i].getElementsByTagName("ChildMenu");
  //  if(i==0)
   // {
               //Design+="<tr><td style='padding-right:5px;'><img style='width:6px;height:9px;' id='"+i+"arrow' src='images/menu_images/Arrow_over.jpg' /></td><td  style='height:28px;' class='left-menu' id='"+i+"td'><img border='0' id='"+i+"img' src="+strMainMenu[0].getElementsByTagName("SubMenu")[i].getAttribute("focusimg")+" /></td></tr>";     
           //    Design+="<tr><td colspan='2'  style='height:28px;' id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"'><img 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'); /></a></td></tr>";     
   // }
    //else
    //{
       if(i==1)
         Design+="<tr><td style='width:10px;'></td><td height='5' bgcolor='#FFFFFF' style='width:185px;'></td></tr>";
         if(strSubMenu.length-1==i) 
        { 
         Design+="<tr><td colspan='2' id='"+i+"td'><a target='_blank' href='"+strSubMenu[i].getAttribute("link")+"'><img 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><td colspan='2' id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"'><img 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>";     
        }
     
   // }
    
     
    //Design+="<tr><td style='padding:right:5px;'><img style='width:6px;height:9px;' id='"+i+"arrow' src='images/menu_images/Arrow_over.jpg' /></td><td  style='height:28px;width:185px;' class='left-menu' id='"+i+"td'><a href='"+strSubMenu[i].getAttribute("link")+"' class='left-menu'><img 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'); /></a></td></tr>";
    if(i!=0)
     Design+="<tr><td style='width:10px;'></td><td height='1' bgcolor='#FFFFFF' style='width:185px;'></td></tr>";
   
   if(strChildMenu!=null)
    {
        var j=0;
       
        for(j=0;j<strChildMenu.length;j++)
            {
                   
                if(j==0)
                {
                Design+="<tr><td></td><td height='14' style='width: 185px;'>";
                Design+="<table width='165px' border='0' align='right' cellpadding='0' cellspacing='0'>";
                }
     
              if(strChildMenu[j].getAttribute("hide")!="no")
              {
                 if(CheckHotelId(strChildMenu[j].getAttribute("hid")))
                 {
                  if(strChildMenu[j].getAttribute("name")==currentPage)
                     Design+="<tr><td colspan='2' id='"+j+"tdo'><img id='"+j+"imgo' border='0' src="+strChildMenu[j].getAttribute("focusimg")+" /></td></tr>";
                     else
                    Design+="<tr><td  colspan='2' id='"+j+"tdo'><a href=javascript:redirectpage('"+HotelID+"','"+strChildMenu[j].getAttribute("link")+"');><img 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 style='width:10px;'></td><td height='1' bgcolor='#FFFFFF' style='width:180px;'></td></tr>";
                 } 
              }    
                 else
                  {
                 
                
                  if(strChildMenu[j].getAttribute("name")==currentPage ||strChildMenu[j].getAttribute("name")=="LocalInfo")
                     Design+="<tr><td colspan='2' id='"+j+"tdo'><img id='"+j+"imgo' border='0' src="+strChildMenu[j].getAttribute("focusimg")+" /></td></tr>";
                   else
                   {
                     if(strChildMenu[j].getAttribute("name")=="Gallery")
                     {
                     var gal_url=HotelID+"_Gallery.htm";
                     Design+="<tr><td  colspan='2' id='"+j+"tdo'><a href='"+gal_url+"'><img 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
                     Design+="<tr><td  colspan='2' id='"+j+"tdo'><a href=javascript:redirectpage('"+HotelID+"','"+strChildMenu[j].getAttribute("link")+"');><img 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>";
                   }
                // alert(strChildMenu[j].getAttribute("name"));
                   //Design+=generate(strChildMenu,j);
                   
                   if(strChildMenu.length-1!=j)
                   {
                   if(strChildMenu[j].getAttribute("name")!="LocalInfo")
                   {
                   Design+="<tr><td height='1' bgcolor='#FFFFFF' style='width:165px;'></td></tr>";
                   }
                   }
                   //if(strChildMenu[j].getAttribute("name")!="LocalInfo")
                    //Design+="<tr><td height='1' colspan='2' bgcolor='#FFFFFF'></td></tr>";
                  // if(strChildMenu[j].getAttribute("name")!="LocalInfo")
                   //Design+="<tr><td height='1' colspan='2' bgcolor='#FFFFFF'></td></tr>";
                   //Design+="<tr><td height='5' bgcolor='#FFFFFF'></td></tr>";
                   }
                 var strChildSubMenu=strChildMenu[j].getElementsByTagName("ChildSubMenu");
                
                 if(strChildSubMenu!=null)
                {
              
                   for(k=0;k<strChildSubMenu.length;k++)
                      { 
                        if(k==0)
                         {
                            Design+="<tr><td style='text-align:right;' colspan='2'>";
                            Design+="<table width='126px' border='0' align='right' cellpadding='0' cellspacing='0'>";
                         }
                     if(strChildSubMenu[k].getAttribute("hide")!="no")
              {
                 if(CheckHotelId(strChildSubMenu[k].getAttribute("hid")))
                 {
                  if(strChildSubMenu[k].getAttribute("name")==currentPage)
                        Design+="<tr><td colspan='2' id='"+k+"tdol'><img id='"+k+"imgl' border='0' src="+strChildSubMenu[k].getAttribute("focusimg")+" /></td></tr>";
                     else
                       Design+="<tr><td colspan='2' id='"+k+"tdol'><a href=javascript:redirectpages('"+HotelID+"','"+strChildSubMenu[k].getAttribute("link")+"'); ><img border='0' id='"+k+"imgl' src="+strChildSubMenu[k].getAttribute("img")+" onmouseover=changeover('"+k+"imgl','"+strChildSubMenu[k].getAttribute("focusimg")+"','"+k+"arrowl'); onmouseout=changeout('"+k+"imgl','"+strChildSubMenu[k].getAttribute("img")+"','"+k+"arrowl'); /></a></td></tr>";
                     if(k==strChildSubMenu.length-1)
                         Design+="</table>";
                      if(strChildSubMenu.length-1==k)
                        {
                            Design+="<tr><td height='1' bgcolor='#FFFFFF' style='width:180px;'></td></tr>";
                        }    
                 
                 }
                 else
                 {
                  if(k==strChildSubMenu.length-1)
                         Design+="</table>";
                     if(strChildSubMenu.length-1==k)
                        {
                            Design+="<tr><td height='1' bgcolor='#FFFFFF' style='width:180px;'></td></tr>";
                        } 
                 }    
                
              }  
               else
                 {
                   if(strChildSubMenu[k].getAttribute("name")==currentPage)
                        Design+="<tr><td colspan='2' id='"+k+"tdol'><img id='"+k+"imgl' border='0' src="+strChildSubMenu[k].getAttribute("focusimg")+" /></td></tr>";
                     else
                       Design+="<tr><td colspan='2' id='"+k+"tdol'><a href=javascript:redirectpages('"+HotelID+"','"+strChildSubMenu[k].getAttribute("link")+"'); ><img border='0' id='"+k+"imgl' src="+strChildSubMenu[k].getAttribute("img")+" onmouseover=changeover('"+k+"imgl','"+strChildSubMenu[k].getAttribute("focusimg")+"','"+k+"arrowl'); onmouseout=changeout('"+k+"imgl','"+strChildSubMenu[k].getAttribute("img")+"','"+k+"arrowl'); /></a></td></tr>";
                     if(k==strChildSubMenu.length-1)
                         Design+="</table>";
                      if(strChildSubMenu.length-1==k)
                        {
                            Design+="<tr><td height='1' bgcolor='#FFFFFF' style='width:180px;'></td></tr>";
                        }   
                 }     
                    
                    
                      }
                    
                }
  
             if(j==strChildMenu.length-1)
            Design+="</table>";
            }
            
          
     }
     
    // if(flg==1)
    // Design+="<tr><td></td><td height='5' bgcolor='#FFFFFF'></td></tr>";
     Design+="</td></tr>";
   }
  Design+="</table></td></tr></table><br><br>";  


document.write(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 ArrHotelId=new Array();
 ArrHotelId=Ids.toString().split('|');
 for(g=0;g<ArrHotelId.length;g++)
  {
    if(ArrHotelId[g]==HotelID)
     {
     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 style='width:10px;'></td><td  bgcolor='#FFFFFF' style='width:10px;height:2px'></td></tr>";
            else
            des+="<tr><td style='width:10px;'></td><td  bgcolor='#FFFFFF' style='width:10px;height:1px'></td></tr>";
          
      }
 else
      {
             des+="<tr><td style='width:10px;'></td><td height='1' bgcolor='#FFFFFF' style='width:180px;'></td></tr>";
      }  
 
 }
 des=des.substring(1,des.length);
 return des;
 
 
 }
 
 
function redirectpage(Id,pname)
{
  if(pname=="Gallery")
  document.location.href=Id+"_"+pname+".htm"; 
  else  
  document.location.href="index.htm?hotelId="+Id+"&page="+pname; 
}
function redirectpages(Id,pname)
{
  document.location.href=Id+"_"+pname+".htm";  

}


 function changeover(imgid,imgname,arrowname)
 {
 document.getElementById(imgid).src=imgname;
// document.getElementById(arrowname).src="images/menu_images/Arrow.jpg";
 }
 function changeout(imgid,imgname,arrowname)
 {
 document.getElementById(imgid).src=imgname;
 //document.getElementById(arrowname).src="images/menu_images/Arrow_over.jpg";
 }

