﻿var path;
var orginFlash = {init:false,isFullScreen:false,position:"",top:"",left:"",width:"",height:""};
path = "/upload/video/" + $("#flvPath").val();
function writeFlash(){
		var so = new SWFObject("fullscreen.swf", "fplayer", "100%", "100%", 8, "#000000");
		so.addParam("quality", "high");
		so.addParam("swLiveConnect", "true");
		so.addParam("menu", "false");
		so.addParam("allowScriptAccess", "sameDomain");
		so.addParam("allowFullScreen", "true");
		so.write("FlashPlay");		
	}
	function getScreenSize(){
		var w = 0;
		var h = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			w = window.innerWidth;
			h = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
		return {width:w,height:h};
	}
	function fullScreen(){
		if(!orginFlash.init){		
			orginFlash.position = document.getElementById("FlashPlay").style.position;
			orginFlash.top = document.getElementById("FlashPlay").style.top;
			orginFlash.left = document.getElementById("FlashPlay").style.left;
			orginFlash.width = document.getElementById("FlashPlay").style.width;
			orginFlash.height = document.getElementById("FlashPlay").style.height;
			//orginFlash.height = document.getElementById("FlashPlay").style.height;
		}
		orginFlash.init = true;
		orginFlash.isFullScreen = true;
		var screenSize = getScreenSize();
		try{
			document.getElementById("FlashPlay").style.position = "absolute";
			document.getElementById("FlashPlay").style.top = "0px";
			document.getElementById("FlashPlay").style.left = "0px";
			document.getElementById("FlashPlay").style.width = screenSize.width +"px";
			document.getElementById("FlashPlay").style.height = screenSize.height +"px";
			document.body.style.overflow="hidden";
			window.scrollTo(0,0);
		}catch(e){
		}
	}
	function normal(){
		if(orginFlash.init){
			orginFlash.isFullScreen = false;
			try{
				document.getElementById("FlashPlay").style.position = orginFlash.position;
				document.getElementById("FlashPlay").style.top = orginFlash.top;
				document.getElementById("FlashPlay").style.left = orginFlash.left;
				document.getElementById("FlashPlay").style.width = orginFlash.width;
				document.getElementById("FlashPlay").style.height = orginFlash.height;
				document.body.style.overflow="auto";
			}catch(e){				
			}
		}
	}
	function reSize(){
		if(orginFlash.isFullScreen){
			fullScreen();
		}
	}
	window.onresize = reSize;
	writeFlash();
	function copyz()
	{
		JM_cc("page_url");
	}