String.prototype.trim=function()
 {
	return this.replace(/(^\s*)|(\s*$)/g, "");
 }
var wnd = null;
function checkWebPlay(_idx) {
	if(!checkInstallClient())return;
	var i = 0;	
	var _setWnd = function () {		
		if (i > 300) {			 
			return;
		}
		i++;
		var pipiwebplayer_control=document.getElementById("pipiwebplayer_control");
		if (!pipiwebplayer_control || !pipiwebplayer_control.strWebPlayerWndHandle || (pipiwebplayer_control.strWebPlayerWndHandle + "") == "") {
			window.setTimeout(function () {
				_setWnd();
			}, 100);
		} else 			 			
			  {
				wnd = pipiwebplayer_control.strWebPlayerWndHandle;		
				
				play("webPlay", _idx);
			}
			 
		 
	};
	_setWnd();
}



function hiddenWinFrom()
{
	  var hiddenWnd = function () {
		var _winForm=document.getElementById("winForm");
		if (!_winForm) {
			window.setTimeout(function () {
				hiddenWnd();
			}, 50);
		} else 			 			
			{
				 _winForm.style.display = 'none';
			} 
	};
	hiddenWnd();
	
}
function play(state, index) {	
	if(playIdxs.length<index)return;
	var mov_info = playIdxs[index - 1];	 
	if (state == "windowPlay") {
		checkDy("ppfilm://cmd=stream|info=" + mov_info.info,'windowPlay');
	} else {
		if (state == "webPlay") {

			checkDy("ppfilm://cmd=stream|info=" + mov_info.info,'webPlay');
		}
	}
}
function $parameter(_parameter)
{
		var sValue=window.location.search.match(new RegExp("[\?\&]"+_parameter+"=([^\&]*)(\&?)","i"));
		return sValue?sValue[1]:sValue;
}
var _idx = $parameter('a');
var _hash = window.location.hash;
/*if(_hash!=null&&_hash == '#play')
{
	if(_idx ==null || _idx.trim() =='')
	_idx = 1;
	checkWebPlay(_idx); 	  
}
else 
hiddenWinFrom();*/
try{
	document.getElementById("winForm").style.display="none";
}catch (e){}

 
if ($parameter("p")=="1") SetCookie("ppfilmsetup", "1", 60 * 60 * 24 * 365, "/", "" + document.domain);
