var homePage = 'no';
// PLATFORM/BROWSER SNIFFER FOR STYLESHEET INCLUDE
var browser = navigator.appName;
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
var os = navigator.platform;
var mac = 'MacPPC';
var pccsspath = "/t2h/asp/dupont/en/corp/includes/dupont.css";
var maccsspath = "/t2h/asp/dupont/en/corp/includes/dupontmac.css";

if (browser == netscape && os != mac) {
    document.write('<link rel="stylesheet" type="text/css" title="css" href='+ pccsspath +'>');
    }
else if (browser == ie && os != mac) {
    document.write('<link rel="stylesheet" type="text/css" title="css" href='+ pccsspath +'>');
    }
else if (browser == netscape && os == mac) {
    document.write('<link rel="stylesheet" type="text/css" title="css" href='+ maccsspath +'>');
    }
else if (browser == ie && os == mac) {
    document.write('<link rel="stylesheet" type="text/css" title="css" href='+ maccsspath +'>');
    }

if ( document.layers == null )
	document.writeln( '<style type="text/css"><!-- .tabbedbackground{ background-image: url("/t2h/asp/dupont/en/corp/images/tabs_bgnd.gif") } --></style>' );
else
	document.writeln( '<style type="text/css"><!-- .tabbedbackground{ background-color: #ffffff } --></style>' );

if ( document.layers == null )
	document.writeln( '<style type="text/css"><!-- .tabbedbackground{ background-image: url("/t2h/global/en/images/tabs_bgnd.gif") } .lefttabbedbackground{ background-image: url("/t2h/global/en/images/tabs_bgnd_lt.gif") } .middletabbedbackground{ background-image: url("/t2h/global/en/images/tabs_bgnd_mid.gif") } .righttabbedbackground{ background-image: url("/t2h/global/en/images/tabs_bgnd_rt.gif") } --></style>' );
else
	document.writeln( '<style type="text/css"><!-- .tabbedbackground{ background-color: #ffffff } .lefttabbedbackground{ background-color: #ffffff } .middletabbedbackground{ background-color: #ffffff } .righttabbedbackground{ background-color: #ffffff } --></style>' );

// Dropdown Menu With Go Button navigating to page within site
function navigate() {
  var menuIndex = document.formExplore.selectMenu.selectedIndex; 
  document.location = document.formExplore.selectMenu.options[menuIndex].value;
}

// Global Vars
var timerID;
var imgObj;
var mc;

// Simple Browser Check
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
var mac = "MacPPC"
var browser = navigator.appName;
var os = navigator.platform;

// Custom Style Line for Netscape Font Rendering Inconsistency

// Browser-Specific Constants
if (navigator.appName == "Netscape") {
	var layerRef="document.layers.";
	var styleSwitch="";
} else {
	var layerRef="document.all.";
	var styleSwitch=".style";
}


//Global Variables
var exp;
//assign the current url to a variable
var currPath = location.href;

function mnuPtr(NavNum, ItemNum, ImageNum) {
	if (ItemNum != 0){
	if (navigator.appName == "Netscape")
		imgObj = eval(document.layers['nav'+NavNum].document.images['PTR'+NavNum+'_'+ItemNum]);
	else
		imgObj = eval(document.images['PTR'+NavNum+'_'+ItemNum]);
		
		if (NavNum == 7){
		imgObj.src = (ImageNum == 1) ? "/t2h/asp/dupont/en/corp/images/header/ptrgrey.gif" : "/t2h/asp/dupont/en/corp/images/spacer.gif" ;
		}else{
		imgObj.src = document.WM.loadedImages[ImageNum].src;
		}
	}
	if(ImageNum == 1) {
		clearTimeout(timerID);
		showNavLayer(NavNum);
	} else {
		timerID = (location.href.indexOf('index2.html') != -1) ? setTimeout("hideNavLayers();showLayer('flash')", 500) : timerID = setTimeout("hideNavLayers()", 750);
	}
}



function WM_preloadImages() {
  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined')
      document.WM = new Object();
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

// Preload Images
WM_preloadImages('/t2h/asp/dupont/en/corp/images/spacer.gif','/t2h/asp/dupont/en/corp/images/header/ptr.gif', '/t2h/asp/dupont/en/corp/images/header/ptrgrey.gif');

// Enter global navigation menu items here:

// list of href links for menu popup 1
var menu0 = new Array();
menu0[0] = '<a href="http://www2.dupont.com/Science/en_US" class="navdown" onMouseOver="mnuPtr(1,0,1)" onMouseOut="mnuPtr(1,0,0)"><img src="/t2h/asp/dupont/en/corp/images/header/nav_science_r.gif" width="123" height="17" border="0" alt="Science"></a>';

// list of href links for menu popup 2
var menu1 = new Array();
menu1[0] = '<a href="/t2h/page/homepage" onMouseOver="mnuPtr(2,0,1)" onMouseOut="mnuPtr(2,0,0)" class="navdown"><img src="/t2h/asp/dupont/en/corp/images/header/nav_iab_home_r.gif" width="123" height="17" border="0" alt="DuPont Technology Bank Home"></a>';

// list of href links for menu popup 3
var menu2 = new Array();
menu2[0] = '<a href="/t2h/page/what" onMouseOver="mnuPtr(3,0,1)" onMouseOut="mnuPtr(3,0,0)" class="navdown"><img src="/t2h/asp/dupont/en/corp/images/header/nav_what_we_license_r.gif" width="123" height="17" border="0" alt="What We License"></a>';

// list of href links for menu popup 4
var menu3 = new Array();
menu3[0] = '<a href="/t2h/page/searchhome" onMouseOver="mnuPtr(4,0,1)" onMouseOut="mnuPtr(4,0,0)" class="navdown"><img src="/t2h/asp/dupont/en/corp/images/header/nav_search_r.gif" width="123" height="17" border="0" alt="Search Technologies"></a>';

// list of href links for menu popup 5
var menu4 = new Array();
menu4[0] = '<a href="/t2h/page/featured" onMouseOver="mnuPtr(5,0,1)" onMouseOut="mnuPtr(5,0,0)" class="navdown"><img src="/t2h/asp/dupont/en/corp/images/header/nav_featured_r.gif" width="123" height="17" border="0" alt="Featured Technologies"></a>';

// list of href links for menu popup 6
var menu5 = new Array();
menu5[0] = '<a href="/t2h/page/techofweeklist" onMouseOver="mnuPtr(6,0,1)" onMouseOut="mnuPtr(6,0,0)"><img src="/t2h/asp/dupont/en/corp/images/header/nav_techofweek_r.gif" width="123" height="17" border="0"></a>';


//determine the correct offsetParent for IE to find the x and y values of the images used in the nav
function getRealLeft() {
    xPos = this.offsetLeft;
    tempEl = this.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}
function getRealTop() {
    yPos = this.offsetTop;
    tempEl = this.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

//determine the x and y values of the images used in the nav to be used in the dropdown layers at mouseover using the getReal..functions
function setVals(NavNum){
	var linkName = 'dropdown'+ NavNum;
	if (navigator.appName != "Netscape"){
		document.images[linkName].getRealTop = getRealTop;
		document.images[linkName].getRealLeft = getRealLeft;
		xValue = document.images[linkName].getRealLeft() +1;
		yValue = document.images[linkName].getRealTop() +1;
	}else{
		xValue = document.images[linkName].x +1;
		yValue = document.images[linkName].y +1;
	}
	eval(layerRef + 'nav'+ NavNum + styleSwitch +'.left = "'+ xValue +'"');
	eval(layerRef + 'nav'+ NavNum + styleSwitch +'.top = "'+ yValue +'"');
}

function showNavLayer(NavNum){
	if (navigator.appName == "Netscape") { return null; }
	setVals(NavNum);
	eval(layerRef + 'nav'+ NavNum + styleSwitch +'.visibility = "visible"');
}

function hideNavLayer(NavNum){
	if (navigator.appName == "Netscape") { return null; }
	eval(layerRef + 'nav' + NavNum + styleSwitch + '.visibility = "hidden"');
}

// hide a specific layer (e.g., menu popup)
function hideLayer(layerName){
	if (navigator.appName == "Netscape") { return null; }
	eval(layerRef + layerName + styleSwitch + '.visibility = "hidden"');
	if (navigator.appName != "Netscape"){ 
    		var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
			mc = InternetExplorer ? window.mapcontrols : window.document.mapcontrols;
			mc.GotoFrame(5);
	}
}

// show a specific layer
function showLayer(layerName,num){
	eval(layerRef + layerName + styleSwitch + '.visibility = "visible"');
	
	if (navigator.appName != "Netscape"){ 
	 var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	 mc = InternetExplorer ? window.mapcontrols : window.document.mapcontrols;
	 mc.GotoFrame(4);
	}
}

// hide all layers; called immediately prior to displaying any layer (e.g., menu popup)
function hideNavLayers(){
	for (i=1; i < 7; i++)
		hideNavLayer(i);
}

//Start generating nav layers and their corresponding stylesheets
for (m=0; m<6; m++){
	var q = m + 1;
	document.write('<STYLE>.DropDownLayer'+q+' {position:absolute; left:0; top:0; z-index:10; visibility:hidden }</STYLE>');
//Generates the actual <div>s based on the value of m.
var menuVal = eval('menu' + m);
var cellbgColor = (q == 7) ? "#999999" : "#FFcc66";
var linebgColor = (q == 7) ? "#fffffff" : "#ff9933";
document.write('<div id="nav'+q+'" class="DropDownLayer'+q+'"><table border="0" cellpadding="0" cellspacing="0" bgcolor="'+ cellbgColor +'"><tr><td colspan="2" align="left">'+ menuVal[0] +'</td></tr>');
	for (i = 1; i < menuVal.length; i++){
		document.write('<tr><td class="menuimg"><img name="PTR'+ q +'_'+ i +'" src="/t2h/asp/dupont/en/corp/images/spacer.gif" width="10" height="17" alt="" align="left"></td><td>'+ menuVal[i] + '</td></tr><tr><td colspan="2" bgcolor="'+ linebgColor +'"><img src="/t2h/asp/dupont/en/corp/images/spacer.gif" height="1" width="124"></td></tr>');
	}
document.write('</table></div>');
}
