//keep track of the last height flash called [not used at the moment]
var lastHeight=0;
var minWidth=900;
var minHeight=700;

function resizeSWF(nHeight) {
	//save
	lastHeight=nHeight;
	//get the window height
	_h=WindowHeight();
	//don't go smaller than the window height which needs to be scrollbar adjusted for firefox
	(nHeight<_h) ? nHeight=_h : null;
	//resize
	document.getElementById("siteHolder").style.height = nHeight+"px";
	document.getElementById("site").style.height = nHeight+"px";
}

function resizeWindow() {
	//pass the new window height in
	_h=WindowHeight();
	_w=WindowWidth();
	
	//width should be restricted to min width
	(_w<minWidth) ? _w=minWidth : null;
	
	//pass to flash
	swfLink('site','windowHeight',_h,'');
	swfLink('site','windowWidth',_w,'');
	
	//set the width
	document.getElementById("siteHolder").style.width=_w+"px";
	document.getElementById("site").style.width = _w+"px";
	
	
	//resize the flash if the height has changed
	if(_h>lastHeight) {
		document.getElementById("siteHolder").style.height=_h+"px";
		document.getElementById("site").style.height = _h+"px";
	} else {
		document.getElementById("siteHolder").style.height=lastHeight+"px";
		document.getElementById("site").style.height = lastHeight+"px";
	}
}

window.onscroll = scrollCheck;

//adjust the scroll
function setScrollTo(_x,_y){
	window.scrollTo(_x,_y);
}

function scrollCheck()
{
	//get the scroll positions
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	var dsocleft=document.all? iebody.scrollLeft : pageXOffset
	var dsoctop=document.all? iebody.scrollTop : pageYOffset
	//pass it through
	swfLink('site','scrollOffsetY',dsoctop,'');

}
function WindowHeight() {
	if (typeof(window.innerHeight) == "number") { // not ie - firefox - subtract the height of our scrollbar
		return window.innerHeight-16;
	} else if (document.documentElement && document.documentElement.clientHeight) {// ie6 standards compliant mode 
		return document.documentElement.clientHeight;
	} else if (document.body && document.body.clientHeight) {// ie4 compatible 
	}
}	

function WindowWidth() {
	if (typeof(window.innerWidth) == "number") {// not ie - firefox - subtract the width of our scrollbar
		return window.innerWidth-16;
	} else if (document.documentElement && document.documentElement.clientWidth) {// ie6 standards compliant mode 
		return document.documentElement.clientWidth;
	} else if (document.body && document.body.clientWidth) {// ie4 compatible 
		return document.body.clientWidth;
	}
}

function windowScroll(_ax,_ay) {
	//get the scroll positions
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	var dsocleft=document.all? iebody.scrollLeft : pageXOffset
	var dsoctop=document.all? iebody.scrollTop : pageYOffset
	
	window.scrollTo(dsocleft+_ax,dsoctop+_ay);
}