﻿function checkDy(strUrl,mid,lid,flid,filename,isfree) 
{
  checkClient(strUrl,mid,lid,flid,filename);
  if(typeof(listpagetracker)!='undefined'&& typeof listpagetracker == 'function'){
  	listpagetracker(mid);
  }
  recordClick(mid);
}
function recordClick(movid){
	var page=document.getElementById('pageproxy');
	if(page==null||page.contentWindow==null)	return;
	var proxy = page.contentWindow; 
	proxy.movieOnDemand(movid);
}


var sUrl=null;
function checkClient(strUrl,mid,lid,flid,filename) {

 var issetup = ShowCookie("ppfilmsetup");
 //setcookie("url_ppfilm",sUrl,1000*60*20);
 //SetCookie("url_ppfilm",sUrl,1000*60*10,"/","pipi.cn"); 
 //var _loc=jse.playTips.getReffer(mid);
 var _loc="";
 sUrl = strUrl;
 var _temp=sUrl.split('|');
 var _t=[];
 _t.push(_temp[0]);
 _t.push("wnd=1");
 _t.push("for/chromebug");
 _t.push("surl="+_loc);
 _t.push(_temp[1]);
 sUrl=_t.join('|');
 //alert(sUrl);
   if ( issetup != "")
     {
	   //alert("有cookie");
	   SetCookie("ppfilmsetup","1",60*60*24*365,"/",""+document.domain);
	   //jse.playTips.showInfo(_loc);
       document.location=sUrl;
     } 
   else
	 {
		oWin(380,105,"w_open");
		/*if (!flag) 
		  {
          if (confirm("为了更流畅地观看高清电影，推荐您下载安装皮皮播放器。"))
			  //尊敬的用户，您需要安装皮皮播放器后才能正常的观看本网站的电影、电视剧，您是否确定下载并安装皮皮播放器？
             {
             SetCookie("url_ppfilm",sUrl,60*20,"/","pipi.cn");
             document.location="http://dl.pipi.cn/pipi.exe";
             } 
		  else 
			 {
			  if (!confirm('对不起，假如您没有安装皮皮播放器，就无法观看本网站提供的影片。\n\n如果您确认已经安装了皮皮播放器，请点击“取消”按钮。')) {
			      if (confirm("你确定本机已经安装了皮皮播放器了吗？点击“确认”将不再提示安装信息。")) {
			      		SetCookie("ppfilmsetup","1",60*60*24*365,"/",""+document.domain);
			  	        document.location=sUrl;
			      }
			  }              
             }
          }
		 else
		  {
			//alert("flag=true;没有cookie");
			//jse.playTips.showInfo(_loc);
		    document.location=sUrl;
		  }*/
       }
}

if (!pipiUtil) var pipiUtil={};

/*****************************************
广告对象格式
{
	res:"XXXXXXXXXXXXXXX",
	url:"XXXXXXXXXXXXXXX",
	showDiv:true //不要层就用false
}
*****************************************/
pipiUtil.randomShow=function(_targetDivId,_width,_height){	
	this.ads=[];	
	var _point=this;
	this._currentIndex=-1;
	this._lastIndex=-1;
	this.interval=null;
	this.time=10000;
	this._getHtmlForSwf=function(_index) {
		var _html='<div style="position:relative;width:'+_width+'px;height:'+_height+'px;display:none;z-index:1;" id='+_targetDivId+'_randomDiv_'+_index+'>';
		_html+='<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 width='+_width+' height='+_height+'  classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>';
		_html+='<PARAM NAME="Movie" VALUE="'+this.ads[_index].res+'">';
		_html+='<PARAM NAME="wmode" VALUE="opaque">';
		_html+='<PARAM NAME="Quality" VALUE="High">';
		_html+='<embed src="'+this.ads[_index].res+'" quality="high" allowscriptaccess="always" wmode="opaque" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_height+'" width="'+_width+'"></embed>';
		_html+='</OBJECT>';
		if (this.ads[_index].showDiv)
			_html+='<a target="_blank" href="'+this.ads[_index].url+'"><img src="http://www.pipi.cn/images/spacer.gif" style="position:absolute;left:0px;top:0px;width:'+_width+'px;height:'+_height+'px;border:none;"/></a>';
		_html+='</div>';
		return _html;
	};
	this._getHtmlForPic=function(_index) {
		var _html='<div style="position:relative;width:'+_width+'px;height:'+_height+'px;display:none" id='+_targetDivId+'_randomDiv_'+_index+'>';
		_html+='<img src="'+this.ads[_index].res+'" border=0 width="'+_width+'" height="'+_height+'"/>';
		_html+='<a target="_blank" href="'+this.ads[_index].url+'"><img src="http://www.pipi.cn/images/spacer.gif" style="display:block; position:absolute; left:0px; top:0px; width:'+_width+'px; height:'+_height+'px; border:none;"/></a>';
		_html+='</div>';
		return _html;
	};
	this._getHtmlForString=function(_index) {
		var _html='<div style="position:relative;width:'+_width+'px;height:'+_height+'px;display:none" id='+_targetDivId+'_randomDiv_'+_index+'>';
		_html+=this.ads[_index].res;
		_html+='</div>';
		return _html;
	};
	this._getinnerHTML=function(){
		var _html="";
		for (var i=0;i<this.ads.length;i++) {
			var _temp="";
			if (this.ads[i].res.indexOf("swf")>=0) {
				_temp=this._getHtmlForSwf(i);
			} else if (this.ads[i].res.indexOf("iframe")>=0) {
				_temp=this._getHtmlForString(i);
			} else {
				_temp=this._getHtmlForPic(i);
			}
			_html+=_temp;
		}
		return _html;
	};	
	this._getRandomIndex=function() {
		return (parseInt(this._currentIndex)+1) % this.ads.length;
		//return Math.floor(Math.random()*this.ads.length);
	};
	this._show=function() {
		if (this.ads.length==1) return; //禁止只有一个广告
		var _index=this._getRandomIndex();
		while (_index==this._currentIndex) {
			_index=this._getRandomIndex();
		}
		this._currentIndex=_index;
		if (this._lastIndex!=-1) document.getElementById(_targetDivId+'_randomDiv_'+this._lastIndex).style.display="none";
		document.getElementById(_targetDivId+'_randomDiv_'+this._currentIndex).style.display="block";
		this._lastIndex=this._currentIndex;
	};	
	this.init=function() {
		var _container=document.getElementById(_targetDivId);
		if (!_container) {
			document.write('<div id="'+_targetDivId+'"></div>');
			_container=document.getElementById(_targetDivId);
		}
		_container.innerHTML=this._getinnerHTML();
		this._show();
		this.interval=window.setInterval(function(){_point._show()},this.time);
	};
}

function cWin(id){
	document.getElementById(id).style.display="none";
}
function oWin(width,height,id){
	//var width  = 576;  //弹出框的宽度 
	//var height = 296;  //弹出框的高度 
	var obj = document.getElementById(id); 			
	obj.style.cssText="margin:0 auto;position:absolute;width:"+width+"px;height:"+height+"px;z-index:9999";
	var Position = getPosition(); 
	topadd  = (Position.height-height)/2; 
	leftadd  = (Position.width-width)/2; 
	//alert(Position.height);
	//alert(topadd);
	obj.style.top  = (Position.top  + topadd) + "px"; 
	obj.style.left  = (Position.left  + leftadd-20) + "px"; 
	window.onscroll = function (){ 
	var Position   = getPosition(); 
	obj.style.top  = (Position.top  + topadd) +"px"; 
	obj.style.left = (Position.left + leftadd-20) +"px"; 
	}; 
}
function getPosition() { 
	var top    = document.documentElement.scrollTop || document.body.scrollTop;  
	var left   = document.documentElement.scrollLeft; 
	var height = document.documentElement.clientHeight; 
	var width  = document.documentElement.clientWidth; 
	return {top:top,left:left,height:height,width:width}; 
}

function setc(id){
	SetCookie("ppfilmsetup","1",60*60*24*365,"/",""+document.domain);
	document.location=sUrl;
	cWin(id);
}

function setPlay(){
	SetCookie("ppfilmsetup","1",60*60*24*365,"/",""+document.domain);
	alert("激活成功！");
}

var _sopen="";
_sopen+='<style type="text/css">';
_sopen+='.cantshadow{ padding:5px; width:368px; background-color:#F0F0F0;}';
_sopen+='.cantinner{ border:1px solid #DFDFDF; background-color:#FFF;}';
_sopen+='.cantinner .titbar{ height:28px; line-height:28px; background:url(/images/i_pop.png) repeat-x; border-bottom:#DFDFDF;}';
_sopen+='.cantinner .titbar h3{ float:left; margin:0 10px; padding:0; font-size:12px; color:#C00;}';
_sopen+='.cantinner .titbar a.close{';
_sopen+='float:right; display:inline-block;';
_sopen+='width:16px; height:15px; text-indent:-999px; overflow:hidden;';
_sopen+='background:url(/images/i_pop.png) no-repeat 0 -45px; margin:5px 10px 0 0;}';
_sopen+='.cantinner .titbar a.close:hover{ background-position:-26px -45px;}';
_sopen+='.cantinner .boxcon{ height:60px; margin:15px;}';
_sopen+='.cantinner .boxcon li{ text-align:center; margin-bottom:20px; float:left; width:50%;}';
_sopen+='.cantinner .boxcon li p{ margin:5px 0;}';
_sopen+='.cantinner .boxcon .abtn{';
_sopen+='display:inline-block; width:100px; height:25px; text-decoration:none; color:#000;';
_sopen+='text-align:center; line-height:25px; background:url(/images/i_pop.png) no-repeat 0 -77px;}';
_sopen+='.cantinner .boxcon .abtn:hover{ color:#C00;}';
_sopen+='</style>';
_sopen+='<div class="cantshadow" id="w_open" style="display:none;">';
_sopen+='	<div class="cantinner">';
_sopen+='		<div class="titbar">';
_sopen+='			<h3>提示</h3>';
_sopen+='			<a class="close" href="javascript:cWin(\'w_open\');">关闭</a>';
_sopen+='		</div>';
_sopen+='		<ul class="boxcon">';
_sopen+='		<li><p>已安装播放器的用户请单击 </p><a class="abtn" onclick="setc(\'w_open\');" href="javascript:void(0)">激活播放器</a></li>';
_sopen+='		<li><p>新用户请先下载安装播放器 </p><a class="abtn" href="http://dl.pipi.cn/" target="_blank">立即下载</a></li>';
_sopen+='		</ul>';
_sopen+='	</div>';
_sopen+='</div>';

/*_sopen+='<style type="text/css">';
_sopen+='.cantshadow{ padding:5px; width:260px; background-color:#F0F0F0;}';
_sopen+='.cantinner{ border:1px solid #DFDFDF; background-color:#FFF;}';
_sopen+='.cantinner .titbar{ height:28px; line-height:28px; background:url(/images/i_pop.png) repeat-x; border-bottom:#DFDFDF;}';
_sopen+='.cantinner .titbar h3{ float:left; margin:0 10px; padding:0; font-size:12px; color:#C00;}';
_sopen+='.cantinner .titbar a.close{';
_sopen+='float:right; display:inline-block;';
_sopen+='width:16px; height:15px; text-indent:-999px; overflow:hidden;';
_sopen+='background:url(/images/i_pop.png) no-repeat 0 -45px; margin:5px 10px 0 0;}';
_sopen+='.cantinner .titbar a.close:hover{ background-position:-26px -45px;}';
_sopen+='.cantinner .boxcon{ margin:15px;}';
_sopen+='.cantinner .boxcon li{ margin-bottom:20px;}';
_sopen+='.cantinner .boxcon li p{ margin:5px 0;}';
_sopen+='.cantinner .boxcon .abtn{';
_sopen+='display:inline-block; width:100px; height:25px; text-decoration:none; color:#000;';
_sopen+='text-align:center; line-height:25px; background:url(/images/i_pop.png) no-repeat 0 -77px;}';
_sopen+='.cantinner .boxcon .abtn:hover{ color:#C00;}'; 
_sopen+='</style>';
_sopen+='<div class="cantshadow" id="w_open" style="display:none;">';
_sopen+='	<div class="cantinner">';
_sopen+='		<div class="titbar">';
_sopen+='			<h3>提示</h3>';
_sopen+='			<a class="close" href="javascript:cWin(\'w_open\');">关闭</a>';
_sopen+='		</div>';
_sopen+='		<ul class="boxcon">';
_sopen+='		<li><p>已安装播放器的用户请单击 </p><a class="abtn" onclick="setc(\'w_open\');" href="javascript:void(0)">已安装播放器</a></li>';
_sopen+='		<li><p>新用户请先下载安装播放器 </p><a class="abtn" href="http://dl.pipi.cn/" target="_blank">立即下载</a></li>';
_sopen+='		</ul>';
_sopen+='	</div>';
_sopen+='</div>';
*/
document.writeln(_sopen);


