var itemId="";
var pathValue="";
var posMozilla="";
var version="";
var topPos="";
function changeTopStyle(arrownav,liItemId){
var obj=document.getElementById(liItemId);
topPos=findPosY(obj);
posMozilla=topPos+6;
posMozilla=posMozilla+"px";
if(document.all)
document.getElementById(arrownav).style.top=topPos+6;
else
document.getElementById("arrowNavMozilla").style.top=posMozilla;

}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop+4;
  }



function showSubNav(nav)
{
  version=navigator.appVersion;
  if(document.getElementById(nav))
  { 
  	if(document.getElementById(nav).style.display=='none')
    	{
    		document.getElementById(nav).style.display='block';
              
              if(!document.all)
          {
           if(document.getElementById('arrowNavMozilla'))
            {
              if(document.getElementById('arrowNavMozilla').style.display=='none')
              document.getElementById('arrowNavMozilla').style.display='block'; 
            }
        
           
         }
	
        else if(document.getElementById('arrownav'))
            {
			if(document.getElementById('arrownav').style.display=='none')
     				document.getElementById('arrownav').style.display='block';
        	}
    	}
        
/* I am commenting out this code due to change in code confirmed by email on 2/5         
        
      if (version.indexOf("MSIE 7.0") != -1) 
      {
       /*var pathLevels=new Array();
       if(pathValue.indexOf("about-jnj")!=-1)
       pathValue=pathValue.substring(pathValue.indexOf("about-jnj"));
       if(pathValue.substring(pathValue.length-1)!="/")
       pathValue=pathValue+"/";
       if(pathValue.indexOf("/")!=-1)
       pathLevels=pathValue.split("/");
       
       if(pathLevels==2)  
       document.getElementById(nav).style.marginLeft="33px";

       if(screen.width==800 && screen.height==600)
       document.getElementById(nav).style.marginLeft="211px";
       else if(screen.width==1024 && screen.height==768) 
       document.getElementById(nav).style.marginLeft="218px";
       else if(screen.width==1152 && screen.height==864) 
       document.getElementById(nav).style.marginLeft="282px";
       else if(screen.width==1280 && screen.height==720) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1280 && screen.height==768) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1280 && screen.height==1024) 
       document.getElementById(nav).style.marginLeft="346px";
       
*/       
 
 if (version.indexOf("MSIE 7.0") != -1) 
      {
       
       if(screen.width==800 && screen.height==600)
       document.getElementById(nav).style.marginLeft="211px";
       else if(screen.width==1024 && screen.height==768) 
       document.getElementById(nav).style.marginLeft="219px";
       else if(screen.width==1152 && screen.height==864) 
       document.getElementById(nav).style.marginLeft="282px";
       else if(screen.width==1280 && screen.height==720) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1280 && screen.height==768) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1280 && screen.height==1024) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1280 && screen.height==800) 
       document.getElementById(nav).style.marginLeft="346px";
       else if(screen.width==1360 && screen.height==768) 
       document.getElementById(nav).style.marginLeft="386px";
       else if(screen.width==1440 && screen.height==900) 
       document.getElementById(nav).style.marginLeft="426px";
       else if(screen.width==1680 && screen.height==1050) 
       document.getElementById(nav).style.marginLeft="546px";

 
 
       
      }

  }
  
  		 
}
function hideSubNav(nav)
{
  if(document.getElementById(nav))
  { 
    	if(document.getElementById(nav).style.display=='block')
    	{
     		document.getElementById(nav).style.display='none';
           if(!document.all)
          {
           if(document.getElementById('arrowNavMozilla'))
           {
                  if(document.getElementById('arrowNavMozilla').style.display=='block')
                  document.getElementById('arrowNavMozilla').style.display='none';
           } 
           
          }
 	   else if(document.getElementById('arrownav'))
            {
      		if(document.getElementById('arrownav').style.display=='block')
     				document.getElementById('arrownav').style.display='none';
 		}
    	}	 
  }       
}




function composeInnerHTML(nav,item)
{
 
 if(document.getElementById(nav))
 { 
  if(item=='company_information')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\"  onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\"><li><a href=\"http://www.investor.jnj.com/company-overview.cfm\" title=\"\" target=\"\">Company Overview</a></li><li><a href=\"http://www.investor.jnj.com/guidelines.cfm\" title=\"\" target=\"\">Reg F.D. Guidelines</a></li><li><a href=\"http://www.investor.jnj.com/strategic.cfm\" title=\"\" target=\"\">Strategic Planning</a></li></ul>";
   if(!document.all)
   document.getElementById(nav).style.height="200px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="200px";

 
  }
   
  else if(item=='financial_information')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\"  onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\"><li><a href=\"http://www.investor.jnj.com/sales-earnings.cfm\" title=\"\" target=\"\">Sales and Earnings</a></li><li><a href=\"http://www.investor.jnj.com/common/download/download.cfm?companyid=JNJ&fileid=201810&filekey=abca6e90-44a0-42af-bf4b-2210f3621857&filename=Historical Review 2007.pdf\" title=\"\" target=\"_blank\">5 Year Financial Review (PDF)</a></li><li><a href=\"http://www.investor.jnj.com/investor-facts.cfm\" title=\"\" target=\"\">Investor Facts</a></li></ul>";
   if(document.getElementById(itemId))
   {
     if(itemId=='loc-map')	
     document.getElementById(itemId).style.color="#12c2e9";	
			
   }	

   if(!document.all)
   document.getElementById(nav).style.height="220px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="220px";

  }  


/*<li><a href=\"http://apps2.shareholder.com/tearsheet/generate.aspx?id=209990&CompanyID=JNJ&s=546020901\" title=\"\" target=\"\">Snapshot</a></li>*/

  
  else if(item=='investor_tools')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\"  onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\"><li><a href=\"http://www.investor.jnj.com/e-delivery.cfm\" title=\"\" target=\"\">E-Delivery of Materials</a></li><li><a href=\"http://www.investor.jnj.com/briefcase.cfm\" title=\"\" target=\"\">Shareholder Briefcase</a></li><li><a href=\"http://www.investor.jnj.com/document-request.cfm\" title=\"\" target=\"\">Document Request</a></li><li><a href=\"http://www.investor.jnj.com/mobile/index.cfm\" title=\"\" target=\"\">Mobile Investor</a></li><li><a href=\"http://www.investor.jnj.com/email-report.cfm\" title=\"\" target=\"\">E-mail Alerts</a></li><li><a href=\"http://www.investor.jnj.com/download-library.cfm\" title=\"\" target=\"\">Investor Download Library</a></li><li><a href=\"http://www.investor.jnj.com/rss.cfm\" title=\"\" target=\"\">RSS feeds</a></li><li><a href=\"https://secure-www.jnj.com/wps/wcm/jsp/contactUs.jsp\" title=\"\" target=\"\">Contact us</a></li><li><a href=\"http://apps2.shareholder.com/tearsheet/generate.aspx?id=209990&CompanyID=JNJ&s=546020901\" title=\"\" target=\"_blank\">Snapshot</a></li></ul>";
   if(document.getElementById(itemId))
   {
     if(itemId=='loc-map')	
     document.getElementById(itemId).style.color="#12c2e9";	
			
   }	

   if(!document.all)
   document.getElementById(nav).style.height="380px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="330px";

  }
  else if(item=='stock_information')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\"  onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\"><li><a href=\"http://www.investor.jnj.com/stock-information.cfm\" title=\"\" target=\"\">Stock Quote & Chart</a></li><li><a href=\"http://www.investor.jnj.com/calculator.cfm\" title=\"\" target=\"\">Cost Calculator</a></li><li><a href=\"http://www.investor.jnj.com/divhistory.cfm\" title=\"\" target=\"\">Dividend History</a></li><li><a href=\"http://www.investor.jnj.com/lookup.cfm\" title=\"\" target=\"\">Historic Stock Lookup</a></li><li><a href=\"http://www.investor.jnj.com/stocksplit.cfm\" title=\"\" target=\"\">Stock Split Information</a></li><li><a href=\"http://www.investor.jnj.com/trading_stats.cfm\" title=\"\" target=\"\">Trading Statistics</a></li></ul>";
   if(!document.all)
   document.getElementById(nav).style.height="300px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="280px";


  }
  else if(item=='shareholder_services')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\"  onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\"><li><a href=\"http://www.investor.jnj.com/shareholder-services.cfm\" title=\"\" target=\"\">Shareholder Services</a></li><li><a href=\"http://www.investor.jnj.com/drip.cfm\" title=\"\" target=\"\">Dividend Reinvestment Program</a></li><li><a href=\"http://www.investor.jnj.com/electronic-reports.cfm\" title=\"\" target=\"\">Electronic Delivery of Reports & Proxy Statements</a></li></ul>";
   if(document.getElementById(itemId))
   {
	document.getElementById(itemId).style.color="#12c2e9";	
			
   }	
   if(!document.all)
   document.getElementById(nav).style.height="310px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="310px";


  }

   else if(item=='corporate_governance')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\" onmouseover=\"hideSelectMenus();\" onmouseout=\"showSelectMenus();\""
   +"><li><a id=\"annual-report\" onclick=\"exitMessage('annual-report');\" target='_self' style=\"\" href=\"http://www.investor.jnj.com/governance/board.cfm"+ "\">Board of Directors"+ "</a></li>"
   +"<li><a id=\"worldwide-contributions\" onclick=\"exitMessage('worldwide-contributions');\" target='_self' style=\"\"  href=\"http://www.investor.jnj.com/governance/materials.cfm"+ "\">Corporate Governance Materials"+ "</a></li>"
   +"<li><a id=\"sustainability-report\" onclick=\"exitMessage('sustainability-report');\" target='_self' style=\"\" href=\"http://www.investor.jnj.com/governance/faq.cfm"+ "\">Corporate Governance FAQs"+ "</a></li>"
   +"</ul>";

   if(document.getElementById(itemId))
   {
	document.getElementById(itemId).style.color="#12c2e9";	
			
   }	

   if(!document.all)
   document.getElementById(nav).style.height="220px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="220px";


  }


  else if(item=='our_history')
  {
   document.getElementById(nav).innerHTML="<ul class=\"submenu\""
   +"><li><a style=\"\" id=\"healthcare-innovations\" href=\"/wps/wcm/connect/jnj.com development/Development/about-jnj/"+ "company-history/healthcare-growth/\">Growth & Expansion"+ "</a></li>"
   +"<li><a style=\"\" id=\"founders\" href=\"/wps/wcm/connect/jnj.com development/Development/about-jnj/"+ "company-history/founders/\">People Who Made a Difference"+ "</a></li>"
   +"<li><a style=\"\" id=\"healthcare-growth\" href=\"/wps/wcm/connect/jnj.com development/Development/about-jnj/company-history/healthcare-innovations/\">Transformational Ideas"+ "</a></li><li><a href=''></a></li><li><a href=''></a></li><li><a href=''></a></li><li><a href=''></a></li><br/><br/>"
   +"</ul>";
   if(!document.all)
   document.getElementById(nav).style.height="245px";
   version=navigator.appVersion;
   if (version.indexOf("MSIE 7.0") != -1) 
   document.getElementById(nav).style.height="245px";


  }
   

 }


}
function applyColorOnClick(clickedItemId)
{
  if(document.getElementById(clickedItemId))
   {
	document.getElementById(clickedItemId).style.color="#12c2e9";	
			
   }	
}


function exitMessage(clickedItemId)
{
 
 itemId=clickedItemId;
 	
}

function changePrimaryItemColor(path)
{
  pathValue=path;
  if(path.indexOf("about-jnj")!=-1)
  {
    path=path.substring(path.indexOf("about-jnj"));
    applyPrimaryItemColor(path);
  }  
}
function applyPrimaryItemColor(path)
{
  var levels=new Array();
  
  if(path.indexOf("/")!=-1)
  {
    levels=path.split("/");
    if(document.getElementById(levels[1]))
    {
    	document.getElementById(levels[1]).style.color="#12c2e9";
      document.getElementById(levels[1]).style.cursor="none";
    }
    else if(document.getElementById(levels[0]))
    {
    	document.getElementById(levels[0]).style.color="#12c2e9";
      document.getElementById(levels[0]).style.cursor="none";
    }
	
    if(document.getElementById("company-nonflash"))
    {
    	document.getElementById("company-nonflash").style.color="#12c2e9";
      document.getElementById("company-nonflash").style.cursor="none";
    }

  }
  
}
function changeSubLevelItemsColor(path)
{
  if(path.indexOf("about-jnj")!=-1)
  {
    path=path.substring(path.indexOf("about-jnj"));
    applySubLevelItemsColor(path);
  }  
}
function applySubLevelItemsColor(path)
{
  var levels=new Array();
  
  if(path.indexOf("/")!=-1)
  {
    levels=path.split("/");
    for(count=2;count<levels.length-1;count++)
    {
     
     if(document.getElementById(levels[count]))
    	{
    	  document.getElementById(levels[count]).style.color="#12c2e9";
        document.getElementById(levels[count]).style.cursor="none";
      } 
    }
  }
   
}

function checkAndRestoreColor(liItemId,path)
{
  if(path.indexOf(liItemId)==-1)
   {
	if(document.getElementById(liItemId))
    	{
         document.getElementById(liItemId).style.color="#638e97";
         
      }
   }
}

function changeCurrentItemColor(currentItemId)
{
  if(document.getElementById(currentItemId))
	document.getElementById(currentItemId).style.color="#12c2e9";	
}

function fixBottomSpanPos(bottomSpan,bottomMenu)
{
  var obj=document.getElementById(bottomMenu);
  var topPos=findPosY(obj);
  var leftPos=findPosX(obj);
  topPosMozilla=topPos+27;
  topPosMozilla=topPosMozilla+"px";
  leftPosMozilla=leftPos-70;
  leftPosMozilla=leftPosMozilla+"px";
  if(document.all)
  {
   document.getElementById(bottomSpan).style.top=topPos+27;
   document.getElementById(bottomSpan).style.marginLeft=leftPos-70;
  }
  else
  {
    document.getElementById(bottomSpan).style.top=topPosMozilla;
    document.getElementById(bottomSpan).style.marginLeft=leftPosMozilla;
  }


}
function fixTopSpanPos(topSpan,topMenu)
{
  var obj=document.getElementById(topMenu);
  var topPos=findPosY(obj);
  var leftPos=findPosX(obj);
  topPosMozilla=topPos-6;
  topPosMozilla=topPosMozilla+"px";
  leftPosMozilla=leftPos-70;
  leftPosMozilla=leftPosMozilla+"px";
  if(document.all)
  {
   document.getElementById(topSpan).style.top=topPos-6;
   document.getElementById(topSpan).style.marginleft=leftPos-70;
  }
  else
  {
    document.getElementById(topSpan).style.top=topPosMozilla;
    document.getElementById(topSpan).style.marginleft=leftPosMozilla;
  }


}



