// JScript File

   var catName="";
    var myOption;
    function fnCatRelation(catName)
    {      
       
       var catSelected  = document.getElementById(content+'_'+catName).options[document.getElementById(content+'_'+catName).selectedIndex].value;
       
       removeChildren(document.getElementById(content+'_'+catName+'_child'));
       
     if(document.getElementById(content+'_'+catName).selectedIndex == 0)
     {
       document.getElementById(content+'_'+catName+'_child').style.display = 'none';
     }
     else
     {
       //catArr
       for(var i = 0 ; i < catArr.length ; i++ )
       {
         if(catArr[i][0] == catSelected)
         {
            if(catArr[i].length > 1)
            {
                myOption = new Option('---Please Select---', '---Please Select---' , true, true);
                document.getElementById(content+'_'+catName+'_child').options[document.getElementById(content+'_'+catName+'_child').options.length] = myOption;
                for(var j = 1; j < catArr[i].length; j++)
                {
                    myOption = new Option(catArr[i][j], catArr[i][j] , true, true);
                    document.getElementById(content+'_'+catName+'_child').options[document.getElementById(content+'_'+catName+'_child').options.length] = myOption;
                }
                document.getElementById(content+'_'+catName+'_child').style.display = 'block';
                document.getElementById(content+'_'+catName+'_child').selectedIndex = 0;
            }
            else
            {
                document.getElementById(content+'_'+catName+'_child').style.display = 'none';
                fnNavigateURL(catSelected);
            }
         }
       }
     }
    }
    
    //function to navigate URL
    var postName="";
    function fnCatChildSelected(postName)
    {        
       fnNavigateURL(document.getElementById(postName).options[document.getElementById(postName).selectedIndex].value);
    }
    
    function fnNavigateURL(URL)
    {
        for(var i =0; i < catURLArr.length ; i++)
        {
             if(catURLArr[i] == URL)
             {
                location.href=catURLArr[i+1];
             }   
        }
    }
    
    function removeChildren(s)
    {
        while (s.hasChildNodes())
        s.removeChild(s.childNodes[0]);
    }

//JavaScript  added for Right Section - Vivekaanantha G - Start
          var MenuposX;
   var MenuposY;
   
   
  
  function Display()
  {		
  		getpositionGTBLinks();	
	   document.getElementById('SubMenu').style.display='Block';
  }
  function Hide()
  {
      document.getElementById('SubMenu').style.display='none';
  }
  

    
    function getpositionGTBLinks()
    {
   
   
    var obj =  document.getElementById("tblGTBLinks")
    var left =  obj.offsetLeft;
    var top = obj.offsetTop;
    while(obj=obj.offsetParent)
    {
        left += obj.offsetLeft;
        top  += obj.offsetTop;
    }
    
    
   
    MenuposX=left-137;
    MenuposY=top+2;
    
    document.getElementById('SubMenu').innerHTML=''+
    '<div id="revenueborder" style="position:absolute;left:'+MenuposX+'px ;top:'+MenuposY+'px;width:140px;height:25px;background-color:#d1d3d4;"></div>'+
    '<div id="revenueinner" style="position:absolute;left:'+(MenuposX+1)+'px;top:'+(MenuposY+1)+'px;width:138px;height:23px;background-color:black;"></div>'+
    '<div id="revenuecontent" style=";position:absolute;left:'+(MenuposX+2)+'px;top:'+(MenuposY+2)+'px;width:108px;height:21px;">  <a href="/sites/Etihad/_layouts/etihad/obe/Search.aspx" style="font-family:Arial;font-size:11px;padding-left:10px;">Revenue Booking</a></div>'+  
    '<div id="RewardsBorder" style="position:absolute;left:'+MenuposX+'px;top:'+(MenuposY+25)+'px;width:140px;height:25px;background-color:#d1d3d4;"></div>'+
    '<div id="RewardsInner" style="position:absolute;left:'+(MenuposX+1)+'px;top:'+(MenuposY+26)+'px;width:138px;height:23px;background-color:black;"></div>'+    
    '<div id="RewardsContent" style="position:absolute;;position:absolute;left:'+(MenuposX+2)+'px;top:'+(MenuposY+27)+'px;width:138px;height:21px;"><a href="http://www.etihadairways.com/etihadairways/obe/Search.aspx" style="font-family:Arial;font-size:11px;padding-left:10px;" >Rewards Booking </a></div>';
    }
    
  
    function NewModeGTB()
    {       
        
        document.getElementById('GTBLinks').style.display='block';              
    }
    
    function EditModeGTB()
    {       
        
        /*if(document.getElementById('GTBLinks').style.display='block')
        {
            document.getElementById('chkGTBLinks').checked = true;
            
        }
         else
        {  
            document.getElementById('chkGTBLinks').checked = false;              
        }*/
    }
    
	function DisplayModeGTB()
    {    	
	   var GTBLinks = document.getElementById('GTBCheck').firstChild.nodeValue;	  
	   var GTBLinks = GTBLinks.match("Yes");  	 	  
	   var SupportingInfo = document.getElementById('CheckSupportInfo').firstChild.nodeValue;	  
	   var SupportingInfo= SupportingInfo.match("Yes");
       var QL =  document.getElementById('CheckQuickLinks').firstChild.nodeValue;    
       var QL = QL .match("Yes"); 
	   //document.getElementById('GTBCheck').style.display='none';
	   	   
	   if(GTBLinks == "Yes")
		{			
			document.getElementById('GTBLinks').style.display='block';		
		}
		else
		{			
			document.getElementById('GTBLinks').style.display='none';
		}
        
         if(SupportingInfo=="Yes")
		{
			
			document.getElementById('SupportInfo').style.display='block';
		
		}
		else
		{
			
			document.getElementById('SupportInfo').style.display='none';
		}
		
		 if(QL=="Yes")
		{
			
			document.getElementById('QuickLinks').style.display='block';
		
		}
		else
		{
			
			document.getElementById('QuickLinks').style.display='none';
		}
     
       
		document.getElementById('GTBCheck').style.display='none';
		document.getElementById('CheckSupportInfo').style.display='none';
		document.getElementById('CheckQuickLinks').style.display='none';
		document.getElementById('LabelQuickLinks').style.display='none';
		document.getElementById('LabelSupportInfo').style.display='none';
		document.getElementById('LabelGTBCheck').style.display='none';

    }       
    function ShowGTB()    
    {
        
        document.getElementById('GTBLinks').style.display='block'    
    }       
//JavaScript  added for Right Section - Vivekaanantha G - End
