var videoOn = -1;
var videoObj = "";
var videoWidth = 400;
var videoHeight = 346; /* 480 */
var videoInt = "";

function videoInit(name) {
	if (swfversion['major'] > 8 && noflash=='' && printerfriendly=='') {

		var so = new SWFObject("/swf/video.swf", "videoSwf", videoWidth, videoHeight, "9");
		so.addParam("AllowScriptAccess", "always");
		so.addParam("salign", "tl");
		so.addVariable("skin","/swf/SkinUnderPlaySeekMute.swf");
		so.addVariable("flv","/video/video.flv");
		//so.addVariable("debug","1");
		so.write(name);
	
		videoObj = MM_findObj('videoSwf','');
		if (typeof(videoObj)!="undefined") videoOn = 0;
	}
}

function videoLaunch() {
	//alert('launch video');
	return true;
/*
	if (videoOn>-1) {
		if (videoOn==0) {
			videoShow();
		} else {
			videoHide();
		}
		return false;
	} else {
		return true;
	}
*/
}

function videoShow() {
	videoPosition();
	MM_changeProp('mask',0,'style.display','block');
	MM_changeProp('video',0,'style.display','block');
	videoShowInt();
}

var videoLoopCnt = 0;
function videoShowInt() {
 	// Wait for video to start, if not launch video.htm
	clearTimeout(videoInt);
	 if (videoLoopCnt < 4) {
		if (typeof(videoObj.startVideo)!='function') {
			videoLoopCnt++;
			videoInt = setTimeout("videoShowInt()",1000);
		} else {
			videoObj.startVideo();
			videoOn = 1;
		}
	} else {
		location.href = "/video.htm";
	}
}

function videoHide() {
	videoObj.stopVideo();
	MM_changeProp('video',0,'style.display','none');
	MM_changeProp('mask',0,'style.display','none');
	videoOn = 0;
}

function videoPosition() {
	var myWidth = 0, myHeight = 0;
	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;
	}
	var myLeft = Math.round((myWidth/2)-(videoWidth/2));
	var myTop = Math.round(myHeight/2)-200;
	if (myLeft<0) myLeft = 0;
	if (myTop<0) myTop = 0;

	MM_changeProp('video','','style.left',myLeft+'px');
	MM_changeProp('video','','style.top',myTop+'px');
}
