  //The following is javascript that gets executed on every page.
//It "turns on" the proper subnavigation image based on the filename.
//If there are any third level pages, an underscore ("_") separates
//  the section name from the page name.
//  Ex: womenscancersprog_connection.asp
//Do NOT place an underscore in main level pages, or secondary pages.

bVer = parseFloat(navigator.appVersion);

if (bVer >= 4){
    urlString = document.location.href;

    if(urlString.lastIndexOf("_") != -1){
	pos = urlString.lastIndexOf("_");
	pos2 = urlString.lastIndexOf("/");
	section = urlString.substring(pos2+1,pos);
	url = urlString.substring(pos2+1,urlString.length);
    }

    else{
	pos = urlString.lastIndexOf("/");
	url = urlString.substring(pos+1,urlString.length);
	pos = url.indexOf(".");
	if (pos != -1){
	    section = url.substring(0,pos);
	}
	else {
	    section = "null";
	}
    }

    if (url.lastIndexOf("#") >= 0){
	pos = url.lastIndexOf("#");
	url = url.substring(0,pos);
    }
}

//Ignores the query portion of the URL.  This is for pages that use the query string
function ignoreQuery(){
    if (document.images){
	if (url.lastIndexOf("?") >= 0){
	    pos = url.lastIndexOf("?");
	    url = url.substring(0,pos);
	}
    }
}

// Selects the proper sub-navigation image
function imageSelect(){
    if (document.images){
	for (i=0;i<document.images.length;i++){
	    if (section == document.images[i].name && section != "null"){
		document.images[section].src = "/images/sn_" + section + "_on.gif";
	    }
	}
    }
}

//This ends the automatic select of the subnav images---------------------
//Will Pre-cache an image
function preCache(image){
    if (document.images){
	pic = new Image();
	pic.src = image;
    }
}

//Subnav Rollover: On
function subnavOn(imgName){
  if(document.images){
    document.images[imgName].src = "/images/sn_" + imgName + "_on.gif";
  }
}
//Subnav Rollover: Off
function subnavOff(imgName){
  if (document.images && section != imgName){
    document.images[imgName].src = "/images/sn_" + imgName + "_off.gif";
  }
}
//Main Nav Rollover: On
function navOn(imgName,edge){
  if(document.images){
    document.images[imgName].src = "/images/n_" + imgName + "_" + edge + "_mo.gif";
  }
}
//Main Nav Rollover: Off
function navOff(imgName,edge){
  if (document.images && section != imgName){
    document.images[imgName].src = "/images/n_" + imgName + "_" + edge + "_off.gif";
  }
}
//General Rollover: On and Off
function genRoll(path,page,state){
  if (document.images){
    document.images[page].src = "/images/" + path + page + "_" + state + ".gif";
  }
}

//Checking the Pulldown menus and submitting
function checkForm(whichPullDown){
    if (document.images){
	if (document.theForm[whichPullDown].value != "line"){
	    document.theForm.submit();
	}
    }
}

function newPage(whichPullDown){
    if (document.images){
	place = document.theForm[whichPullDown][document.theForm[whichPullDown].selectedIndex].value;
	if (place != "line"){
	    if (((place.indexOf("http://") >= 0) && (place.indexOf("http://ir.ccbn.com") == -1) && (place.indexOf("http://www.corporate-ir.net") == -1)) || (place.indexOf("ticker=G&script=1900&layout=0") >= 0)){
		openWin(place);
	    }
	    else{
		location.href = place;
	    }
	}
    }
}