﻿var pagehref = window.location;
var pageurl = pagehref.toString();
var url = pageurl.toLowerCase();



//Function to set the current link in Left nav active
function setLeftNavActiv(){
	
//Set the active link in main nav
var objNav = document.getElementById("left_nav");
var navAnchor = objNav.getElementsByTagName("a");

for(i=0; i<navAnchor.length; i++)
        {
         var link = navAnchor[i].getAttribute("href").toString();
         var llink = link.toLowerCase()
         if (url.indexOf(llink) != -1){
			 var ulClass = navAnchor[i].parentNode.parentNode.className;
			  switch(ulClass){
				 case "level1":
					navAnchor[i].parentNode.className += " active_parent";
					if(navigator.appName == "Microsoft Internet Explorer")
					{
					    navAnchor[i].parentNode.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
					}
					else
					{
					   navAnchor[i].parentNode.previousSibling.previousSibling.style.border = "none";
					   navAnchor[i].removeAttribute('href');
					}
				 break;
				 
				 case "level2":
				 if(navigator.appName == "Microsoft Internet Explorer")
				    {
				        navAnchor[i].parentNode.parentNode.parentNode.className += " active";
				        navAnchor[i].parentNode.parentNode.parentNode.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
				    }
				 else
				    {
				 	    navAnchor[i].parentNode.parentNode.parentNode.className += " active";
				 	    navAnchor[i].parentNode.parentNode.parentNode.previousSibling.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
				 	}
					navAnchor[i].parentNode.className += " active2";
				 break;
				 
				 case "first":
				 	navAnchor[i].parentNode.parentNode.className += " active_home";
					navAnchor[i].removeAttribute('href');
				 break;
				 
				 case "level1_last":
					if(navigator.appName == "Microsoft Internet Explorer")
					{
					    navAnchor[i].parentNode.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
					}
					else
					{
					   navAnchor[i].parentNode.previousSibling.previousSibling.style.border = "none";
					   navAnchor[i].removeAttribute('href');
					}				 	
				 break;
				 
				 case "level3":
				 if(navigator.appName == "Microsoft Internet Explorer")
				    {
				        navAnchor[i].parentNode.parentNode.parentNode.parentNode.parentNode.className += " active";
				        navAnchor[i].parentNode.parentNode.parentNode.parentNode.parentNode.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
				    }
				 else
				    {
				 	    navAnchor[i].parentNode.parentNode.parentNode.parentNode.parentNode.className += " active";
				 	    navAnchor[i].parentNode.parentNode.parentNode.parentNode.parentNode.previousSibling.previousSibling.style.border = "none";
						navAnchor[i].removeAttribute('href');
				 	}
					navAnchor[i].parentNode.parentNode.parentNode.className += " active2";
					navAnchor[i].parentNode.parentNode.parentNode.childNodes[0].style.backgroundImage = "none";
					navAnchor[i].parentNode.className += " active3";
				break;
			  }
            }
        }
    }
      
  function leave_site(url)
	{
		window.open(gPath + "js/outsidelink.aspx?url=" + url,"", "toolbar=0,width=500, height=225, top=50,left=50,scrollbars=1"); 
	}
	function leave_site1(url)
	{
		window.open(gPath + "js/outsidelink.aspx?url=" + url,"", "toolbar=0,width=500, height=225, top=50,left=50,scrollbars=1"); 
	}
	function  openwin(id)
   {
   
       window.open(gPath + 'hcp/ref.aspx#' + id,"References","top=30, left=50, width=618, height=500, scrollbars=1")
   }
	   function  opengloss(id)
   {
   
       window.open('<%=gPath%>common/glosspopup.aspx#'+id,"","top=30 left=50 width=618, height=500 scrollbars=yes")
   }
   
    function hcppop(gPath)
    {
        
        window.open(gPath + 'header/hcppop.aspx','hcp','height=200, width=320', '');
    }
   
 //Dropdown list
 function lists(){
    var dlCountry = document.getElementById('ddlist_country');
 
    dlCountry.onclick = function(){
       if(this.style.overflow!="visible")
       {
            this.style.overflow = "visible";
       }
       else
       {
            this.style.overflow = "hidden";
       }
    }
 
 }
 
function preloader() 
{
     var i = 0;
     imageObj = new Image();

     images = new Array();
     images[0] = gPath + "Images/Images/bg_header_home_hcp.png";
	 images[1] = gPath + "Images/bg_header_home_patient_lrg.png";
	 images[2] = gPath + "Images/Images/bg_header_home_patient.jpg";
	 images[3] = gPath + "Images/bg_header_home_hcp.jpg";

     for(i=0; i<=3; i++) 
     {
          imageObj.src=images[i];
     }
} 