//set event handler
window.onload = init;

function init(){
	CheckNav();
	initAPI();
	ACK_Preload();
	soopaPopSetup();
}
//Global API
var isCSS, isW3C, isIE4, isNN4, isIE6CSS;
var currNav, PageTitle, PageURL;
currNav = ''

function initAPI(){
	if(document.images){
		isCSS = (document.body && document.body.style) ? true : false;
		isW3C = (isCSS && document.getElementById) ? true : false;
		isIE4 = (isCSS && document.all) ? true : false;
		isNN4 = (document.layers) ? true : false
		isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
	}
}

function seekLayer(doc,name){
	var theObj;
	for (var i =0; i< doc.layers.length; i++){
	if(doc.layers[i].name == name){
	theObj = doc.layers[i];
	break;
	}
//Dive into nested layers if necessary
if (doc.layers[i].document.layers.length > 0){
		theObj =  seekLayer(document.layers[i].document, name);
		}
	}
	return theObj;
}
	
// Convert object name string or object reference
// into a valid element object reference

function getRawObject(obj){
	var theObj;
	if(typeof obj == "string") {
		if(isW3C){
				theObj = document.getElementById(obj);
			} else if (isIE4) {
				theObj = document.all(obj);
			} else if (isNN4) {
				theObj = seekLayer(document, obj);
			}
		} else {
			//pass through object reference
			theObj = obj;
		}
			return theObj;
	}
	
//Convert object name string or object reference
//into a valid style (orNN4 layer) reference
function getObject(obj){
	var theObj = getRawObject(obj);
	if(theObj && isCSS) {
	theObj = theObj.style;
	}
	return theObj;
}
////////////////////////////////////////////////////////////////////////////
function ACK_Preload(){
	MM_preloadImages('../images/nav/why_on.gif','../images/nav/who_on.gif','../images/nav/how_on.gif','../images/nav/what_on.gif','../images/nav/where_on.gif')
	}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function SetStatus(msg){
	window.status = msg;	
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){
  	if(x.id != currNav){
   x.src=x.oSrc;
   }
   }
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null ){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
   }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
function soopaPopSetup() {
	var a;
	for (var i = 0; (a = document.links[i]); i++) {
		if (a.target && a.target.indexOf("_soopaPop") == 0) {
			a.onclick = soopaPop;
		}
	}
}

function soopaPop() {
	var a = this.target.split(":");
	var sFeatures = a[1];
	window.open(this.href, a.length > 2 ? a[2] : String((new Date()).getTime()), sFeatures);
	return false;
}

function CheckNav(){
	
PageTitle= self.document.title.substring(26,40)
PageURL  = self.document.location.href

	if (PageTitle == "Who"){
		currNav = 'who';
		MM_swapImage('who','','../images/nav/who_on.gif',1);
	}
	if (PageTitle == "Why"){
		currNav = 'why';
		MM_swapImage('why','','../images/nav/why_on.gif',1);
	}
	if (PageTitle == "How"){
		currNav = 'how';
		MM_swapImage('how','','../images/nav/how_on.gif',1);
	}
    if (PageTitle.indexOf("What") != -1 ) {
		currNav = 'what';
		MM_swapImage('what','','../images/nav/what_on.gif',1);
	}
	if (PageTitle == "Where"){
		currNav = 'where';
		MM_swapImage('where','','../images/nav/where_on.gif',1);
    }
    if (PageTitle == "") {
        currNav = 'why';
        MM_swapImage('why', '', '../images/nav/why_on.gif', 1);
    }
}