// declare video bg is on
CONST_VIDEO_BG = true;

function getFlashSize(){

// get window's size
var myWidth = 1008, myHeight = 666;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}

//define video format
var ratio = myHeight/myWidth;
var resolution = "43";
if(ratio<60)
	resolution = "169";

//set flash height
if (resolution = "43")
	myHeight = myWidth * 0.695;
else
	myHeight = myWidth * 0.54;
 
// return value
var flashSize = new Array(myWidth,myHeight,resolution);

return flashSize;
}

function displayVideoBg() {
var currentFlashSize = new Array();
currentFlashSize = getFlashSize();
var winW = currentFlashSize[0];
var winH = currentFlashSize[1];
var res  = currentFlashSize[2];

//inject video bg code
$('#Contener').before('<div id="VideoBg"><object width="'+winW+'" height="'+winH+'"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="../flash/video-bg-'+res+'.swf" name="movie"/><param name="allowFullScreen" value="false"><param name="allowScriptAccess" value="always"><param value="high" name="quality"/><param value="transparent" name="WMODE"/><embed align="middle" width="'+winW+'" height="'+winH+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" quality="high" loop="true" play="true" name="movie" src="../flash/video-bg-'+res+'.swf" wmode="transparent"/></object></div>');
}

