document.ie = navigator.appVersion.indexOf("MSIE")!=-1
document.cw = 760;


/*
john.daharsh 2.2004
  this tests for the existence of a div and its
  style property before making any attempt to access
  any style settings (prevents errors - just use wisely)
*/
function fastStyle(obj,css,setting){
 if(document.getElementById(obj)){
  if(document.getElementById(obj).style){
   eval("document.getElementById('"+obj+"').style."+css+"='"+setting+"'")
  }
 }
 return css;
}


/* 
john.daharsh 2.2004
  this repositions the contents of 
  the page when it loads or reloads  
*/
function adjustDisplay(){

 document.w = (document.ie?document.body.clientWidth:window.innerWidth);
 document.h = (document.ie?(document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight):window.innerHeight);
 

 
 // adjust the height of the display (the main row of content, adjusted for the header and the footer and padding)
 if(document.h>166){
  fastStyle("contentHeight","height",(document.h-(document.ie?216:196))+"px");
 }
 
 //now adjust the background for the footer to the height of the contents of the page.
 if(document.getElementById("subMain")){
    // the "bottom" position attribute is sketchy in IE, so we need to reposition here
    fastStyle("subFooterBackground","top",((document.ie?186:166)+document.getElementById("subMain").offsetHeight-(document.ie?53:33)+"px"));
 }
 
 // adjust the center
 fastStyle("subContentBox","left",(document.w>document.cw?((document.w/2)-(document.cw/2))+"px":"0px"));
 fastStyle("contentBox","left",(document.w>document.cw?((document.w/2)-(document.cw/2))+"px":"0px"));
 
 //on the home page, resize the 2 side panels
 if(document.w>(document.cw+6))

 {
  fastStyle("rightPanelStripe","width",(document.w-(document.cw+6))/2+"px");
  fastStyle("leftPanelStripe","width",(document.w-(document.cw+6))/2+"px");
  fastStyle("rightPanelStripe","visibility","visible");
  fastStyle("leftPanelStripe","visibility","visible");
 }
 
 
 /*// now we have to scale the home page flash -- unfortunately this does not work in Safari, redid main page
 if(document.getElementById("mainContent")){
  if(document.getElementById("mainContent").innerHTML){
   // I need to scale the swf for the page width.
   // the strange thing is when I try to change the width property (even if I hard-code it)
   // the flash won't display, but it works exactly as I need it to when I set the height and
   // leave the width at 100%. So what I'm doing is scaling the height based on the proportions
   // of the movie and the width of the page, then the width snaps to match. strange. john.daharsh
   objStr="";
   objStr+="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"100%\" height=\""+((268/760)*document.w)+"\" id=\"home\" align=\"middle\">\n";
   objStr+="<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
   objStr+="<param name=\"movie\" value=\"swf/home.swf\" />\n";
   objStr+="<param name=\"menu\" value=\"false\" />\n";
   objStr+="<param name=\"quality\" value=\"best\" />\n";
   objStr+="<param name=\"scale\" value=\"scale\" />\n";
   objStr+="<param name=\"bgcolor\" value=\"#688282\" />\n";
   objStr+="<embed src=\"swf/home.swf\" menu=\"false\" quality=\"best\" scale=\"scale\" bgcolor=\"#688282\" width=\"100%\" height=\""+((268/760)*document.w)+"\" name=\"home\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n";
   document.getElementById("mainContent").innerHTML=objStr
  }
 }*/
 
 // now Ijust adjust the height of the container and it will hopefully play nice in IE and Safari on a Mac
 if(document.getElementById("mainContent")){
  if(document.getElementById("mainContent").style){
  document.getElementById("mainContent").style.height=(268/760)*document.w+"px"
  }
 }
 
 return true;
}

/*
john.daharsh 2.2004
  let everything get into place 
  before showing the page for the first time
*/
function revealPage(){
 adjustDisplay();
 fastStyle("contentBox","visibility","visible");
 fastStyle("subContentBox","visibility","visible");
 fastStyle("subFooterBackground","visibility","visible");
 return true;
}

/* keep at bottom of file */
window.onresize = adjustDisplay 
window.onload = revealPage