﻿var drawerDivWH=[260,248];

var __setVideoID;
var __setCatalogCode;
var __setAutoPlay;
var __setLiveStatus;
try{
	__setVideoID=(_setVideoID==undefined?"":_setVideoID);
}catch(e){}
try{
	__setCatalogCode=_setCatalogCode;
}catch(e){
	__setCatalogCode="";
}
try{
	__setAutoPlay=(_setAutoPlay==undefined?true:_setAutoPlay);
}catch(e){}
try{
	__setLiveStatus=(_setLiveStatus==undefined?false:_setLiveStatus);
}catch(e){}

var _contentPlayerFullStatus=false;
var _updataFlashOneShow=false;
var _swfrootpath="http://www.vodone.com/js/player/";//
function _buildMainDiv(){
	var htmlStr="<div style='width:424px;height:360px;background-color:transparent;position:absolute;z-index:2147483647' id='_contentPlayerDiv'>"+
				"<div style='width:"+drawerDivWH[0]+"px;height:"+drawerDivWH[1]+
				"px;background-color:transparent;position:absolute;left:-1px;top:0px;z-index:101;' "+
				"id='_drawerPlayerDiv'>"+
				getFlashHtml("drawerPlayer","_drawerPlayer",drawerDivWH[0],drawerDivWH[1],"transparent")+
				"</div>"+
				"<div style='width:422px;height:355px;background-color:#000000;position:absolute;"+
				"left:0px;top:0px;z-index:103;border:1px solid #cbcbcb;' id='_mainPlayerDiv'>"+
				getFlashHtml("videoPlayer","_mainPlayer","100%","100%",__setLiveStatus?"Opaque":"window","contentid="+__setVideoID+"&catelog="+__setCatalogCode+"&autoplay="+__setAutoPlay+"&livestatus="+__setLiveStatus)+
				"</div>"+
				"<div style='width:305px;height:63px;background-color:transparent;position:absolute;"+
				"left:60px;top:61px;z-index:102;'>"+
				getFlashHtml("bannerPlayer","_bannerPlayer",305,63,"transparent")+
				"</div>"+
				"</div><div style='width:424px;height:360px;'></div>";//361
	return htmlStr;
}
function mainPlayerOver(){
	_$("_mainPlayer").focus();
	try{
		_$("_pageUrl").value=copyPageUrl();
	}catch(e){}
	try{
		_$("_jsEmbed").value=copyEmbed();
	}catch(e){}
	try{
		_$("_objEmbed").value=getFlashHtml("videoPlayer","_mainPlayer",422,355,'',"contentid="+__setVideoID+"&autoplay=false");
	}catch(e){}
	_getSwfMovie("_drawerPlayer").setSide("R");
}
function thisSwfMovie(){
	return _getSwfMovie("_mainPlayer");
}
function copyEmbed(title){
	var embedStr=(title?(title+"\n"):"")+
				 '<script type="text/javascript">'+
				 'var _setVideoID="'+__setVideoID+'";'+
				 'var _setCatalogCode="'+__setCatalogCode+'";'+
				 'var _setAutoPlay="'+__setAutoPlay+'";'+ 
    			 '</script>'+
				 '<script type="text/javascript" src="'+_swfrootpath+'showConetntPlayer.js" charset="utf-8"></script>';
	return embedStr;
}
function copyPageUrl(){
	return window.location.href;
}
function playerMsg(code,infoArr){
	switch(code){
		case "SHOW_DRAWER":
			_getSwfMovie("_drawerPlayer").setSide("R");
			_$("_drawerPlayerDiv").style.left="424px";
			_getSwfMovie("_drawerPlayer").glideOut(infoArr);
			break;
		case "SHOW_BANNER":
			_getSwfMovie("_bannerPlayer").glideOut(infoArr);
			break;
		case "HIDE_DRAWER":
			_getSwfMovie("_drawerPlayer").glideIn();
			break;
		case "CLIP_EMBED":
			alert(infoArr);
			break;
		case "UPDATA_VER":
			openFlashUpdataWin();
			break;
	}
}
function drawerMsg(code){
	switch(code){
		case "PAUSE_PLAY":
			_getSwfMovie("_mainPlayer").clickPause(true);
			break;
		case "IN_OVER":
			_$("_drawerPlayerDiv").style.left="0px";
			break;
	}
}
function bannerMsg(code){
	switch(code){
		case "SHOW_DRAWER":
			_$("_drawerPlayerDiv").style.left="424px";
			_getSwfMovie("_drawerPlayer").glideOut();
			break;
		case "PAUSE_PLAY":
			_getSwfMovie("_mainPlayer").clickPause(true);
			_getSwfMovie("_drawerPlayer").glideIn();
			break;
	}
}
function getFlashHtml(swfpath,id,w,h,wmode,vars){
	var  swfpaths=_swfrootpath+swfpath;
	var _flash_str='<object id="'+id+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="'+w+'" height="'+h+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ><param name="movie" value="'+swfpaths+'.swf" /><param name="FlashVars" value="'+vars+'" /><param name="wmode" value="'+wmode+'" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed name="'+id+'" width="'+w+'" height="'+h+'" src="'+swfpaths+'.swf" wmode="'+wmode+'" allowFullScreen="true" allowScriptAccess="always" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" FlashVars="'+vars+'" type="application/x-shockwave-flash"></embed></object>';
	return _flash_str;
}
function _$(name){
	return document.getElementById(name);
}
function _getSwfMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}else{
		return document[movieName];
	}
}
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
           oldonload();
           func(); 
       }
    }
}
function copyAddress(objname){
	try{
		var embedStr=_$(objname).value;
		alert(_getSwfMovie("_mainPlayer").copyToCilp(embedStr,objname));
	}catch(e){}
}
addLoadEvent(mainPlayerOver);
document.write(_buildMainDiv());