var fHeight = 0;
var scrollY = 0;

/*
	update flash height
*/
//called from flash to set new document height
function updateFlashHeight(height){
	 fHeight = height;
	 var windowHeight = getWindowHeight();
	 fHeight = fHeight > windowHeight ? fHeight : windowHeight;
	 setFlashElementHeight(fHeight)
}

//update flash height using browser
$(window).resize(function(){
	 var windowHeight = getWindowHeight();
	 if(windowHeight > fHeight){
	 	updateFlashHeight(windowHeight);
	 }
});

function setFlashElementHeight(h){
	$('#wrapper').css({height: h});
    $('#flashContent').css({height: h});
  	$('#flashContent embed').attr('height', h);
}


/*
	utils
*/

//cross-browser get window height
function getWindowHeight(){
	return windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
}

//cross browser get flash element
function getFlash(movieName) {
     if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
     } else {
         return document[movieName];
     }
}
