var enabletabpersistence=1

// JavaScript Document
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
      if ((obj=MM_findObj(args[i]))!=null)
      {
        v=args[i+2];
        if(v=='show'){
          saveselectedid("data",args[i]);
        }
        if (obj.style)
        {
            obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v;
        }
    obj.visibility=v;
  }
}

function getCookie(Name){
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)){ //if cookie found
 return document.cookie.match(re)[0].split("=")[1] //return its value
}
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

function saveselectedid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function initpress(){
    if (enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }
   if(getCookie("data") == "press06-1"){
       MM_showHideLayers('press06-1','','show','press06-2','','hide','press05-1','','hide','press04-1','','hide')
   }else if(getCookie("data") == "press06-2"){
       MM_showHideLayers('press06-1','','hide','press06-2','','show','press05-1','','hide','press04-1','','hide')
   }else if(getCookie("data") == "press05-1"){
       MM_showHideLayers('press06-1','','hide','press06-2','','hide','press05-1','','show','press04-1','','hide')
   }else if(getCookie("data") == "press04-1"){
       MM_showHideLayers('press06-1','','hide','press06-2','','hide','press05-1','','hide','press04-1','','show')
   }else if(getCookie("data") != ""){
       MM_showHideLayers('press06-1','','show','press06-2','','hide','press05-1','','hide','press04-1','','hide')
   }
    setCookie("data", "")
}

function initindex(){
    if(enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }else if(getCookie("data") == "business-frame"){
        MM_showHideLayers('business-frame','','show','investing-frame','','hide','lending-frame','','hide','banking-frame','','hide')
	}else if(getCookie("data") == "investing-frame"){
        MM_showHideLayers('business-frame','','hide','investing-frame','','show','lending-frame','','hide','banking-frame','','hide')
    }else if(getCookie("data") == "lending-frame") {
        MM_showHideLayers('business-frame','','hide','investing-frame','','hide','lending-frame','','show','banking-frame','','hide')
	}else if(getCookie("data") == "banking-frame") {
        MM_showHideLayers('business-frame','','hide','investing-frame','','hide','lending-frame','','hide','banking-frame','','show')
    }
    setCookie("data", "")
}

function initindex(){
    if(enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }else if(getCookie("data") == "business-frame2"){
        MM_showHideLayers('business-frame2','','show','investing-frame2','','hide','lending-frame2','','hide','banking-frame2','','hide')
	}else if(getCookie("data") == "investing-frame2"){
        MM_showHideLayers('business-frame2','','hide','investing-frame2','','show','lending-frame2','','hide','banking-frame2','','hide')
    }else if(getCookie("data") == "lending-frame2") {
        MM_showHideLayers('business-frame2','','hide','investing-frame2','','hide','lending-frame2','','show','banking-frame2','','hide')
	}else if(getCookie("data") == "banking-frame2") {
        MM_showHideLayers('business-frame2','','hide','investing-frame2','','hide','lending-frame2','','hide','banking-frame2','','show')
    }
    setCookie("data", "")
}

function initterms(){
    if(enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }else if(getCookie("data") == "businessTC-frame"){
        MM_showHideLayers('businessTC-frame','','show','personalTC-frame','','hide')
	}else if(getCookie("data") == "personalTC-frame"){
        MM_showHideLayers('businessTC-frame','','hide','personalTC-frame','','show')
    }
    setCookie("data", "")
}

function initglobal(){
    if(enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }else if(getCookie("data") == "globalPanel-1"){
        MM_showHideLayers('globalPanel-1','','show','globalPanel-2','','hide','globalPanel-3','','hide','globalPanel-4','','hide')
	}else if(getCookie("data") == "globalPanel-2"){
        MM_showHideLayers('globalPanel-1','','hide','globalPanel-2','','show','globalPanel-3','','hide','globalPanel-4','','hide')
    }else if(getCookie("data") == "globalPanel-3") {
        MM_showHideLayers('globalPanel-1','','hide','globalPanel-2','','hide','globalPanel-3','','show','globalPanel-4','','hide')
	}else if(getCookie("data") == "globalPanel-4") {
        MM_showHideLayers('globalPanel-1','','hide','globalPanel-2','','hide','globalPanel-3','','hide','globalPanel-4','','show')
    }
    setCookie("data", "")
}

function initpfennig(){
    if (enabletabpersistence==0 && getCookie("data")!=""){ //clean up cookie if persist=off
        setCookie("data", "")
    }
	if(getCookie("data") == "nov2006"){
       MM_showHideLayers('nov2006','','show','oct2006','','hide','sept2006','','hide','aug2006','','hide','jul2006','','hide')
	}else if(getCookie("data") == "oct2006"){
       MM_showHideLayers('nov2006','','hide','oct2006','','show','sept2006','','hide','aug2006','','hide','jul2006','','hide')
	}else if(getCookie("data") == "sept2006"){
       MM_showHideLayers('nov2006','','hide','oct2006','','hide','sept2006','','show','aug2006','','hide','jul2006','','hide')
	}else if(getCookie("data") == "aug2006"){
       MM_showHideLayers('nov2006','','hide','oct2006','','hide','sept2006','','hide','aug2006','','show','jul2006','','hide')
	}else if(getCookie("data") == "jul2006"){
       MM_showHideLayers('nov2006','','hide','oct2006','','hide','sept2006','','hide','aug2006','','hide','jul2006','','show')
	}
    setCookie("data", "")
}