/********************************************************************************
* JavaScript that governs how DHTML menus function.
********************************************************************************/


/*******************************************
* Reference stylesheet for menus.
*******************************************/
if(!document.getElementById){
   document.write('<link rel="stylesheet" type="text/css" href="http://www.fcpb.org/fcpb_menu_style.css">');
   document.close()
}//end if


/*******************************************
* MM_findObj()
*******************************************/
function MM_findObj(n, d) { 
   var p,i,x;

   //If no d is provided, assign d to the document object.
   if(!d) {          
      d=document; 
   }//end if

   //Assign p to the index of the provided node.
   if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; 
      n=n.substring(0,p);
   }//end if

   if(!(x=d[n])&&d.all) {
      x=d.all[n];
   }//end if

   for (i=0;!x&&i<d.forms.length;i++) {
      x=d.forms[i][n];
   }//end for

   for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
      x=MM_findObj(n,d.layers[i].document);
   }//end for

   if(!x && d.getElementById) {
      x=d.getElementById(n);
   }//end if 
 
   return x;
}//end MM_fundObj()


/*******************************************
* P7_autoLayers()
*******************************************/
function P7_autoLayers() { 
   var g,b,k,f,args=P7_autoLayers.arguments;
   // Note: arguments is an array of arguments passed to the function. This is an array object 
   // which has a property of length which enables the programmer to tell how many arguments 
   // (or variables)are passed to the function. 

   a=parseInt(args[0]); //Take a string from arguments[] and parse it into an integer.

   if(isNaN(a))a=0; //If a is not a number (NaN), set a to 0.

   if(!document.p7setc){
      p7c=new Array();
      document.p7setc=true;
      for(var u=0;u<10;u++){
         p7c[u]=new Array();
      }//end for
   }//end if

   for(k=0;k<p7c[a].length;k++){
      if((g=MM_findObj(p7c[a][k]))!=null){
         b=(document.layers)?g:g.style;b.visibility="hidden";
      }//end if
   }//end for

   for(k=1;k<args.length;k++){
      if((g=MM_findObj(args[k]))!=null) {
         b=(document.layers)?g:g.style;
         b.visibility="visible";f=false;
         for(var j=0;j<p7c[a].length;j++) {
            if(args[k]==p7c[a][j]) {
               f=true;
            }//end if
         }//end for
         if(!f){
            p7c[a][p7c[a].length++]=args[k];
         }//end if
      }//end if
   }//end for
}//end P7_autoLayers()


/*******************************************
* P7_hideDiv()
*******************************************/
function P7_hideDiv(evt) { 
   var b,relT,mT=false; 
   if(document.layers) {
      b=evt.target;
      if(b.p7aHide) {
         b.visibility="hidden";
      }//end if
      else {
         routeEvent(evt); 
      }//end else
   }//end if
   else if(document.all&&!window.opera) {
      b=event.srcElement;
      while(b!=null) {
         if(b.tagName=="DIV" && b.p7ahD) {
            mT=true;break;
         }//end if
         b=b.parentElement;
      }//end while
      if(!b.contains(event.toElement)) {
         b.style.visibility="hidden";
      }//end if
   }//end else if
   else if(document.getElementById){
      b=evt.currentTarget;
      relT=evt.relatedTarget;
      while(relT!=null) {
         if(b==relT) {
            mT=true;break;
         }//end if
         relT=relT.parentNode;
      }//end while
      if(!mT){ 
         b.style.visibility="hidden";
      }//end if
   }//end else if
}//end P7_hideDiv()


/*******************************************
* P7_autoHide()
*******************************************/
function P7_autoHide() { 
   var i,g,args=P7_autoHide.arguments;
   for(i=0;i<args.length;i++) {
      if((g=MM_findObj(args[i]))!=null) {
         g.p7aHide=true;
         if(document.layers) {
            g.captureEvents(Event.MOUSEOUT);
         }//end if
         g.onmouseout=P7_hideDiv;
         g.p7ahD=true;
      }//end if
   }//end for
}//end P7_audoHide()


/*******************************************
* wimpyPopPlayer() -- To open window
*******************************************/
function wimpyPopPlayer(theFile,id,stuff) {
  window.open(theFile,id,stuff);
}//end P7_autoHide()


/*******************************************
* MM_reloadPage(init) -- Netscape reload
*******************************************/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
   if (init==true) with (navigator) {
      if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
         document.MM_pgW=innerWidth; 
         document.MM_pgH=innerHeight; 
         onresize=MM_reloadPage; 
      }//end if
   }//end if
   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {
      location.reload();
   }//end else if
}//end MM_reloadPage(init)


MM_reloadPage(true);
/*******************************************
* MM_reloadPage(true) -- Netscape reload
*******************************************/
function AddToFaves_hp(){
   var is_4up = parseInt(navigator.appVersion);
   var is_mac = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
   var is_ie = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
   var thePage = location.href;
   if (thePage.lastIndexOf('#')!=-1) {
      thePage = thePage.substring(0,thePage.lastIndexOf('#'));
   }//end if
   if (is_ie && is_4up && !is_mac) {
      window.external.AddFavorite(thePage,document.title); 
   }//end if
   else if (is_ie || document.images) {
      booker_hp = window.open(thePage,'booker_','menubar,width=325,height=100,left=140,top=60');
   }//end else if
}//end MM_reloadPage(true)
