// JavaScript Document
function timedResize () {
	var t=setTimeout("timedResize()",100);
	updateBackground();
}

function updateBackground () {
	var total_height = document.documentElement.clientHeight;
    var total_width = document.documentElement.clientWidth;
	
	
	if (!hasflash || wwwlevel == "html") {
		
		//NON-FLASH BACKGROUND UPDATE
		
		
		//clip to this area
		areawid = Math.max(total_width, 1000);
		areahei = Math.max(total_height, 530);
		document.getElementById('bg_image_holder').style.width = areawid+"px";
		document.getElementById('bg_image_holder').style.height = areahei+"px";
		
		
		//overscan the clipped area
		imageaspect = 16/9;
		if (areawid/areahei > imageaspect) {
			wid = areawid;
			hei = areawid * 9/16;
		} else {
			hei = areahei;
			wid = areahei * 16/9;
		}
		
		document.getElementById('bg_image').style.width = wid+"px";
		document.getElementById('bg_image').style.height = hei+"px";
	}
	
	//FLASH BACKGROUND OR FULL SITE UPDATE
	
	//add a horizontal scroll bar if the window is less than 1000px wide
	if (total_width >= 1000) {
		document.getElementById('bg_site_holder').style.width = total_width+"px";
		document.getElementById('bg_site_location').style.width = total_width+"px";
		document.body.style.overflowX = "hidden";
	} else {
		document.getElementById('bg_site_holder').style.width = "1000px";
		document.getElementById('bg_site_location').style.width = "1000px";
		document.body.style.overflowX = "auto";
	}
	//add a vertical scroll bar if the window is less than 530px tall
	if (total_height >= 530) {
		document.getElementById('bg_site_holder').style.height = total_height+"px";
		document.getElementById('bg_site_location').style.height = total_height+"px";
		document.body.style.overflowY = "hidden";
	} else {
		document.getElementById('bg_site_holder').style.height = "530px";
		document.getElementById('bg_site_location').style.height = "530px";
		document.body.style.overflowY = "auto";
	}
		
	if (document.getElementById('filler')) {
		document.getElementById('filler').style.height = (total_height-180-170)+"px";
	}
}
/*
function centerfixdecide() {
	if(FlashDetect.versionAtLeast(9, 0, 16)) {
		document.getElementById('site_holder').style.width = 100+"%";
		document.getElementById('site_holder').style.height = 100+"%";
		centerfix();
	} else {
		document.getElementById('site_holder').style.width = 1000+"px";
		document.getElementById('site_holder').style.height = 750+"px";
		c_fix(1000, 100000, 0, 10);
	}
}

//call this function once html page too (anywhere after <div id="blyon">...)
function centerfix() { 
  var total_height = document.documentElement.clientHeight;
  var total_width = document.documentElement.clientWidth;
  
  //add a vertical scroll bar if the window is less than 750px tall
  if (total_height > 750) {
	  document.getElementById('site_holder').style.height = total_height+"px";
	  document.getElementById('blyonbody').style.overflowY = "hidden";
  } else {
	  document.getElementById('site_holder').style.height = "750px";
	  document.getElementById('blyonbody').style.overflowY = "auto";
  }
  
  //add a horizontal scroll bar if the window is less than 1000px wide
  if (total_width > 980) {
	  document.getElementById('site_holder').style.width = total_width+"px";
	  document.getElementById('blyonbody').style.overflowX = "hidden";
  } else {
	  document.getElementById('site_holder').style.width = "1000px";
	  document.getElementById('blyonbody').style.overflowX = "auto";
  }
}

function c_fix(cont_x, cont_y, min_l, min_t) {
  var frame = document.getElementById("site_holder");  
  var total_height = document.documentElement.clientHeight;
  var total_width = document.documentElement.clientWidth;
  var pos_y = 0;
  var pos_x = 0;
  
  if (cont_y > total_height - 2*min_t) {
    pos_y = min_t;
  } else {
    pos_y = (total_height - cont_y)/2;
  }
  
  if (cont_x > total_width - 2*min_l) {
    pos_x = min_l;
  } else {
    pos_x = (total_width - cont_x)/2;
  }
  
  frame.style.top = pos_y + "px";
  frame.style.left = pos_x + "px";

}
*/
//window.onresize = centerfixdecide;