if (!jse) var jse={};

if (!w3c) var w3c=(document.getElementById)? true: false;
if (!agt) var agt=navigator.userAgent.toLowerCase();
if (!ie) var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));

jse.playTips={
	_win:null,
	_bodyWidth:0,
	_disabledZone:null,
	_top:0,
	_isShow:false,	
	ieTrueBody:function(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
	},
	getScrollTop:function() { 		
	    return ie ? jse.playTips.ieTrueBody().scrollTop : window.pageYOffset;
	},
	bodyHeight:function() {
		var cobj = document.body;
		while(cobj.scrollTop == 0 && cobj.parentNode)
		{
			if(cobj.tagName.toLowerCase() == 'html') break;
			cobj = cobj.parentNode;
		}
		return cobj.clientHeight;
	},
	_checkDisabledZone:function() {
		jse.playTips._disabledZone=$("play_tips_disabledZone");
        if (!jse.playTips._disabledZone) {
            jse.playTips._disabledZone=document.createElement('div');
            jse.playTips._disabledZone.id="play_tips_disabledZone";
            jse.playTips._disabledZone.style.cssText="background-color:#eee;-moz-opacity:0.7;filter:alpha(opacity=70);position:absolute;z-Index:9998;left:0px;top:0px;display:none";
            document.body.appendChild(jse.playTips._disabledZone);
        }
	},
	_fixDisabledZoneHeight:function() {
		jse.playTips._checkDisabledZone();
		if (window.attachEvent)  { //IE
            jse.playTips._disabledZone.style.width=document.body.clientWidth+"px";
            jse.playTips._disabledZone.style.height=Math.max(document.body.scrollHeight,document.body.clientHeight,jse.playTips.bodyHeight())+"px";
        }
        else  {  //firefox
            jse.playTips._disabledZone.style.width="100%";
            jse.playTips._disabledZone.style.height=Math.max(document.body.offsetHeight+16,document.body.clientHeight,jse.playTips.bodyHeight())+"px";
        }
	},
	show:function(_winId,_top,_width,_height,_left) {
		jse.playTips._fixDisabledZoneHeight();
		jse.playTips._bodyWidth=document.body.clientWidth;		
		jse.playTips._win=$(_winId);
		jse.playTips._disabledZone.style.display="block";
		with (jse.playTips._win.style) {
			position="absolute";
			zIndex=9999;			
			top=(jse.playTips.getScrollTop()+_top)+"px";
			width=_width+"px";
			height=_height+"px";
			left=(_left || (jse.playTips._bodyWidth-_width)/2)+"px";
			display="block";
		}
		jse.playTips._top=_top;
		jse.playTips._isShow=true;		
	},
	hide:function() {
		jse.playTips._win.style.display="none";
		jse.playTips._disabledZone.style.display="none";
		jse.playTips._isShow=false;
		window.clearTimeout(_timeoutPoint);
	}
}

var _timeoutPoint=null;

jse.playTips.divId="playTips";
jse.playTips.infoContainerId="playTipsInfo";
jse.playTips.showInfo=function(_url) {
	var _info="<p>正在从 <a href='"+_url+"' target='_blank'>"+_url+"</a> 获取影片资源。</p>";
	jse.playTips.show(jse.playTips.divId,200,400,40);
	$(jse.playTips.infoContainerId).innerHTML=_info;
	_timeoutPoint=window.setTimeout(function(){jse.playTips.hide();},10000);
}
jse.playTips.getReffer=function(_movId) {
	var _cpIds=pp.cp.getCpIds(_movId);
	var _isCpMovs=(_cpIds.length>0);
	for (var i=0;i<_cpIds.length;i++) {
		if (!pp.siteConfig.cp.isCpMovs(_cpIds[i])) {
			_isCpMovs=false;
			break;
		}
	}
	var _url=pp.siteConfig.action.getRefUrl(_movId,_isCpMovs);
	var _html="";
	if (_isCpMovs) {			
		_html=pp.siteConfig.cp._cpUrls[_cpIds[0]]+_url;
	} else {			
		var _arr=pp.siteConfig.action.getRandomSiteIndexList();
		_html=pp.siteConfig.sites[_arr[0]]+_url;
	}		
	return "http://"+_html;
}

