window.onresize = onResizeScreen;
var minFlashHeight = 580;

function changeFlashHeight(len) {

	minFlashHeight = len;
	onResizeScreen();
}


function onResizeScreen(){
	w = 960;
	wH = getWindowHeight();
	h = minFlashHeight>wH?minFlashHeight:wH;


	document.getElementById("flash").style.height = h + "px";
	//document.getElementById("shell").style.height = h + "px";


	wW = getWindowWidth();

	if (w > wW){
		document.getElementById("flash").style.width = w + "px";
		//document.getElementById("shell").style.width = w + "px";
	} else {
		document.getElementById("flash").style.width = "100%";
		//document.getElementById("shell").style.width = "100%";
	}
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
			windowHeight = window.innerHeight;
		} else {
			if (document.documentElement && document.documentElement.clientHeight) {
				windowHeight = document.documentElement.clientHeight;
			} else {
				if (document.body&&document.body.clientHeight) {
					windowHeight=document.body.clientHeight;
				}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth =0;
	if (typeof(window.innerWidth)=='number') {
			windowWidth = window.innerWidth;
		} else {
			if (document.documentElement && document.documentElement.clientWidth) {
				windowWidth = document.documentElement.clientWidth;
			} else {
				if (document.body&&document.body.clientWidth) {
					windowWidth =document.body.clientWidth;
				}
		}
	}
	return windowWidth;
}


function popupPage (url, w, h) {
	if (!w) w = 500;
	if (!h) h = 400;
	
	win = window.open(url,"popup","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h);
	if (!win) return;
	
	win.focus();
}



function scrollToTop() {
	window.scroll(0,0);
}

function scrollToBottom() {
	window.scroll(0,9000);
}

function pageUp(){ 
	window.scroll(0, getScrollAmount()-(getWindowHeight()-10) );
}
function pageDown(){ 
	window.scroll(0, getScrollAmount()+(getWindowHeight()-10) );
}




function scrollBrowser(pos, height) {
	var scrollamount = getScrollAmount();
	var wh = getWindowHeight();
	
	//alert("? " + scrollamount + " " + wh + " | " + pos + " " + height);
	
	if(pos<scrollamount) {
		window.scroll(0,pos); 
		return true;
	}else if(pos+height > (scrollamount+wh)) {
		window.scroll(0, pos+height+10)
		return true;
	}
	return false;
}



function getScrollAmount() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}




