var winW = 1024; 
var winH = 600;
	
	var _rootEl=document.compatMode=="CSS1Compat"?document.documentElement:document.body;/**/
//	alert(_rootEl.clientHeight+"***"+_rootEl.clientWidth); 
	winH = _rootEl.clientHeight-20;

	String.prototype.getQueryString = function(name){var reg = new RegExp("(^|&|\\?)"+ name +"=([^&]*)(&|$)"), r;if (r=this.match(reg)) return unescape(r[2]); return null;}
	function getRandom(){return GetRandomn=Math.floor(Math.random()*100+1)}
	//var oScript = document.getElementsByTagName("script");
	function closewindow(divname){var content1 = document.getElementById(divname);content1.innerHTML = '';content1.style.border='0px';}		
/*	for (var i=0;i<oScript.length;i++ )	{			
		if (oScript[i].src.toLowerCase().indexOf('izo_float1.js')>=0){			 
			var b = oScript[i].src;
			initDisplay(b);
		}
	}	
	function initDisplay(b){*/
		var f1Script = document.getElementsByTagName("script");
		var b ="";
		
		for (var i=0;i<f1Script.length;i++ )
		{			
			if (f1Script[i].src.indexOf('izo_float1.js')>=0)
			{			 
				   b = f1Script[i].src;
			}
		}
		var userName = b.getQueryString("user");
		var userid =  b.getQueryString("userid");
	  	var begin = b.getQueryString("begin");
	  	begin=begin==null?"":begin;
	   	var w = b.getQueryString("w");
	   	var h =  parseInt(b.getQueryString("h"));
	   	var h2 = h+22;
   	   	var pos = b.getQueryString("pos");
   	  	var localip = b.getQueryString("ip");
   	   	var id = b.getQueryString("id");
   	  	var tmpURI = b.getQueryString("uri");
   	  	var liveParam = b.getQueryString("live");
   	   	var winLiveURI="";
   	   	if(tmpURI!=null&&tmpURI.length>0){
   	   		winLiveURI = "&uri="+tmpURI;
   	   	}
   	  	if(liveParam!=null&&liveParam.length>0){
  	 	   begin+="&live="+liveParam;
		}
		var color = b.getQueryString("color");
	    if(color==null)
	    {
	    	color="";
	    } 
		//add later by zw
		var requiredMinorVersion = 0;
		var requiredRevision = 28;
		var requiredMajorVersion = 9;							
		var hasProductInstall = DetectFlashVer(6, 0, 65);
		var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		
		
		var randomNum = getRandom();
		var mainDiv = 'wintv_fl_'+randomNum;
		var topDiv = 'wintv_fl_topmenu_'+randomNum;
		var code = '<div id="'+mainDiv+'">';
		code += '<div id="'+topDiv+'"><a style="cursor:pointer;color:#FF9900;text-decoration:none;" onclick="javascript:closewindow(\''+mainDiv+'\');"><img src="'+localip+'/images/close.gif"/></a></div>';
		document.write(code);
		/*code += '<div id="'+topDiv+'"><a style="cursor:pointer;color:#FF9900;text-decoration:none;" onclick="javascript:closewindow(\''+mainDiv+'\');"><img src="'+localip+'/images/close.gif"/></a></div>'+
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+w+'" height="'+h+'">'+
		'<param name="movie" value="'+localip+'player/player.swf?user='+userName+'&id='+id+'&begin='+begin+'&ip='+localip+winLiveURI+'" >'+
		'<param name="quality" value="high">'+
		'<param name="allowFullScreen" value="true" />'+
		'<param name="wmode" value="transparent" />'+
		'<param name="allowScriptAccess" value="always" />'+
		'<embed src="'+localip+'player/player.swf?user='+userName+'&id='+id+'&begin='+begin+'&ip='+localip+winLiveURI+'" width="'+w+'" height="'+h+'" quality="high" wmode="transparent" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">'+
		'</embed>'+
		'</object>';*/
		//code += '</div>';
			if ( hasProductInstall && !hasRequestedVersion ){								
			var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
			var MMredirectURL = window.location;
			document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		 	var MMdoctitle = document.title;	
			AC_FL_RunContent(
				"src", localip+"player/playerProductInstall",
				"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
				"width", w,
				"height", h,
				"align", "middle",
				"id", localip+"player/player?user="+userName+"&id="+id+'&ip='+localip+'&begin='+begin+winLiveURI+'&color='+color,
				"quality", "high",
				"bgcolor", "#000000",
				"name", "player",
				"wmode","transparent",
				'allowFullScreen', 'true',									
				"allowScriptAccess","always",
				"type", "application/x-shockwave-flash",
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
			);
		}else if(hasRequestedVersion){
			AC_FL_RunContent(
					"src",  localip+"player/player?user="+userName+"&id="+id+'&ip='+localip+'&begin='+begin+winLiveURI+'&color='+color,
					"width", w,
					"height", h,
					"align", "middle",
					"id", "player",
					"quality", "high",
					"bgcolor", "#000000",
					"name", "player",
					"wmode","transparent",
					'allowFullScreen', 'true',
					"allowScriptAccess","always",
					"type", "application/x-shockwave-flash",
					"pluginspage", "http://www.adobe.com/go/getflashplayer"
			);
		} else {  // flash is too old or we can't detect the plugin		 
			   var alternateContent = 'To promise to watching the high-clear video content,please'
		 	+ '<a href=http://www.adobe.com/go/getflash/>click here and install</a>flashplayer plug-in';
		  document.write(alternateContent);  // insert non-flash content
		}
		document.write("</div>");
		var mainObj = document.getElementById(mainDiv);
		var topObj = document.getElementById(topDiv);
		
		topObj.style.cssText="height:10px;line-height:10px;text-align:right;filter:alpha(opacity=80);-moz-opacity:0.8;opacity:0.8;";
		switch (pos){
			case '1':
				mainObj.style.cssText='float:right;position:fixed !important;top:0px;position:absolute;z-index:1000;left:0px;top:expression(offsetParent.scrollTop);width:'+w+'px;height:'+(h+20)+'px;';
				break;
			case '2':
				mainObj.style.cssText='float:right;position:fixed !important;top:0px;position:absolute;z-index:1000;right:0px;top:expression(offsetParent.scrollTop);width:'+w+'px;height:'+(h+20)+'px;';
				break;
			case '3':
				mainObj.style.cssText='float:right;position:fixed !important;bottom:0px;position:absolute;z-index:1000;left:0px;top:expression(offsetParent.scrollTop+'+(winH-h)+');width:'+w+'px;height:'+(h+20)+'px;';
				break;
			case '4':
				mainObj.style.cssText='float:right;position:fixed !important;bottom:0px;position:absolute;z-index:1000;right:0px;top:expression(offsetParent.scrollTop+'+(winH-h)+');width:'+w+'px;height:'+(h+20)+'px;';
				break;				
		}
		//	alert('mainObj='+mainObj.style.cssText);
		var jsReady = false;
		//var neww='';
		function pageInit()
		{
	         jsReady = true;
	     }
		function serverStart()
		{
			window.open(localip+"/customerserviceuser/pop.do?userid="+userid+"&path="+localip+"&companyname="+escape(userName),"","width=630px,height=420px");
		}
		function startMeeting()
		{
			meeting=window.open(localip+"/usermeeting/run_meetingforother.action?user="+userName,"","width=900px,height=600px");
		}
		window.onunload=function(){
			//neww.close();
		}
		if (document.all){
			window.attachEvent('onload',pageInit)
		}
		else{
			window.addEventListener('load',pageInit,false);
		}
		//window.onload=function(){
		//	pageInit();
		//}
