﻿//*** this file for common methods 
 var browser=navigator.appName;
     
     function AlHasaFn()
     {     
         document.getElementById('AlhasaID').className = 'ActiveMap';
         document.getElementById('RiyadhID').className = 'InactiveMap';
         document.getElementById('JeddahID').className = 'InactiveMap';
       
        if (browser=="Microsoft Internet Explorer")
       document.getElementById("lblCityName").innerText = document.getElementById('AlhasaID').innerText;
        else if(browser=="Netscape")
            document.getElementById("lblCityName").textContent = document.getElementById('AlhasaID').textContent;
           
     }
     
     function AlRiyadhFn()
     {
         document.getElementById('AlhasaID').className = 'InactiveMap';
         document.getElementById('RiyadhID').className = 'ActiveMap';
         document.getElementById('JeddahID').className = 'InactiveMap';
         if (browser=="Microsoft Internet Explorer")
         document.getElementById("lblCityName").innerText = document.getElementById('RiyadhID').innerText;
        else if(browser=="Netscape")
            document.getElementById("lblCityName").textContent = document.getElementById('RiyadhID').textContent;
     }
   
     function AlJeddahFn()
     {
         document.getElementById('AlhasaID').className = 'InactiveMap';
         document.getElementById('RiyadhID').className = 'InactiveMap';
         document.getElementById('JeddahID').className = 'ActiveMap';
        if (browser=="Microsoft Internet Explorer")
         document.getElementById("lblCityName").innerText = document.getElementById('JeddahID').innerText;
        else if(browser=="Netscape")
            document.getElementById("lblCityName").textContent = document.getElementById('JeddahID').textContent;
     }
    
     function ActivateDrpDwnCitiesDiv()
     {
        document.getElementById('DropDownCities').style.display = 'block';
     }
     
     function DeActivateDrpDwnCitiesDiv()
     {
        document.getElementById('DropDownCities').style.display = 'none';
     }
     
    function showbodyGateway()
	{
		document.getElementById('Gateway').style.display = 'block';
		//alert(document.getElementById('Gateway').offsetWidth);
		//document.getElementById('GatewayMenu').offsetWidth - '100';
		
	}
    function hideQuickLinks()
    {
        document.getElementById('LinksDiv').style.display = 'none';
    }
    function hidebodyGateway()
	{
		document.getElementById('Gateway').style.display = 'none';
	}

    function FadePage()
    {
            //debugger;
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
            myHeight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
          }
        var blockDiv=document.getElementById('blockUI');
        var fixedDiv=document.getElementById('WelcomeDiv');
        blockDiv.style.display='block';
        blockDiv.style.height=myHeight;
        blockDiv.style.width=myWidth;
        divfixed.style.width=myWidth;
        document.body.style.overflow='hidden';
    }//*** this file for common methods 
function showbodyGateway()
{
	document.getElementById('Gateway').style.display = 'block';
    document.getElementById('bodytextcom').style.display = 'none';
}

function hidebodyGateway()
{
    document.getElementById('Gateway').style.display = 'none';
}

function showbodycom()
{
	document.getElementById('bodytextcom').style.display = 'block';
document.getElementById('Gateway').style.display = 'none';
}

function hidebodycom()
{
	document.getElementById('bodytextcom').style.display = 'none';
}

function checkbrowser()
{
    if(navigator.appName == "Microsoft Internet Explorer")
    {
        document.getElementById('bodytextcom').style.left='-200px';
	    document.getElementById('bodytextcom').style.top='30px';
    }
}

function checkbrowserArabic()
{	
    if(navigator.appName == "Microsoft Internet Explorer")
    {
        document.getElementById('bodytextcom').style.right='-80px';
	    document.getElementById('bodytextcom').style.top='30px';
    }
     else
    {
        document.getElementById('bodytextcom').style.right='140px';
	    document.getElementById('bodytextcom').style.top='5px';
		

	}

	
}
function DetectVersions()
{
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
 var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ffversion>=3)
  {document.getElementById('Gateway').style.right='160px';}
 
}

}
 function checkcomp()
 {
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
 var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ffversion<=2)

  {
  document.write('<style type="text/css">.ms-topNavHoverCont{margin-left:5px !important}</style>');
 }
}

}
// removes the target values for the bread crumb links
 function RemoveBreadCrumbLinks(crumnContainerID) 
 {
     var crumbContainer = document.getElementById(crumnContainerID);

     // if bread crumb control exists on the current page
     if (crumbContainer != null) {
         // get all the bread crumb links
        var links = crumbContainer.getElementsByTagName('a')

         if (links != null) {

             // reset the target for each link
             for (var i = 0; i < links.length; i++) {
                 links[i].href = "javascript:void(0);";
                 links[i].style.textDecoration = "none";
                 links[i].style.cursor = 'text';

             }
         }
     }
 } 
//**** This function is used to Adjust Site Menu
function AdjustSiteMenu()
{   
    var obj1 = document.body;    
       
    //**** 1. Get All Tables & check of that include Navigations
    if(document.getElementsByTagName('table')!=null)
    {        
        var length=document.getElementsByTagName('table').length; 
        
        //*** Loop on Tables        
        for(index=0;index<length;index++)
        {            
            obj=document.getElementsByTagName('table')[index];                
            
            //**** 2. Get navigation Tds and check that it have subitems                
            var trsLength=obj.getElementsByTagName('td').length;          
               
            for(loop=0;loop<trsLength;loop++)
            {               
                           
                //**** Check If Tr has Divs with same name + 'Items' 
                if(document.getElementById(obj.getElementsByTagName('td')[loop].id+'Items')!=null)
                {  
                    //**** Get All its Child objects and disable them
                    ALength = obj.getElementsByTagName('td')[loop].getElementsByTagName('A').length;                     
                   
                    for(j=0;j<ALength;j++)
                    {   
                        if(obj.getElementsByTagName('td')[loop].getElementsByTagName('A')[j]!=null)
                        {   
                            //**** Top Nav Item        
                            if(obj.getElementsByTagName('td')[loop].getElementsByTagName('A')[j].className.indexOf('topnav')!=-1)
                            {   
                              obj.getElementsByTagName('td')[loop].getElementsByTagName('A')[j].href='javascript:void(0)';                                                         
                            }
                        }
                    }
                }
            }        
        }
    }
}

   function addclass()
   {
   document.getElementById('Holder').className='BodyCss';
 
   var TagItem=document.getElementById('BODYStyle');
   TagItem.className="BodyAlt";
   }

//function Menu_HoverStatic()
//{

//var i=0;


//for(i=0;i>=1;i++)
//{
//var Idtxt="zz1_AspMenu1n" + i +"Items";

//var divheight = document.getElementById("<%= "+ Idtxt+" %>");
//var currentheight=divheight.style.height;
//divheight.style.height=currentheight - 10 + "px";
//}
//}
