var g_upgrade_date="2008-06-04";
var g_kankan_version="2.0.0.166";
var g_sThunderSteup_url="http://down.sandai.net/Thunder5.8.1.510.exe";

document.domain="xunlei.com";
var G_PRELINKID=null;
var G_INTERVALID=null;
var G_ITEMS_CHAR="@@";
var G_GROUP_CHAR="|";
var G_BUILD_VERSION=0;
var G_ERROR_INFO="";
var G_DEFAULT_KEYWORD="输入片名或主演名...";
var G_REFERENCE_POINT={POINT:"iSearch",OFFSETTOP:93,OFFSETLEFT:200,PADDING:7};
var G_CLICK_STAT=new Image(1,1);
var G_51TV=16;
var G_IN_XUNLEI=parent.xunlei?true:false;
if(G_IN_XUNLEI){document.oncontextmenu = function(){return false;}}
document.documentElement.addBehavior("#default#userData");
function setUserData(key, value, iExpires){
    with(document.documentElement){
        load("XUNLEI_KANKAN");
        expires = new Date((new Date().getTime())+(iExpires*3600000)).toUTCString();
        setAttribute(key, value);
        save("XUNLEI_KANKAN");
    }
}
function getUserData(key){
    with(document.documentElement){
        load("XUNLEI_KANKAN");
        return getAttribute(key);
    }
}
function ioWriter(name,value,hours){
    if(G_BUILD_VERSION>165){
        ioCtrlWriter(name,value,hours||null);
    }else{
        if(hours){
            setCookie(name,value,hours);
        }else{
            setCookie(name,value);
        }
    }
}
function ioReader(name){
    if(G_BUILD_VERSION>165){
        return ioCtrlReader(name);
    }else{
        return getCookie(name);
    }
}
function getCookie(name){
    var search = name + "=";
    var offset = document.cookie.indexOf(search);
    if (offset != -1) {
        offset += search.length;
        var end = document.cookie.indexOf(";", offset);
        if (end == -1){
            end = document.cookie.length;
        }
        return unescape(document.cookie.substring(offset, end));
    }else {
        return "";
    }
} 
function setCookie(name,value,hours){
    if(arguments.length>2){
        var expireDate=new Date(new Date().getTime()+hours*3600000);
        document.cookie = name + "=" + escape(value) + "; path=/; domain=xunlei.com; expires=" + expireDate.toGMTString();
    }else{
        document.cookie = name + "=" + escape(value) + "; path=/; domain=xunlei.com"; 
    }
}
function ioCtrlWriter(key, value, expires){
    var player = new ActiveXObject("PPlayer.XPPlayer");
    var iExpire = expires || 720;
    player.Put("sCookieFileName", key+".dat");
    player.Put("sCookie", value+"\n*\n"+((new Date().getTime()) + iExpire * 3600000));
}
function ioCtrlReader(key){
    var player = new ActiveXObject("PPlayer.XPPlayer");
    var sCookie = null;
    var value = null;
    player.Put("sCookieFileName", key+".dat");
    sCookie = player.Get("sCookie")||null;
    if(null != sCookie){
        value = ioCtrlCheck(sCookie);
    }
    return value || "";
    function ioCtrlCheck(sCookie){
        var items = sCookie.split("\n*\n");
        var curDate = expires = 0;
        var value = null;
        if(items.length != 2){return null;}
        value = ""==items[0]?null:items[0];
        expires = parseInt(items[1], 10);
        curDate = new Date().getTime();
        if(curDate > expires){
            return null;
        }else{
            return value;
        }
    }
}
String.prototype.trim = function(){
	return this.replace(/\s+/gm,"");
}
String.prototype.lTrim = function(){
    return this.replace(/^\s+/gm,"");
}
String.prototype.rTrim = function(){
    return this.replace(/\s+$/gm,"");
}
String.prototype.size = function(){
    return this.replace(/[^\u0000-\u00FF]/gmi, "**").length;
}
String.prototype.toHTMLString = function(){
    var s = this.replace(/&#39;/gmi, "'");
    return s;
}
String.prototype.toEntityString = function(){
    var s = this.replace(/\'/gmi, "&#39;");
    return s;
}
String.prototype.appendESC = function(tar){
    var regExp = new RegExp(tar,"gm");
    return this.replace(regExp, "\\"+tar);
}
function $(s){   
	return document.getElementById(s);
}
function $C(tagName){
	return document.createElement(tagName);
}
function $P(child,parent){
	return parent?parent.appendChild(child):document.body.appendChild(child);
}
function $R(child,parent){
	return parent?parent.removeChild(child):document.body.removeChild(child);
}
function getPosition(o){
	var p={Top:0,Left:0};
	while(!!o){
		p.Top+=o.offsetTop;
		p.Left+=o.offsetLeft;
		o=o.offsetParent;
	}
	return p;
}
function copyToClip(t){
	if (window.clipboardData){
		window.clipboardData.setData("Text", t);
	}else if (window.netscape){
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) {return;}
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) {return;}
		trans.addDataFlavor('text/unicode');
		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);		
		var copytext=t;
		str.data=copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid=Components.interfaces.nsIClipboard;
		if (!clip) {return false;}
		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
	return;
}
function getCacheTime(){
	return (new Date()).getTime();
}
function setHome(){
	if (document.all){
		$("homePage").setHomePage("http://kankan.xunlei.com");
	}else if(window.sidebar){
		window.sidebar.addPanel("迅雷看看--中国最高清的在线影院", "http://kankan.xunlei.com", "");	
	}
}
function getParameter(name){
    var querystring = document.location.search;    
    var items = [], item = [];
    var size = 0;
    querystring = querystring.substring(1);
    items = querystring.split("&");
    size = items.length;
    for (var i = 0; i < size; i++){
        item = items[i].split("=");
        if(item.length > 1 && name == item[0]){
            return item[1];
        }
    }
    return null;
}
function replaceScript(s) {
	if(typeof(s)=='string'){
		s=s.replace(/&#(\d+);?/g,function(a,b){return String.fromCharCode(b)}).replace(/&#x(\d+);?/ig,function(a,b){return String.fromCharCode(parseInt(b,16))}).replace(/(\Won)(\w+\s*=)/ig,"$1<wbr>$2").replace(/(\Wexpres)(sion\()/ig,"$1<wbr>$2").replace(/(\Wbehav)(ior\s*:)/ig,"$1<wbr>$2").replace(/(obj)(ect)/ig,"$1<wbr>$2").replace(/(scr)(ipt)/ig,"$1<wbr>$2").replace(/(emb)(ed)/ig,"$1<wbr>$2").replace(/\r\n/g,"bbrr").replace(/\t/g," &nbsp; &nbsp;");}
	return s;
}
function replaceHtmlTag(s){
	if(typeof(s)=="string"){s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");}
	return s;
}
function getUserInfo(){
	return getCookie('sessionid');	
}
function iKeyword(obj,type){
    switch(type){
        case 1:
            if(obj.value==G_DEFAULT_KEYWORD){obj.value="";}
            obj.style.cssText="color:black";
            break;
        case 2:
            if(""==obj.value){
                obj.value=G_DEFAULT_KEYWORD;
                obj.style.cssText="";
            }else{
                obj.style.cssText="color:black";
            }
        break;
    }
}
function checkKeyword(f){
    var k=(f.elements["keyword"].value).replace(/[\']/g,"");
    f.elements["keyword"].value = k;
    if(G_DEFAULT_KEYWORD==k||""==k){
        alert("请输入影片名或主演名");
        return false;
    }
    f.elements["page"].value = 1;
    return true;
}
function showUploadBox(){
	if(getUserInfo()){
		var sHTML='<iframe src="/upload.html" border=0 width="500" height="220" frameborder=0 style="margin:5px;" scrolling="no"></iframe>';
		showDailogBox('上传视频',sHTML,true,520,272,250);
	}else{
		showLogin('SHOWUPLOADWINDOW');
	}
}
function showProvideVedio(){
    if(getUserInfo()){
		showDailogBox('我来供片',uploadString(""),true,640,222,200);
	}else{
		showLogin('SHOWPROVIDEWINDOW');
	}
}
function uploadString(keyword){
    var str='<div id="uploadForm"><form name="nf" method="post" action="http://fx.xunlei.com/cgi-bin/upload/cgi_upload_add"><input type="hidden" name="keyword" id="ufKeyword" value="'+keyword+'" /><input type="hidden" name="u1" id="u1" /><ul>';
    if(getUserInfo()){        
        str+='<input type="hidden" name="u" id="username" value="'+getCookie("usrname")+'" /><input type="hidden" name="p" id="password" value="" />';
    }else{
        str+='<li><label for="username">用&nbsp;户&nbsp;名：<input name="u" id="username" type="text" /></label><label for="password">密&nbsp;&nbsp;&nbsp;&nbsp;码：<input name="p" id="password" type="password" /></label></li>';
    }
    str+='<li><label for="filename">影片名称：<input name="name" id="filename" type="text" value="'+keyword+'" /></label></li>';
    str+='<li><label for="url">下载地址：<input name="url" id="url" type="text" /></label><span>提示：输入可下载的URL</span></li>';
    str+='<li><label for="annexcode">验&nbsp;证&nbsp;码：<input name="verifycode" id="annexcode" type="text" /><img id="upverifycode" src="http://verify.xunlei.com/image?cachetime='+getCacheTime()+' border="0" align="absmiddle" /></label>&nbsp;<a href="javascript:changeAnnexCode();">看不清？</a></li>';
    str+='<li><label for="sure"><input name="" id="sure" type="button" value="提 交" onclick="checkUploadForm(this.form)" /></label><label for="reset"><input name="" id="reset" type="reset" value="重 置" /></label></li>';
    str+='</ul></form></div>';
    return str;
}
function changeAnnexCode(){
    $('upverifycode').src='http://verify.xunlei.com/image?cachetime='+getCacheTime();
}
function checkUploadForm(f){
    var usr=$("username").value;    
    var fn=$("filename").value;
    var url=$("url").value;
    var ac=$("annexcode").value;
    var pwd=$("password").value;
    var kw=$("ufKeyword").value;
    if(!getUserInfo()){
        if(""==usr.trim()){
            alert("请输入用户名");
            return;
        }
        if(""==pwd.trim()){
            alert("请输入密码");
            return;
        }
    }
    if(""==fn.trim()){
        alert("请输入影片名称");
        return;
    }
    if(""==url.trim()){
        alert("请输入影片下载地址");
        return;
    }
    if(""==ac.trim()){
        alert("请输入验证码");
        return;
    }
    logForClick("KI");
    if(""==kw){$("ufKeyword").value=fn;}
    if(getUserInfo()){
        dealUpFrmLogin(f,false);
    }else{
        upFrmLogin(f);
    }
}
function upFrmLogin(f){
	var ifr;
	$P(ifr=$C('<iframe name="upFrmIfr" style="display:none">'));
	ifr.attachEvent('onload',function(){dealUpFrmLogin(f,true);$R(ifr);});
	f.action='http://login.xunlei.com/bloglogin/';
    f.target="upFrmIfr";
	f.submit();
}
function cccc(){
    if($("uploadFormPos") && $("ufKeyword")){
        $("uploadFormPos").innerHTML=uploadString($("ufKeyword").value);
    }
}
function dealUpFrmLogin(f,b){
    if(getUserInfo()){
        if(b){drawHeader();}
        var ifr;
        $P(ifr=$C('<iframe name="dealUpIfr" style="display:none">'));
        ifr.attachEvent("onload",function(){
            var f=0;
            try{
                var result = ifr.contentWindow.result;
                f=result;
                if(1==result){
                    alert("非常感谢您为“看看”贡献此片,如果这个片源是最棒的,您的大名将会出现在该影片的播放页面上。");
                }else{
                    if(-4==result){
                        alert("验证码错误");                        
                    }else{
                        alert("对不起，提交失败。请重试！");
                    }
                }
            }catch(e){
                alert("对不起,提交失败,请重试");
            }
            if(-4==f){
                $("annexcode").value="";
                changeAnnexCode();
            }else{
                cccc();
                try{hideDailogBox();}catch(e){}
            }
            $R(ifr);
        });
        f.action="http://fx.xunlei.com/cgi-bin/upload/cgi_upload_add";
        f.target="dealUpIfr";
        f.submit();
    }else{
        switch(getCookie("blogresult")){
            case '1':
                alert("验证码错误");
                break;
            case '2':
                $("password").value = "";
                alert("用户名或密码错误");
                break;
            default:
                alert("登录失败");
        }
        $("annexcode").value = "";
        changeAnnexCode();
        return;
    }
}
function drawHeader(){
    var ipv='';//($("uploadFormPos") && $("ufKeyword"))?'':' | <a href="javascript:_GV()">我来供片</a>';
    var cStr=' | <a href="javascript:_GU()">上传视频</a>'+ipv+' | <a href="http://bbs.xunlei.com/forum-46-1.html" onclick=logForClick("KF") target="_blank">论坛</a> | <a href="http://bbs.xunlei.com/viewthread.php?tid=1490876" target="_blank" onclick=logForClick("KG") >帮助</a>';
    var logout='您尚未登录，请<a href="javascript:_GS()" class="mark">登录</a> | <a href="http://i.xunlei.com/register/register.htm" onclick=logForClick("KD") target="_blank">注册</a>'+cStr;
    if(getUserInfo()){        
		var sUrsName=getCookie("usrname");
        var sNickName=getCookie("nickname") || sUrsName;
        var login='欢迎您，<a class="mark">'+sNickName+'</a><a href="http://vip.xunlei.com" target="_blank" id="vip_icon" style="display:none; font-weight:bold; color:red;">(vip)</a> <a href="javascript:logout()">退出</a> <!--<a>我的视频(0)</a> --><a href="http://'+sUrsName+'.blog.xunlei.com" target="_blank">我的收藏(<span id="myCollection">0</span>)</a>'+cStr;
        $("nav_div").innerHTML=login;
        var ifr_checkVip=$C('<iframe width=0 height=0>');
        $P(ifr_checkVip);
		ifr_checkVip.src="http://dynamic.kankan.xunlei.com/cgi-bin/cgi_check_info?catchtime="+getCacheTime();
        ifr_checkVip.attachEvent("onload",function(){
			if(ifr_checkVip.contentWindow.vip==1){
				$("vip_icon").style.display='inline';
			}else{
				$("vip_icon").style.display='none';
			}
			$R(ifr_checkVip);
		});
		getCollectionNum(sUrsName);
    }else{
	    $("nav_div").innerHTML=logout;
    }
    if(document.forms[0].elements["keyword"].value!=G_DEFAULT_KEYWORD){document.forms[0].elements["keyword"].style.cssText="color:black;";}
}
function getCollectionNum(usrName){
	var ifr_getHash=$C('<iframe width=0 height=0>');
    $P(ifr_getHash);
	ifr_getHash.src='http://blogmain.xunlei.com/bridge/';
	ifr_getHash.attachEvent("onload",function(){
		var url = "http://blogmain.xunlei.com/hash/"+usrName;
		ifr_getHash.contentWindow.makeRequest(url,{
			response: "JSON",
			bridge: "/bridge/",
			onSuccess: function(e){
				var o=e.response;
				var xmlurl='http://t'+o.dist+'.bstatic.xunlei.com/'+o.parent_dir+'/'+o.child_dir+'/'+usrName+'/kankan.xml?catchTime='+getCacheTime();
				var ifr_getXML=$C('<iframe width=0 height=0>');
				$P(ifr_getXML);
				ifr_getXML.src='http://t'+o.dist+'.bstatic.xunlei.com/web/bridge.htm';
				ifr_getXML.attachEvent("onload",function(){
					ifr_getXML.contentWindow.makeRequest(xmlurl,{
						response: "Object",
						bridge: "/bridge/",
						onSuccess: function(e){
							setCollectionNum(e.response.total_number);
						},
						events:[]
					});
				$R(ifr_getXML);
				});
			},
			events:[]
		});
		$R(ifr_getHash);
		function setCollectionNum(i){
			$('myCollection').innerHTML = i;
		}
	});	
}
function getWindowSize(){
	return {Width:Math.max(document.body.scrollWidth,document.documentElement.clientWidth),Height:Math.max(document.body.scrollHeight,document.documentElement.clientHeight)};
}
function getClientSize(){
    return {width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};
}
function checkKankanVersion(sVersion,sn){
	if(sVersion==0||sVersion==-1||sVersion==-2) {return false;}
	return parseInt(sVersion.split(".")[3])>(!sn?23:sn)?true:false;
}
function setHotLevel(time,isnew){
	if(isnew==1&&time<10000){
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l2"></li><li class="l5"></li><li class="l5"></li></ul>';
	}if(isnew==2){
        return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l2"></li><li class="l3"></li><li class="l4"></li></ul>';
    }if(time<5000){
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l5"></li><li class="l5"></li><li class="l5"></li><li class="l5"></li></ul>';
	}else if(time<10000){
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l5"></li><li class="l5"></li><li class="l5"></li></ul>';
	}else if(time<15000){
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l2"></li><li class="l5"></li><li class="l5"></li></ul>';
	}else if(time<20000){
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l2"></li><li class="l3"></li><li class="l5"></li></ul>';
	}else{
		return '<ul title="影片热度" class="point"><li class="l0"></li><li class="l1"></li><li class="l2"></li><li class="l3"></li><li class="l4"></li></ul>';
	}
}
function confirmDownKankan(){
	if(window.confirm("您没有安装最新版“迅雷5”,点击确定进行下载")){
		window.open(g_sThunderSteup_url);
	}
}
function hidePlayer(){
	if($('divKankanPlayerBox')){
		$('divKankanPlayerBox').style.left='-1000px';
	}
}
function displayPlayer(){
	if($('divKankanPlayerBox')){
		$('divKankanPlayerBox').style.left='0px';
	}else if(parent.document.getElementById("divKankanPlayerBox")){
        parent.document.getElementById("divKankanPlayerBox").style.left="0px";
    }
}
function LoadingEffect(obj){
    function e(){
      var ef = document.createElement("<div id=\"loadingEffectForm\" style=\"width:200px;height:13px;\">");
      ef.innerHTML = '<div style="width:13px; height:13px; float:left;"><div id="__leitem1" style="left:7px;width:2px;position:relative;top:0px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem2" style="left:10px;width:2px;position:relative;top:1px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem3" style="left:10px;width:2px;position:relative;top:3px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem4" style="left:7px;width:2px;position:relative;top:4px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem5" style="left:3px;width:2px;position:relative;top:2px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem6" style="left:0px;width:2px;position:relative;top:-3px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem7" style="left:0px;width:2px;position:relative;top:-9px;height:2px;background-color:#EEEEEE;font-size:0px;"></div><div id="__leitem8" style="left:3px;width:2px;position:relative;top:-14px;height:2px;background-color:#EEEEEE;font-size:0px;"></div></div><div style="flaot:right;width:180px;font-size:12px; text-align:center;padding-top:1px;">数据载入中...请稍候...<a href="javascript:flIframe.document.location.reload();" style="color:#72AFF3;">刷新</a></div><div id="__oper"></div>';
      return ef;
    }
    function setColor(index, color){
      document.getElementById("__leitem"+index).style.backgroundColor = color;
    }
    function setEffect(){
      if(index > 8){index = 1;}
      if(count > 16){count = 1;}
      if(count < 9){
        setColor(index, "#72AFF3");
      }else{
        setColor(index, "#EEEEEE");
      }
      index++;
      count++;
    }
    var index=1;
    var count=1;
    if(null==$("loadingEffectForm")){
        obj.appendChild(e());
    }else{
        for(var i=1;i<9;i++){
            setColor(i, "#EEEEEE");
        }
    }
    if(obj){obj.style.display="block";}
    setEffect();
    G_INTERVALID = setInterval(setEffect, 80);
}
function jumpTop(){
    window.scroll(0,0);
}
function createFloatLayer(url,type,width,height,obj){
    var loading=flHeader=maskRight=maskTop=maskLeft=maskMiddle=null;
    var flpanel=$("flPanel");
    var ifr=$("flIframe");
    var tips=$("flTips");
    var ftip=$("divFloatTips");    
    var jtop=$("flJumpTop");
    var flShadow=$("flShadow");
    if(null==flpanel){
        maskRight=$C('<div id="flMaskRight">');   
        maskTop=$C('<div id="flMaskTop">');
        maskLeft=$C('<div id="flMaskLeft">');
        maskMiddle=$C('<div id="flMaskMiddle">');
        flpanel=$C('<div id="flPanel" class="layertitle" style="position:absolute;z-index:100px;overflow:hidden;background-color:white;left:0px;top:0px;display:none;width:'+width+'px;height:'+height+'px;margin:0px;padding:0px;">');
        flHeader=$C('<div id="flHeader" class="tab" style="background-color:#FFFFFF">');
        flShadow=$C('<div id="flShadow" style="position:absolute;left:0px;top:0px;width:0px;height:0px;background-color:#808080;">');
        ifr=$C('<iframe id="flIframe" stat="" text="" ifrType="0" name="flIframe" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" width="100%" height="100%" scrolling="no">');
        tips=$C('<span id="flTips">');
        loading=$C('<div id="flLoading" style="position:absolute;z-index:999px;width:740px;left:0px;top:120px;display:none;padding:3px;text-align:center;color:#999999;">');
        jtop=$C('<div id="flJumpTop" style="position:absolute;color:#1974C7;left:0px;top:0px;display:none;cursor:pointer;">');
        $P(maskRight); $P(maskTop); $P(maskLeft); $P(maskMiddle); $P(flHeader,flpanel); $P(ifr,flpanel); $P(flShadow); $P(flpanel); $P(tips);$P(loading);$P(jtop);
        jtop.innerHTML="↑回到顶部";
        jtop.attachEvent("onclick",jumpTop);
    }
    insertHeader(url,type,obj);
    if(null==ftip){
        tips.innerHTML=getFloatTipString();
    }
    setFloatLayerStyle();
    window.attachEvent("onresize",resized);
    return {panel:flpanel,shadow:flShadow, iframe:ifr, jTop:jtop};
}
function insertHeader(url,type,obj){
    var flHeader=$("flHeader");
    if(type!=4){
        var close=$C('<a class="close" title="关闭" onclick="hiddenFloatLayer()" href="javascript://">');
        $P(document.createTextNode("关闭"),close);
        flHeader.innerHTML="";
        flHeader.appendChild(createFloatLayerHeader(url,type,obj));
        flHeader.appendChild(close);
    }else{
        flHeader.innerHTML="";
        flHeader.appendChild(createFloatLayerHeader(url,type,obj));
    }
}
function setSelected(id){
    $("float_hot").className="";
    $("float_upload").className="";
    $("float_year").className="";
    $("float_"+id).className="selected";
}
function createLabel(url,stype){
    var dirs=url.split("/");
    dirs[dirs.length-2]=stype;
    var li=$C('<li id="float_'+stype+'" '+ (stype=='hot'?' class="selected"':'') +' onclick="setSelected(\''+stype+'\')">');
    var a=$C('<a href="'+dirs.join("/")+'" target="flIframe">');
    switch(stype){
        case "hot":$P(document.createTextNode("按影片人气"),a);break;
        case "upload":$P(document.createTextNode("按最近更新"),a);break;
        case "year":$P(document.createTextNode("按上映时间"),a);break;
        default: return null;
    }
    $P(a,li);
    return li;
}
function createLiveLabel(){
    var li=$C('<li id="float_all" class="selected">');
    var a=$C('<a>');
    $P(document.createTextNode("全部频道"),a);
    $P(a,li);
    return li;
}
function createFloatLayerHeader(url,type,obj){
    var subject=$C('<span id="flSubject">');
    var ul=$C('<ul>'); 
    var t='';
    $("flHeader").style.height="23px";
    if(type==1 || type==8){
        $P(createLabel(url,"hot"),ul);$P(createLabel(url,"upload"),ul);$P(createLabel(url,"year"),ul);
        return ul;
    }else if(type==2){
        subject.className="ltitle";
        subject.innerHTML="榜单家族";
    }else if(type==3){
        subject.innerHTML="";
    }else if(type==4){
        $("flHeader").style.height="30px";
        $("flHeader").innerHTML='<h2 id="floatbanner" class="brand"><a id="floatbannerLink" class="brandSubject" href="javascript:void(0);" onclick="logForClick(\'MJ\')"></a><a id="floatbannerClose" href="javascript://" onclick="hiddenFloatLayer()" class="close">关闭</a></h2>';
    }else if(type==6){
        $P(createLiveLabel(),ul);
        return ul;
    }else{
        subject.className="ctitle";
        subject.innerHTML=obj.firstChild.nodeValue;
    }
    $("flHeader").style.backgroundColor="#EEF7FE";
    return subject;
}
function getFloatTipString(){
    var str='<div id="divFloatTips" style="z-index:1000;display:none;filter:progid:DXImageTransform.Microsoft.fade(duration=2,overlap=0.25);"><div class="bodytext"><b>关闭浮层列表</b><br />浮层列表是为了让您更方便的找到您想要更换的影片，点击关闭退出<br><a  href="javascript:hiddenTips();">好的，我已了解</a></div></div>';
    return str;
}
function hiddenTips(){
    ioWriter("firstUse","false",720);
    $("divFloatTips").style.display="none";
}
function resized(){
    resetPosition();
}
function hiddenFloatLayer(){
    var maskRight=$("flMaskRight")||parent.document.getElementById("flMaskRight");
    var maskTop=$("flMaskTop")||parent.document.getElementById("flMaskTop");
    var maskLeft=$("flMaskLeft")||parent.document.getElementById("flMaskLeft");
    var maskMiddle=$("flMaskMiddle")||parent.document.getElementById("flMaskMiddle");
    var panel=$("flPanel")||parent.document.getElementById("flPanel");
    var ifr=$("flIframe")||parent.document.getElementById("flIframe")
    var shadow=$("flShadow")||parent.document.getElementById("flShadow");
    var flTips=$("divFloatTips")||parent.document.getElementById("divFloatTips");
    var loading=$("flLoading")||parent.document.getElementById("flLoading");
    var jtop=$("flJumpTop")||parent.document.getElementById("flJumpTop");
    if(ifr){ifr.src="about:blank";}
    if(panel){panel.style.display="none";}
    if(maskRight){maskRight.style.display="none";}
    if(maskTop){maskTop.style.display="none";}
    if(maskLeft){maskLeft.style.display="none";}
    if(maskMiddle){maskMiddle.style.display="none";}
    if(flTips){flTips.style.display="none";}
    if(shadow){shadow.style.display="none";}
    if(loading){loading.style.display="none";}
    if(jtop){jtop.style.display="none";}
    displayPlayer(); 
    window.detachEvent("onresize",resized);
}
function setFloatLayerStyle(){
    var screen=getWindowSize();
    var posLeft=getPosition($(G_REFERENCE_POINT.POINT)).Left;
    var topHeight=Math.max(getPosition($(G_REFERENCE_POINT.POINT)).Top,G_REFERENCE_POINT.OFFSETTOP);
    var posTop=getPosition($("_temp")).Top;
    var offset=posLeft+G_REFERENCE_POINT.OFFSETLEFT;
    var filter="position:absolute;display:block;background-color:#000000;filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=35,finishOpacity=35);";
    $("flMaskRight").style.cssText="left:"+offset+"px;top:"+topHeight+"px;width:"+(screen.Width-offset)+"px;height:"+(screen.Height-topHeight)+"px;"+filter;
    $("flMaskTop").style.cssText="left:0px;top:0px;width:"+screen.Width+"px;height:"+topHeight+"px;"+filter;
    $("flMaskLeft").style.cssText="left:0px;top:"+topHeight+"px;width:"+posLeft+"px;height:"+(screen.Height-topHeight)+"px;"+filter;
    $("flMaskMiddle").style.cssText="left:"+posLeft+"px;top:"+(posTop-7)+"px;width:"+G_REFERENCE_POINT.OFFSETLEFT+"px;height:"+(screen.Height-posTop+7 + (topHeight - G_REFERENCE_POINT.OFFSETTOP))+"px;"+filter;
    $("flLoading").style.left=(offset+10)+"px";
    $("flLoading").style.top=((topHeight-G_REFERENCE_POINT.OFFSETTOP)+120)+"px";
    $("flShadow").style.display="block";
}
function resetMaskSize(offset){
    if($("flMaskRight")){
        var screen=getWindowSize();
        var posLeft=getPosition($(G_REFERENCE_POINT.POINT)).Left;
        var topHeight=Math.max(getPosition($(G_REFERENCE_POINT.POINT)).Top,G_REFERENCE_POINT.OFFSETTOP);
        var posTop=getPosition($("_temp")).Top;
        with($("flMaskRight")){
            style.left=offset+"px"; style.width=(screen.Width-offset)+"px"; style.height=(screen.Height-G_REFERENCE_POINT.OFFSETTOP)+"px";
        }
        $("flMaskTop").style.width=screen.Width+"px";
        $("flMaskLeft").style.width=(offset-G_REFERENCE_POINT.OFFSETLEFT)+"px";
        $("flMaskLeft").style.height=(screen.Height-G_REFERENCE_POINT.OFFSETTOP)+"px";
        $("flMaskMiddle").style.height=(screen.Height-posTop+7 + (topHeight - G_REFERENCE_POINT.OFFSETTOP))+"px";
        $("flMaskMiddle").style.left=posLeft+"px";
    }
}
function autoIncreaseSize(layer, iframe, shadow,jtop, link, maxWidth,maxHeight,left,top,cb){
    var w=0,h=0;
    var p=(maxWidth/maxHeight).toFixed(2);
    var tmpWidth=100;
    var tmpHeight=Math.ceil(tmpWidth/p);
    var interval = null;
    var a=false,b=false;    
    if($(G_PRELINKID) && G_PRELINKID!=link){$(G_PRELINKID).style.cssText="";}
    G_PRELINKID=link;
    iframe.src = "about:blank";
    layer.style.width="0px";layer.style.height="0px";
    iframe.width=maxWidth;iframe.height=maxHeight;
    shadow.style.width="0px";shadow.style.height="0px";
    layer.style.left=left+"px";layer.style.top=top+"px";
    jtop.style.left=(left+maxWidth-65)+"px";jtop.style.top=(top+maxHeight-16)+"px";
    layer.style.display="block";
    interval = setInterval(setSize, 1);       
    function setSize(){
        if(parseInt(layer.style.width) < maxWidth){
            layer.style.width = Math.min((tmpWidth+parseInt(layer.style.width)),maxWidth)+"px";
        }else{a=true;}
        if(parseInt(layer.style.height) < maxHeight){
            layer.style.height = Math.min((tmpHeight+parseInt(layer.style.height)),maxHeight)+"px";
        }else{b=true;}
        tmpWidth+=100;
        tmpHeight=Math.ceil(tmpWidth/p);
        if(a && b){clearInterval(interval);LoadingEffect($("flLoading"));cb();resized();}
    }
}
function setIframeAttribute(obj,s,type,o,u,a,w,h,l,t,d){
    autoIncreaseSize(o.panel,o.iframe,o.shadow,o.jTop,a,w,h,l,t,callback);
    function callback(){
        insertHeader(u,type,obj);
        with(o.iframe){width=w;height=h;stat=s;text=obj.firstChild.nodeValue;ifrType=type;onreadystatechange=function(){floatLayerStartInit(o.iframe);};src=u;}
        with(o.panel){style.width=w+"px"; style.height=h+"px"; style.left=l+"px"; style.top=t+"px"; style.display=d;}
        with(o.shadow){style.width=(w+2)+"px"; style.height=(h+2)+"px"; style.left=(l+4)+"px"; style.top=(t+4)+"px";}
        with(o.jTop){style.left=(l+w-65)+"px";style.top=(t+h-16)+"px";style.display=d;}
        if(ioReader("firstUse")!="false"){
            setTimeout(function(){
                var topHeight=(Math.max(getPosition($(G_REFERENCE_POINT.POINT)).Top,G_REFERENCE_POINT.OFFSETTOP)-G_REFERENCE_POINT.OFFSETTOP) + 8;
                with($("divFloatTips")){
                    style.left=(l+(w-200))+"px"; style.top=topHeight+"px"; style.display="block"; filters[0].apply(); filters[0].play();
                }
            },50);   
        }
    }
}
function resetPosition(){
    if($("flPanel")){
        var pos = getPosition($(G_REFERENCE_POINT.POINT));
        var padding=G_REFERENCE_POINT.OFFSETLEFT+G_REFERENCE_POINT.PADDING;
        resetMaskSize(pos.Left+G_REFERENCE_POINT.OFFSETLEFT);
        with($("flPanel")){style.left=(pos.Left+padding)+"px";style.top=pos.Top+"px";}
        with($("flShadow")){style.left=(pos.Left+padding+4)+"px";style.top=(pos.Top+4)+"px";}
        with($("flJumpTop")){style.left=(pos.Left+padding+parseInt($("flPanel").style.width,10)-65)+"px";}
        $("divFloatTips").style.left=(pos.Left+padding+(parseInt($("flPanel").style.width,10)-200))+"px";
    }
}
function floatLayerStartInit(obj){
    if(obj.readyState == "loaded" || obj.readyState == "interactive"){
        if(null!=G_INTERVALID){clearInterval(G_INTERVALID);}
        $("flLoading").style.display="none";
    }
}
function setFloatLayerURL(obj,s,url,type){    
    var pos = getPosition($(G_REFERENCE_POINT.POINT));
    var id = null;
    var w=692,h=920;    
    if(3==type||2==type){h=530;}else if(4==type){h=702;}else if(5==type){h=770;}else{h=920;}
    if(obj){obj.style.cssText="font-weight:bold;color:black;";id=obj.id;} 
    var ifr = createFloatLayer(url,type,w,h,obj);
    ifr.iframe.src="about:blank";
    setIframeAttribute(obj,s,type,ifr,url,id,w,h,(pos.Left+G_REFERENCE_POINT.OFFSETLEFT+G_REFERENCE_POINT.PADDING),pos.Top,"block");
}
function showLogin(url){
	var sHTML='<div id="login" class="bodybox" style="width:520px; height:358px;"><p><img src="/img/login_icon1.gif"/>为了感谢雷友对迅雷看看的支持，VIP特权升级啦，还有免费会员体验活动！<em><a href="javascript:;" onclick="window.open(\'http://vip.xunlei.com/\')">查看</a></em></p><div class="d1"><ul><li><span>迅雷帐号：</span><input name="u" id="u" type="text" size="18" style="color:#666666; border:1px #cccccc solid;" onkeydown="if(event.keyCode==13) submitbtn.click();" tabindex="1"/></li><li><span>密    码：</span><input name="p" id="p" tabindex="1" type="password" size="18" style="color:#666666;border:1px #cccccc solid;" onkeydown="if(event.keyCode==13) submitbtn.click();" /></li><li class="p1"><span>验证图片：</span><span id="imgVerifycode"></span><a href="javascript:changeVerify();" >看不清,换一个 </a></li><li><span>附加字符：</span><input name="verifycode2" id="verifycode" tabindex="1" type="text" style="color:#666666;border:1px #cccccc solid;" size="12" maxlength="4" onkeydown="if(event.keyCode==13) submitbtn.click();" /></li><li><span>&nbsp;</span>请输入上图中字符，大小写忽略</li><li><span>&nbsp;</span><button name="submitbtn" tabindex="1" id="submitbtn" type="button" value="" onclick=Login("'+url+'") >登　陆</button><button style="margin-left:20px;" onclick=window.open("http://i.xunlei.com/register/register.htm")>注　册</button></li></ul></div><div class="d2"><ul><li><img src="/img/login_icon2.gif" /><a>登录后您可以：</a></li><li>| 收藏影片，在迅雷BLOG中与他人分享！</li><li>| 观看VIP影片，需先开通VIP！<input type="hidden" name="u1" id="u1" value="" /></li></ul></div><div class="clear"></div></div>';
	showDailogBox('请您登录',sHTML,true,522,383,360);	
	$("u").focus();
	$("imgVerifycode").innerHTML = '<img id="verify_code_pic" src="http://verify.xunlei.com/image?cachetime='+getCacheTime()+'" />';
}
function checkStatus(url,pay){
	if(getUserInfo()){
		drawHeader();
		hideDailogBox();
		$("u").value="";
		$("p").value="";
		$("verifycode").value="";
		changeVerify();
		if(url=='SHOWUPLOADWINDOW'){
			showUploadBox();
		}else if(url=='SHOWPROVIDEWINDOW'){
            showProvideVedio();
        }else if(url=='VIP'){
			watchVIPMovie();
		}
	}else{
		checkRet();
		changeVerify();
	}
}
function Login(url,pay){
	var v = validateInput();
	if(!v) {
		return;
	}
	var ifr;
	$P(ifr=$C('<iframe name="login_submit_iframe" style="display:none">'));
	ifr.attachEvent('onload',function(){checkStatus(url,pay);$R(ifr);});
	collectDataByArray(v);
	$('frLogin').action='http://login.xunlei.com/bloglogin/';
	$('frLogin').submit();
	$R($('frLogin'));
}
function logout(){
	setCookie("sessionid","");
	setCookie("usrname","");
	setCookie("nickname","");
	setCookie("score","");
	setCookie("order","");
	drawHeader();
    cccc();
}
function checkRet(){
	switch(getCookie("blogresult")){
		case '0':
			alert("登录成功");
			break;
		case '1':
			alert("验证码错误");
			$("verifycode").value = "";
			break;
		case '2':
			$("p").value = "";
			$("verifycode").value = "";
			alert("用户名或密码错误");
			break;
		default:
			alert("登录失败");
	}
}
function validateInput(){
	var u1 = $("u1");
	var u = $("u");
	var p = $("p");
	var v = $("verifycode");
	var aId=[u1,u,p,v];
	var aInput=[];
	if(u.value.length==0){
		alert("请您输入用户名!");
		return false;	
	}
	if(p.value.length==0){
		alert("请您输入密码!");
		return false;	
	}
	if(v.value.length==0){
		alert("请您输入验证码!");
		return false;
	}
	for(var i=0;i<aId.length;i++){
		aInput.push({id:aId[i].id,name:aId[i].id,value:aId[i].value});
	}
	return aInput;
}
function collectDataByArray(arr){
	var myForm = $C("<form id='frLogin' action='' method='post' style='display:none' target='login_submit_iframe'/>");
	var l = arr.length;
	for(var i=0;i<l;i++){
		if(arr[i].id.indexOf("@")!=-1){
			myForm.innerHTML+='<textarea name="'+arr[i].id.split("@")[0]+'">'+replaceScript(replaceHtmlTag(arr[i].value))+'</textarea>';
		}else{
			myForm.innerHTML+='<input type=text name="'+arr[i].id+'" value="'+replaceScript(replaceHtmlTag(arr[i].value))+'" />';
		}
	}
	$P(myForm);
}
function changeVerify(){
	$("verify_code_pic").src="http://verify.xunlei.com/image?cachetime=" + getCacheTime();
}
function openAndLog(u,s){
	logForClick(s);
	window.open(u);
}
function logForClick(s){
    G_CLICK_STAT.src="http://statis.kankan.xunlei.com/fcg-bin/cgi_click_statis.fcg?Log4Click="+encodeURIComponent(s)+"&cachetime="+getCacheTime();
}
function preCheckVersion(){
    var dCtrl = new ActiveXObject("DapCtrl.DapCtrl");
    var ver=dCtrl.Get("iVersion");
    var tver=dCtrl.Get("iTVBuild");
    var __is = (ver>=201052) && (tver >=510);
    dCtrl = null;
    return __is;
}
function openWinPlay(movieid,subid,cp,ext){
    var id=getParameter("id")?"&id="+getParameter("id"):"";
    var u=getParameter("u")?"&u="+getParameter("u"):"";
    var sid=subid?"&subid="+subid:"";
    var flag=("undefined" != typeof(G_PREVIEW_FLAG) && "1" == G_PREVIEW_FLAG)?"&tno="+G_PREVIEW_FLAG:"";
    var _ext=ext?"&pt="+ext:"";
    var win=null;
    var url="http://play.kankan.xunlei.com/";    
    var target="kankanWindow";
    if(G_IN_XUNLEI){id="&id=27";}
    var param="?hallid="+movieid+""+id+""+sid+""+flag+""+_ext+""+u;
    var pcv = preCheckVersion();
    if("flv" == ext){
        if(!pcv){
            if(window.confirm("您现在的所安装看看组件无法识别该影片格式，请安装5.8.1.510版本迅雷或以上版本。\n\n点击【确定】下载安装，点击【取消】手动下载安装。")){
                doUpgrage();
                return null;
            }
            return null;
        }
    }
    if(isNaN(cp) || 11==cp || 14==cp){
        win=window.open(url+param,target);
        win.focus();
    }else{
        var ifr=$C("iframe");
        ifr.style.cssText="display:none";        
        $P(ifr);
        ifr.src="/list/cplist.html?cacheTime="+getCacheTime();
        ifr.attachEvent("onload",function(){
            try{
                var r=ifr.contentWindow.cp;
                switch(parseInt(cp, 10)){                    
                    //case 1: //激动
                    case 2: //中录
                    case 12: //九州
                    case 13: //网乐
                    //case 15: //唐玛互动
                    case G_51TV: //优度
                    case 37: //捷报
                        url=r[cp].url;
                        break;
                }
            }catch(e){}finally{
                win=window.open(url+param,target);
                win.focus();  
                $R(ifr);
            }
        });
    }
}
function _GP(movieid,subid,cp,stat,ext){
    if(!G_IN_XUNLEI){
        logForClick(stat);
    }
    openWinPlay(movieid,subid,cp,(ext?ext:null));
}
function watchSegment(movieid,subid,cp,ext){
    _GP(movieid,subid,cp,"MC",(ext?ext:null));
}
function _GO(obj,s,type,qs){
    var id=obj.id;
    var url="/content/"+id.replace(/\_+/g,"/")+"_0.html" + (qs?"?"+qs:"");
    if(6==type){
        if("MORE_LC" != id){
            var win=null;
            url="http://live.kankan.xunlei.com/?"+(id.replace("_","="));
            win=window.open(url,"kankanWindow");
            win.focus();
            return null;
        }else{
            url = "http://pub.live.xunlei.com/fcg-bin/fcgi_layer_channel.fcg?p=1&catchTime="+getCacheTime();
        }
    }
    if(!G_IN_XUNLEI){
        logForClick(s);
        window.scroll(0,0);        
        hidePlayer();
        setFloatLayerURL(obj,s,url,type);  
    }else{
        var _url="/category/navigator.html?file="+url;
        if(!obj.href || obj.href == "javascript:;"){
            obj.href=_url;
            obj.click();
        } 
    }
}
function _GDL(name,stat){
    openAndLog('http://movie.gougou.com/search?search='+encodeURIComponent(name)+'&id=20',stat);
}
function _GDT(name,stat){
    openAndLog('http://movie.xunlei.com/search/'+encodeURIComponent(name),stat);
}
function _GDC(name,stat){
    openAndLog('http://movies.xunlei.com/movie_rewrite.php?keyword='+encodeURIComponent(name)+'&type=comment',stat);
}
function _GSR(obj,stat){
	if(!G_IN_XUNLEI){
        logForClick(stat);
        try{
            document.forms[0].elements["keyword"].value=obj.firstChild.nodeValue;
            document.forms[0].elements["page"].value=1;
            document.forms[0].elements["keyword"].style.cssText="color:black";
            document.forms[0].submit();
        }catch(e){
            parent.document.forms[0].elements["keyword"].value=obj.firstChild.nodeValue;
            parent.document.forms[0].elements["page"].value=1;
            parent.document.forms[0].elements["keyword"].style.cssText="color:black";
            parent.document.forms[0].submit();
        }
    }else{
        var keyword=obj.firstChild.nodeValue;
        window.open("http://kankan.xunlei.com/search.html?keyword="+keyword+"&page=1&id=27");
    }
}
function _GU(){
	logForClick('KE');
	showUploadBox();
}
function _GV(){
    logForClick('KH');
	showProvideVedio();
}
function _GS(){
	logForClick('KC');
	showLogin();
}
function sliceActor(a,l,islink){
    var as=(a.replace(/\|/gm,",")).split(",");
    var n=0;
    var s="",u="";
    var v=" <span class=\"vline\">|</span> ";
    for(var i=0;i<as.length;i++){
        u=as[i];
        if(0==i && u.size >= l){
            return (islink?'<a style="cursor:pointer" onclick="return _GSR(this)">'+slice(u,l)+'</a>':slice(u,l));
        }
        if(n+u.size()+i*3<l){
            if(islink){s+='<a style="cursor:pointer" onclick="return _GSR(this)">'+u+'</a>'+v}else{s+=u+v;}
        }else{ break;}
        n+=u.size();
    }
    return s.substr(0,s.length-v.length);
}
function slice(a,l){
    var as=a.split("");
    var n=0;
    var s="",u="";
    for(var i=0;i<as.length;i++){
        u=as[i];
        if(n+u.size()<=l){
            s+=u;
        }else{ break;}
        n+=u.size();
    }
    return s.substr(0,s.length);
}
function sliceOffset(a,b,l){
    var al=a.size();
    var tmpA=slice(a,l);
    var tmpB=slice(b,(l-al<0?0:l-al));
    return {first:tmpA,second:tmpB};
}
function insertId(){
    try{
        var id=getParameter("id")?"?id="+getParameter("id"):"";
        var u=getParameter("u")?"u="+getParameter("u"):"";
        var header=$("_iLogo");
        var hp=$("homepage");
        var base="http://kankan.xunlei.com/";
        if(getParameter("u")){ u=(""==id)?"?"+u:"&"+u;}
        if(header){
            header.href=base+id+u;
        }
        if(hp){
            hp.href=base+id+u;
        }
        if(getParameter("id")){
            var input=$("id");
            if(null==input){
                input=$C('<input name="id" id="id" type="hidden" value="'+ getParameter("id") +'" />');
                document.forms[0].appendChild(input);
            }else{
                input.value=getParameter("id");
            } 
        }
        if(getParameter("u")){
            var input1=$("_u_id");
            if(null==input){
                input1=$C('<input name="u" id="_u_id" type="hidden" value="'+ getParameter("u") +'" />');
                document.forms[0].appendChild(input1);
            }else{
                input1.value=getParameter("u");
            }
        }
    }catch(e){
        /*alert(e.message);*/
    }
}
function generateChannel(){
    if(!G_IN_XUNLEI){insertId();}
    if($("theme")){
        var ifr=$C('<iframe width="0" height="0">');
        $("theme").appendChild(ifr);
        ifr.src="/content/recomm/index.html";
        var tmp=0;
        var specpath="";        
        ifr.attachEvent("onload",function(){
            var json=ifr.contentWindow.jsonObj;
            var subject=json.recomm;
            var special=json.specialrecomm[0];
            var actor=json.actor;
            var sSize=subject.length-1;
            var aSize=actor.length-1;
            specpath=special.filepath;
            $("channellist").innerHTML="";
            $("channellist").appendChild(c({channel:special.channel,filepath:"/content/special/special_0.html",commend:0},true));
            $("channellist").appendChild(c({channel:"最近更新",filepath:"/content/new/1_0.html",commend:0},false));
            $("channellist").appendChild(c({channel:"最新电影",filepath:"/content/recent/1_0.html",commend:0},false));
            for(var i=0;i<sSize&&i<10;i++){
                $("channellist").appendChild(c(subject[i],false));
            }
            $("actorlist").innerHTML="";
            for(var j=0;j<aSize&&j<12;j++){
                $("actorlist").appendChild(d(actor[j],false));
            }            
            $("theme").removeChild(ifr);        
        });
        function c(obj,isspecial){
            var li=$C("<li>");
            var iscomm=(obj.commend==1 || obj.commend==2);
            var i=((obj.filepath).replace("/content/","")).replace(/\/+/g,"_").replace("_0.html","").split("_");
            var a=null;
            if(isspecial){
                li.className="first";
                a=$C('<a id="'+i.join("_")+'" href="javascript:;" onclick="_GO(this,\'N'+obj.channel+'\',3,\''+specpath+'\')" class="iconlist new">');
            }else{
                a=$C('<a id="'+i.join("_")+'" href="javascript:;" onclick="_GO(this,\'N'+obj.channel+'\','+(obj.commend==2?4:7)+')"'+(iscomm?' class="special"':'')+'>');
            }
            a.appendChild(document.createTextNode(obj.channel));
            li.appendChild(a);
            return li;
        }
        function d(obj,ispic){
            var li=$C("<li>");
            var iscomm=(obj.commend==1);
            var i=((obj.filepath).replace("/content/","")).replace(/\/+/g,"_").replace("_0.html","").split("_");
            var a=$C('<a id="'+(i.join("_"))+'"'+(iscomm?' class="special"':'')+' href="javascript:;" onclick="_GO(this,\'Q'+obj.channel+'\',8)">');           
            a.appendChild(document.createTextNode(obj.channel));
            li.appendChild(a);
            return li;
        }
    }
}
function createRankList(pos){
    var rl=ranklist();
    var size=rl.length;
    var s='',id='',tar='',first='';;
    if(1==pos){
        for(var i=0;i<size;i++){
            s+='<li><a'+ setLink(rl[i].link,rl[i].name)+(rl[i].isnew?' class="iconlist new2"':'')+'>'+rl[i].name+'</a></li>';
        }
        tar="list";
    }else if(0==pos){
        for(var i=0;i<size&&i<9;i++){
            id=(((rl[i].link).replace("/content/","")).replace("_0.html","")).split("/").join("_");
            if(i==0){first=id;}
            s+='<li><a id="'+id+'" href="javascript:;" onclick="_GO(this,\'R'+rl[i].name+'\',2)"'+(rl[i].isspec?' class="special"':'')+'>'+rl[i].name+'</a></li>';
        }
        if(!G_IN_XUNLEI){
            s+='<li class="more"><a id="MORE_RANKS" href="javascript:;" onclick="_GO($(\''+first+'\'),\'R查看更多榜单\',2)">查看更多榜单 <small>&gt;&gt;</small></a></li>';
        }else{
            s+='<li class="more"><a id="MORE_RANKS" href="/category/navigator.html?file='+rl[0].link+'">查看更多榜单 <small>&gt;&gt;</small></a></li>';
        }
        tar="";
    }
    $('ul_rank'+tar).innerHTML=s;
    function setLink(link,name){
        var cur=location.pathname;
        var src=link,id="";
        cur=cur.split("_")[0];
        src=link.split("_")[0];
        id=cur.replace("/content/","").split("/").join("_");
        if(cur==src){
            if(parent.G_PRELINKID && parent.document.getElementById(parent.G_PRELINKID)){
                parent.document.getElementById(parent.G_PRELINKID).style.cssText="";
                if(parent.document.getElementById(id)){
                    parent.document.getElementById(id).style.cssText="font-weight:bold;color:black;";
                    parent.G_PRELINKID = id;
                }
            }
            return ' style="color:black;text-decoration:none;"';
        }else{
            return ' href="'+link+'" onclick="logForClick(\'S'+name+'\')"';
        }
    }
    function ranklist(){
        var rl=[];
        var base='/content/top/';
        rl.push({name:'新剧收视',link:base+'24/1_0.html',isnew:false,isspec:false});
        rl.push({name:'台剧风云',link:base+'32/1_0.html',isnew:false,isspec:false});
        rl.push({name:'动作冒险',link:base+'7/1_0.html',isnew:false,isspec:false});
        rl.push({name:'华语最佳',link:base+'1/1_0.html',isnew:false,isspec:false});
        rl.push({name:'日韩最佳',link:base+'3/1_0.html',isnew:false,isspec:false});
        rl.push({name:'欧美最佳',link:base+'2/1_0.html',isnew:false,isspec:false});
        rl.push({name:'经典怀旧',link:base+'35/1_0.html',isnew:false,isspec:false});        
        rl.push({name:'恐怖惊魂',link:base+'8/1_0.html',isnew:false,isspec:false});
        rl.push({name:'恋爱情色',link:base+'6/1_0.html',isnew:false,isspec:false});
        /***************************************************************************/
        rl.push({name:'80后最爱',link:base+'20/1_0.html',isnew:false,isspec:false});
        rl.push({name:'综艺人气',link:base+'28/1_0.html',isnew:false,isspec:false});
        rl.push({name:'喜剧搞笑',link:base+'5/1_0.html',isnew:false,isspec:false});        
        rl.push({name:'港片龙虎',link:base+'30/1_0.html',isnew:false,isspec:false});
        return rl;
    }
}
function loadAD(){
    var args=arguments.callee.arguments;
    var size=args.length; 
    var tmpAd = null;
    var index=0;
    var intId=setInterval(function(){
        if(index<size){
            createAD(args[index]);
            index++;
        }else{
            clearInterval(intId);
        }
    },300);
    function createAD(name){
        var ad=getAD(name);
        if(0==ad.type){
            createScriptAD(ad,name);
        }else if(1==ad.type){
            //createIframeAD(ad,name);
            //$("KKAD_"+name).src=ad.url;
        }
    }
    function createScriptAD(ad,name){
        var script=$C("script");
        script.type="text/javascript";
        script.language="javascript";
        script.src=ad.url;
        if(null == ad.pos){
            $P(script);
        }else{
            $P(script,$(ad.pos+"_"+name));
        }        
    }
    function createIframeAD(ad,name){
        var iframe=$C("iframe");
        iframe.width=ad.width;
        iframe.height=ad.height;
        iframe.frameBorder=0;
        iframe.marginWidth=0;
        iframe.marginHeight=0;
        iframe.vSpace=0;
        iframe.hSpace=0;
        iframe.scrolling="no";
        iframe.src="about:blank";
        if(null == ad.pos){
            $P(iframe);
        }else{
            $P(iframe,$(ad.pos+"_"+name));
        }
        iframe.src=ad.url
    }
    function getAD(name){
        var _ad=new Object();
        var _base="http://biz5.sandai.net/portal/kankan/";
        _ad["A"]={url:_base+"top1.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["B"]={url:_base+"righttop.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["C"]={url:_base+"rightbanner.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["D"]={url:_base+"playpagebanner.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["E"]={url:"http://mediapv.xunlei.com/fcg-bin/statextend?id=395&url=http://v.gougou.com/brand/iframe550.html?adlicsn="+getCacheTime(),type:1,pos:'IFRAD',width:538,height:170};
        _ad["F"]={url:_base+"floatbanner.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["G"]={url:_base+"floatleftbt.js?adlicsn="+getCacheTime(),type:0,pos:null};
        _ad["H"]={url:_base+"floatleftbg.js?adlicsn="+getCacheTime(),type:0,pos:null};
        return _ad[name];
    }
}
function doUpgrage(){
    window.open(g_sThunderSteup_url);
}
function closePrompt(type){
    if(0==type){
        $("upgrade").style.display = "none";
    }else{
        $("browser").style.display = "none";
    }
}
function unprompt(type){
    if(0==type){
        ioWriter("f1",G_BUILD_VERSION,720); 
    }else if(1==type){
        ioWriter("f2","1",720);
    }else{
        ioWriter("f3","1",720);
    }
    closePrompt();
}
function upgradePrompt(){
    var u=ioReader("f2");
    var tips='<p>请您使用IE浏览器访问迅雷看看，建议您使用IE7.0或以上版本&nbsp;<a href="http://www.microsoft.com/china/windows/downloads/ie/getitnow.mspx" target="_blank">下载IE7</a></p><span class="no_tip"><input name="" type="checkbox" value="" onclick="unprompt(1)" />下次不再提示</span><a href="javascript://" onclick="closePrompt(1)" class="close">关闭</a>';
    var ua=navigator.userAgent;
    var match = /(FireFox|Opera|Safari|Camino|Gecko|Netscape)/gi.test(ua);
    if(match && "1" != u){
        $("browser").innerHTML = tips;
        $("browser").style.display = "block";
    }
    if(!match){
        u=ioReader("f1");
        tips = '<div></div><h2>系统检测到有新版看看播放组件，建议您升级到最新版本<input type="button" onclick="doUpgrage()" /></h2><p>新版更新：<span>优化了播放体验，播放更流畅</span> 更新时间：<span>'+g_upgrade_date+'</span></p><span class="no_tip"><input name="" type="checkbox" value="" onclick="unprompt(0)" />下次不再提示</span><a href="javascript://" onclick="closePrompt(0)" class="close">关闭</a>';
        try{
            var player = new ActiveXObject("PPlayer.XPPlayer");
            var ver = player.PlayerVersion;
            var build = parseInt(ver.split(".")[3],10);
            G_BUILD_VERSION = build;
            player=null;
            if(build < parseInt((g_kankan_version?g_kankan_version.split(".")[3]:122),10) && build+"" != u+""){
                $("upgrade").innerHTML = tips;
                $("upgrade").style.display = "block";
            }
        }
        catch(e)
        {
            u=ioReader("f3");
            if("1"!=u){
                tips='<p>系统检测到您尚未安装迅雷看看播放组件，<a href="javascript:void(0);" onclick="doUpgrage()">点击此处立即下载安装</a></p><span class="no_tip"><input name="" type="checkbox" value="" onclick="unprompt(2)" />下次不再提示</span><a href="javascript://" onclick="closePrompt(1)" class="close">关闭</a>';
                $("browser").innerHTML = tips;
                $("browser").style.display = "block";
            }
        } 
    }
}
function setError(str){
    if(G_ERROR_INFO.indexOf(str)==-1){
        G_ERROR_INFO+=str;
    }
}
//window.onerror=function(){return true;}
var G_PLAYTURNSINTERVAL=G_ITURNSNOW=0;
var G_WEB_TIPS_INTERVAL=24;
var G_WEB_TIPS_DELAY=25000;
var G_SYSTEM_DATETIME = (new Date().getTime());
var G_KEEP_INTERVAL=G_CLOSE_INTERVAL=G_TIMER_INTERVAL=G_KEEP_HIDDEN_INTERVAL=null;
function string2Array(str,splitChar){
	return str.split(splitChar);
}
function array2String(arr,joinChar){
	return arr.join(joinChar);
}
function latest2normal(latest){
    var item=string2Array(latest,G_ITEMS_CHAR); 
    return array2String(item.slice(0,5),G_ITEMS_CHAR);
}
function writeInfo(str){
	ioWriter('view_histroy',str,720);
}
function readInfo(){
    return ioReader("view_histroy");
    /*checkKankanVersion(g_version,83)/pplayer.Getinfo()*/
}
function rewriteInfo(newInfo){
    var oldInfo = readInfo();
    var group = string2Array(oldInfo,G_GROUP_CHAR);
    var size = group.length;
    group.unshift(newInfo);
    ""==group[1]?group.pop():group[1]=latest2normal(group[1]);
    writeInfo(array2String(group.slice(0,4),G_GROUP_CHAR));
}
function checkInfoFormat(){
    var info = readInfo();
    var group = string2Array(info,G_GROUP_CHAR);
    var items = [];
    if(group.length > 0){
        items = string2Array(group[0],G_ITEMS_CHAR);
        if(items.length != 9){
            writeInfo("");
        }
    }
}
function removeExistInfo(movieName){
    var info = readInfo();
    var group = string2Array(info,G_GROUP_CHAR);
    for(var i=group.length-1;i>=0;i--){
        if(decodeURI(group[i]).indexOf(movieName) != -1){
            group.splice(i,1);
        }
    }
    writeInfo(array2String(group,G_GROUP_CHAR));
}
function formatInfo(info){
    var items=string2Array(info,G_ITEMS_CHAR);
    var size=items.length;
    if(size>5){
        return {isLatest:true,movie_id:items[0],time:items[1],movie_name:decodeURI(items[2]),cp:items[3],ext:items[4],subid:items[5],subname:decodeURI(items[6]),nextid:items[7],nextname:decodeURI(items[8])};
    }else{
        return {isLatest:false,movie_id:items[0],time:items[1],movie_name:decodeURI(items[2]),cp:items[3],ext:items[4]};
    }
}
function getInfo(){
    checkInfoFormat();
    var info = readInfo();
    var group = string2Array(info,G_GROUP_CHAR);
    var size = group.length;
    var tmp = [];
    for(var i=0;i<size;i++){
        tmp.push(formatInfo(group[i]));
    }
    return tmp;
}
function getLatestInfo(){
    var group = getInfo();
    if(group.length>0){
        return group[0];
    }else{
        return null;    
    }
}
function _GSL(movieid,url,cp,s){
	logForClick(s);
    if(movieid>0){
        openWinPlay(movieid,null,cp);
    }else{
        window.open(url);
    }
}
function buildViewHistory(s1,s2){
	var latest=getLatestInfo();
    var items=getInfo();
    var item=null;
    var sHtml="",tmp="";
	if(!latest){
		sHtml='<h2>我曾经观看过</h2><div class="inner clearfix"><p>您的观看历史为空。</p></div>';
	}else{
		if(!latest.movie_id){
			writeInfo("");
			sHtml='<h2>我曾经观看过</h2><div class="inner clearfix"><p>您的观看历史为空。</p></div>';
		}else{
            sHtml='<h2>我曾经观看过</h2><div class="inner clearfix"><p>'+calcTime(latest.time)+'看过 <a href="javascript:_GP('+latest.movie_id+',\''+latest.subid+'\',\''+latest.cp+'\',\''+s1+'\',\''+latest.ext+'\')" title="点击播放&#13;&#10;'+latest.movie_name+'-'+latest.subname+'">'+slice(latest.movie_name+'-'+latest.subname,16)+'</a></p>'+(latest.nextid!='NO'?'<p>您是否需要观看 <a title="点击播放&#13;&#10;'+latest.movie_name+'-'+latest.nextname+'" href="javascript:_GP('+latest.movie_id+',\''+latest.nextid+'\',\''+latest.cp+'\',\''+s1+'\',\''+latest.ext+'\')">'+slice(latest.nextname,13)+'</a></p>':'')+'<ul>';
            for(var i=1;i<items.length;i++){
                item=items[i];
                tmp=sliceOffset(item.movie_name,calcTime(item.time)+'看过',22);
                sHtml+='<li><a href="javascript:_GP('+item.movie_id+',null,\''+item.cp+'\',\''+s2+'\',\''+item.ext+'\')" title="点击播放&#13;&#10;'+item.movie_name+'">'+tmp.first+'</a> <font style="color:#B7B5B4;">'+tmp.second+'</font><span>'+formatDate(item.time)+'</span></li>';
            }
            sHtml+='<li><a href="javascript:_GC(\''+s1+'\',\''+s2+'\');" class="end">清空观看历史</a></li></ul></div>';
		}
	}
	$('history').innerHTML=sHtml;
    function formatDate(str){
        var d = new Date(parseInt(str));
        return ((d.getMonth()+1)<10?"0"+(d.getMonth()+1):(d.getMonth()+1))+"-"+(d.getDate()<10?"0"+d.getDate():d.getDate());
    }
	function calcTime(t){
		var str;
		var m=Math.round((new Date().getTime()-t)/(1000*60));
		if(m<60){
			str=(m?m:1)+'分钟前';
		}else if(m<(60*24)){
			str=Math.round(m/60)+'小时前';	
		}else{
			str=Math.round(m/(60*24))+'天前';
		}
		return str;
	}
}
function _GC(s1,s2){
	cleanViewHistory();
	function cleanViewHistory(){
		writeInfo('');
		buildViewHistory(s1,s2);
	}	
}
function setTruns(obj,s){
    $("rightPlayTurns").innerHTML = buildPlayTurns(obj,s);
	G_PLAYTURNSINTERVAL=setInterval(playTurns,4000);
}
function buildPlayTurns(obj,s){
    var sTemp='',sTemp2='';
    sTemp2 +='<div class="mpb"><div id="SlidePlayer"><ul class="s">';
    for(i=0,l=obj.length-1;i<l;i++){
        sTemp2 += '<li><a onclick="_GSL(\''+ obj[i].movie_id +'\',\''+ obj[i].link_url +'\',\''+obj[i].cp_id+'\',\''+s+'\')"><img src="'+obj[i].pic_url+'" /></a></li>';
        if(i==0){
            sTemp +='<li class="Current" onclick=playTurns("'+i+'")>'+(i+1)+'</li>';
        }else{
            sTemp +='<li onclick=playTurns("'+i+'")>'+(i+1)+'</li>';
        }
    }
    sTemp='<ul class="st" id="SlideTriggers">'+sTemp+'</ul>';
    return sTemp2+'</ul>'+sTemp+'</div></div>';
}
function playTurns(n){
	var oUl=$('SlidePlayer').firstChild;
	var oLi=$('SlideTriggers').childNodes;
	var aNodes=oUl.childNodes;
	var l=aNodes.length;
	if(n){
		n=parseInt(n);
		if(n==G_ITURNSNOW){
			return false;
		}
		if(n==0){
			G_ITURNSNOW=l-1;
		}else{
			G_ITURNSNOW=n-1;
		}
		clearInterval(G_PLAYTURNSINTERVAL);
		G_PLAYTURNSINTERVAL=setInterval(playTurns,4000);
	}
	for(var i=0;i<l;i++)
		aNodes[i].style.display='none';
	aNodes[G_ITURNSNOW].style.display='block';
	oUl.filters[0].Apply();
	if(G_ITURNSNOW>=l-1){
		G_ITURNSNOW=0;
	}else{
		G_ITURNSNOW++;
	}
	for(var i=0;i<l;i++){
		aNodes[i].style.display='none';
		oLi[i].className='';
	}
	oLi[G_ITURNSNOW].className='Current';
	aNodes[G_ITURNSNOW].style.display='block';
	oUl.filters[0].play();
}
function showItemDetail(movie_name,actors,other_desc,play_time,year,focus,isnew,length,out_rate,attract,cp_id,cp_name,userid,pos){
	var o=$("divItemDetail");
    var isIndex=(0==pos);
    var width=isIndex?200:122;
    var lw=isIndex?218:140;
    var nSize=isIndex?28:16;
    var aSize=isIndex?20:16;
    var t=sliceOffset(movie_name,other_desc,nSize);
    var ss='';
    o.style.width=width+"px";
    o.style.overflowX="hidden";
    ss+='<div><h1>'+t.first+'<span>'+t.second+'</span></h1><ul><li class="t1">主演:'+sliceActor(actors,aSize,false)+'</li>';
    if(isIndex){ss+='<li class="t2">看点:'+focus+'</li><li class="t3">时长:'+length+'分</li>';}else{ss+='<li class="t1">卖点:'+attract+'</li>';};
    ss+='<li class="t3">年份:'+year+'</li><li class="t3">人气:'+setHotLevel(play_time,isnew)+'</li>';
    ss+='<li class="t5"></li></ul><label style="width:'+lw+'px;">'+(14+""==cp_id+""?'上传者:'+userid:'内容商:'+cp_name)+'</label></div>';
    o.innerHTML=ss;
    var cw=Math.max(document.body.clientWidth,document.documentElement.clientWidth);
    var st=Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    o.style.left=(window.event.clientX+width>cw)?(window.event.clientX-(width+10))+"px":(window.event.clientX-2)+"px";    
    o.style.top=(window.event.clientY+20+st)+"px";
	o.style.display="block";
}
function hideItemDetail(){
	var o=$("divItemDetail");
	o.style.display="none";
}
function generateShortVideoUpdate(str,flag,mid){
    var size = str.length-1;
    var s=''; 
    var tmpIndex=0;
    var d=null;
    for(var i=0;i<size;i++){
        d=str[i];
        if(-1==mid){
            s+='<li><a href="javascript:_GP(\''+d.movie_id+'\',null,\''+d.cp_id+'\',\''+flag+'\',\''+d.ext+'\');"><img src="'+d.img_url+'" alt="点击播放&#13;&#10;'+d.movie_name+'" /></a><a href="javascript:_GP(\''+d.movie_id+'\',null,\''+d.cp_id+'\',\''+flag+'\',\''+d.ext+'\');" title="点击播放&#13;&#10;'+d.movie_name+'">'+d.movie_name+'</a><span class="back"></span><span><em>'+d.length+'</em>'+d.typename+'</span><code>'+d.last_time+'</code></li>';
        }else{
            if(mid != d.movie_id && tmpIndex<4){
                s+='<li><a href="javascript:_GP(\''+d.movie_id+'\',null,\''+d.cp_id+'\',\''+flag+'\',\''+d.ext+'\');"><img src="'+d.img_url+'" alt="点击播放&#13;&#10;'+d.movie_name+'" /></a><a href="javascript:_GP(\''+d.movie_id+'\',null,\''+d.cp_id+'\',\''+flag+'\',\''+d.ext+'\');" title="点击播放&#13;&#10;'+d.movie_name+'">'+d.movie_name+'</a><span class="back"></span><span><em>'+d.length+'</em>'+d.typename+'</span><code>'+d.last_time+'</code></li>';
                tmpIndex++;
            }
        }
    }
    return s;
}
function hiddenBarTips(){    
    if(null != G_KEEP_INTERVAL){clearInterval(G_KEEP_INTERVAL);G_KEEP_INTERVAL=null;}
    if(null != G_CLOSE_INTERVAL){clearInterval(G_CLOSE_INTERVAL);G_CLOSE_INTERVAL=null;} 
    $("iTipsPanel").detachEvent("onmouseover",mouseoverHandler);
    $("iTipsPanel").detachEvent("onmouseout",mouseoutHandler);  
    var cs=getClientSize();
    var initLeft=cs.width-244;
    var initTop=cs.height+3+document.documentElement.scrollTop;
    var actTop=cs.height-153+document.documentElement.scrollTop;
    var tmpTop=actTop;
    var inId = setInterval(function(){        
        var top=Math.min(tmpTop+=10,initTop);
         $("iTipsPanel").style.top=top+"px";
         if(top == initTop){
            clearInterval(inId);
            $("iTipsPanel").style.display="none";            
         }
    }, 30);
}
function watch(u,t){  
    hiddenBarTips();
    logForClick('WB'+t);
    var p1 = /http\:\/\/(kankan|play|live)\./gmi;
    var p2 = /http\:\/\/(xunlei)\./gmi;
    var target = p1.test(u)?'kankanWindow':'_blank';
    target = p2.test(u)?'_top':target;
    var win = window.open(u, target);
    win.focus();
}
function setSysTime(){
    try{
        G_SYSTEM_DATETIME = toTimeString($("ifr_pgv").contentWindow.systime);
    }catch(e){G_SYSTEM_DATETIME=(new Date()).getTime();}
    finally{$("ifr_pgv").detachEvent("onload",setSysTime);iTips();setInterval(function(){G_SYSTEM_DATETIME++},1);}   
}
function toTimeString(ts){
    var s=ts.replace(/[\-\:\s]/g,"");
    var year=parseInt(s.substring(0,4), 10);
    var month=parseInt(s.substring(4,6), 10)-1;
    var date=parseInt(s.substring(6,8), 10);
    var hour=parseInt(s.substring(8,10), 10);
    var minute=parseInt(s.substring(10,12), 10);
    var second=parseInt(s.substring(12,14), 10);
    return (new Date(year,month,date,hour,minute,second)).getTime();
}
function mouseoverHandler(){
    window.event.cancelBubble=true;
    if(null!=G_CLOSE_INTERVAL){clearInterval(G_CLOSE_INTERVAL);G_CLOSE_INTERVAL=null;}
}
function mouseoutHandler(){
    window.event.cancelBubble=true;
    G_CLOSE_INTERVAL=setInterval("hiddenBarTips()", G_WEB_TIPS_DELAY);
}
function iTips(){
    function iTipsCoreDeal(){        
        var t=$("iTipsPanel");
        var sh=' onclick="watch(\'{1}\',\'{2}\')"';
        var sh0='<div class="bartips2"><h3>看看吧台<a class="close" href="javascript:hiddenBarTips();"></a></h3>';
        var sh1=sh0+'<div class="text"><p>{0} <a'+sh+'>免费高清在线播放&gt;&gt;</a></p></div><a href="http://kankan.xunlei.com/feedback.html?mid=-1&mn=-1&t=1" target="_blank" class="suggest">我对吧台提建议</a></div>';
        var sh2=sh0+'<div class="pictext"><a'+sh+'><img src="{3}" /></a><h4><a'+sh+'>{2}</a></h4><p>{0}</p><a'+sh+' class="more">免费高清在线播放&gt;&gt;</a></div></div>';
        var sh3=sh0+'<div class="pic"><a'+sh+'><img src="{3}" /></a></div></div>';
        var text="";
        if(null == t){
            t=$C("div");
            t.setAttribute("id","iTipsPanel");
            $P(t);
        }
        var cs=getClientSize();
        var initLeft=cs.width-244;
        var initTop=cs.height+3+document.documentElement.scrollTop;
        var actTop=cs.height-153+document.documentElement.scrollTop;
        t.style.cssText="position:absolute;left:"+initLeft+"px;top:"+initTop+"px;display:none;";
        t.innerHTML="";
        t.attachEvent("onmouseover",mouseoverHandler);
        t.attachEvent("onmouseout",mouseoutHandler);        
        function timer(){
            var ifr = $C('iframe');
            ifr.style.cssText="display:none";
            $P(ifr);
            ifr.src='/list/bartips.html?cachetime='+getCacheTime();
            ifr.attachEvent("onload",function(){
                try{
                    var data = ifr.contentWindow.jsonObj; 
                    var items = removeExpireItem(data);
                    var size = items.length-1;
                    var rnd=0;
                    var st=0,et=0;
                    if(size>0){
                        //rnd=Math.floor(Math.random()*size);
                        if(items[rnd].id+"" == ioReader("iTips")){return null;}
                        if(0==items[rnd].type){text=sh1;}else if(1==items[rnd].type){text=sh2;}else if(2==items[rnd].type){text=sh3;}else{text=sh1;}
                        text=(((text.replace(/\{0\}/gm,items[rnd].content)).replace(/\{1\}/gm,items[rnd].url)).replace(/\{2\}/gm,items[rnd].title)).replace(/\{3\}/gm,items[rnd].pic_url);
                        st=toTimeString(items[rnd].starttime);
                        et=toTimeString(items[rnd].endtime);
                        if(G_SYSTEM_DATETIME>=st && G_SYSTEM_DATETIME<=et){
                            logForClick('WA'+items[rnd].title);
                            var d = new Date();
                            var s1 = new Date(d.getFullYear(),d.getMonth(),d.getDate(),23,59,59).getTime();
                            var s2 = new Date().getTime();
                            G_WEB_TIPS_INTERVAL=((s1-s2)/3600000).toFixed(2);
                            ioWriter("iTips",items[rnd].id,G_WEB_TIPS_INTERVAL);
                            t.innerHTML=text;
                            t.style.display="block";
                            var tmpTop=initTop;
                            var inId=setInterval(function(){
                                resetPosition();
                                var top=Math.max(tmpTop-=10,actTop);
                                $("iTipsPanel").style.top=top+"px";
                                if(top==actTop){
                                    clearInterval(inId);
                                    G_KEEP_INTERVAL=setInterval(function(){
                                        cs=getClientSize();
                                        $("iTipsPanel").style.left=(cs.width-244)+"px";
                                        $("iTipsPanel").style.top=(cs.height-153+document.documentElement.scrollTop)+"px";
                                    },30);
                                    G_CLOSE_INTERVAL=setInterval("hiddenBarTips()", G_WEB_TIPS_DELAY);
                                 }
                            },30);
                        }
                    }
                }catch(e){}
                $R(ifr);
            });           
        }
        function removeExpireItem(data){
            var items = data.items;
            var size = items.length - 1;
            var st=et=0;
            for(var i=items.length-2; i>=0; i--){
                st=toTimeString(items[i].starttime);
                et=toTimeString(items[i].endtime);
                if(G_SYSTEM_DATETIME<st || G_SYSTEM_DATETIME>et){
                    items.splice(i,1);
                }
            }
            return items;
        }
        timer();
    }
    iTipsCoreDeal();
    G_TIMER_INTERVAL=setInterval(iTipsCoreDeal,G_WEB_TIPS_INTERVAL*3600000);
}
function getPlayerType(){
    var t = getParameter("pt");
    if(t){
        t = t.toLowerCase();
        if("flv"==t){
            return 1;
        }else{
            return 0;
        }
    }
    return 0;
}
var G_CPID=G_CURSUB=G_ISFULLSCREEN=G_ISFULLSCREENSELF=G_CONTENTSUBINDEX=G_SUBINDEX=0;
var G_MOVIE_DATA=G_HOTPLAY_DATA=G_TIMER_DATA=null;
var G_PLAY_SATE_TEXT=[];
var G_PRE_MOVIEINDEX=-1;
var G_SNO_FLAG=null;
var G_DATETIME_LABEL={index:0,lastIndex:0,start:0,end:0};
var G_PRE_GCID=G_CDN_URL=G_CDN_NEXT="";
var G_PRE_INTERVAL=G_STS_CUR=G_STS_NEXT=G_CACHE_PATH=null;
var G_PLAY_STARTTIME=G_REQ_SERIAL_NUMBER=0;
var G_CDN_STAT_RES_HAS_IP = new Image(1,1);
var G_CDN_STAT_RES_NO_IP = new Image(1,1);
var G_CDN_STAT_NO_RES = new Image(1,1);
var G_STS_STAT_NUM = new Image(1,1);
var G_STS_STAT_ERR = new Image(1,1);
var _51tvContentNo=_51tvContentName=_51tvUserName=null;
var _51tvPageType = "30";
function changeLocation(cp){    
    setWindowName(cp);
    if(isNaN(cp)){return false;}
    var t=null;
    try{t = top.document;}catch(e){}
    if(null!=t){
        switch(parseInt(cp, 10)){                    
            //case 1:
            case 2:
            case 12:
            case 13:
            //case 15:
            case G_51TV:                
                return true;
            default:
                return false;
        }
    }    
    return false;
}
function setWindowName(cp){
    if(isNaN(cp)){
        window.name="kankanWindow";
    }else{
        switch(parseInt(cp, 10)){                    
            //case 1:
            case 2:
            case 12:
            case 13:
            //case 15:
            case G_51TV:                
                window.name="";
                setCPLogo(cp);
                break;
            default:
                window.name="kankanWindow";
                break;
        }
    }
}
function setCPLogo(cp){
    $("_cpLogo").innerHTML = '<img src="/images/logo/'+cp+'.gif" onabort="this.src=this.src" />';
}
function setInfo(movieId,movieName,cp,subId,subName,nextSubId,nextSubName){
    checkInfoFormat();
    removeExistInfo(movieName);
	var latest=movieId==''?'':movieId+G_ITEMS_CHAR+(new Date().getTime())+G_ITEMS_CHAR+encodeURI(movieName)+G_ITEMS_CHAR+cp+G_ITEMS_CHAR+subId+G_ITEMS_CHAR+encodeURI(subName)+G_ITEMS_CHAR+nextSubId+G_ITEMS_CHAR+encodeURI(nextSubName);
    rewriteInfo(latest);
}
function getMovieInfo(movieid, subid){
    var flag=getParameter("tno");
    G_SNO_FLAG = flag;
	//拉幕广告
	//AVD_ResitFlag();
	if(G_MOVIE_DATA&&G_MOVIE_DATA.movie_id==movieid){
		if(subid){
			return $('sub_'+subid).click();
		}
		return false;	
	}

	var ifr=$C('<iframe id="ifr_get_movie_info" style="display:none">');	
	$P(ifr);
    //ifr.src="/movie/"+movieid%100+"/"+movieid+".html";
    ifr.src="/testflv/3017.html";
	ifr.attachEvent('onload',callback);
	function callback(){
		var json=ifr.contentWindow.jsonObj;
		$R(ifr);
		if(!json){
			window.open('http://kankan.xunlei.com/'+(getParameter('id')?'?id='+getParameter('id'):''),"_top");
            return;
		}
		G_MOVIE_DATA=json;
        if(changeLocation(G_MOVIE_DATA.cp_id)){
            window.name="kankanWindow";
            openWinPlay(movieid,(isNaN(subid)?null:subid),G_MOVIE_DATA.cp_id);
            return;
        }
		_ul_sub_item(json);		
		_play();
		_ul_movie_name(json);
		_ul_movie_info(json);	
        _ul_same(json);
        function _play(){
            if(subid){
			    G_CURSUB=subid;
			    $('sub_'+subid).click();
            }else{
                var sns=json.subnames;
                var alink=$('ul_sub_item').getElementsByTagName('a');
                var tmpIndex=alink.length;            
                var p1 = /(更新至)([0-9]+)(集|话)/;
                var p2 = /([\d]{4}\-[\d]{1,2}\-[\d]{1,2})(期)/;
                tmpIndex=alink.length-1;
                G_CURSUB=0;
                if(flag && "1"==flag+""){
                    alink[tmpIndex].click();
                }else{
                    try{
                        if(p1.test(json.other_desc)){                
                            _getLatestSub(sns,tmpIndex,0).click();
                        }else if(p2.test(json.other_desc)){
                            _getLatestSub(sns,tmpIndex,1).click();
                        }else{                
                            alink[0].click();
                        }	
                    }catch(e){
                        alink[0].click();
                    }
                }
            }
            function _getLatestSub(sns,lastIndex,type){
                var p1=/\[[\w\W]+\]/gmi;
                var p2=/[^\u0000-\u00FF]+/gmi;
                var p3=/(第)[0-9]+(集|话)/;
                var p4=/[0-9]+(集|话)/;
                var p=null;
                var last=sns[lastIndex];
                var start=lastIndex-1;
                var lastValue="",tmp="";
                if(type==0){if(p3.test(last)||p4.test(last)){p=p2;}else{p=p1;}}else{p=p2;}
                lastValue=last.split(p)[0];
                for(var i=start;i>=0;i--){
                    tmp=sns[i].split(p)[0];
                    if(tmp!=lastValue){return alink[i+1];}
                }
            }
        }
        function _ul_movie_name(o){
            $('h3_movie_name').innerHTML='<span class="r">'+(14==o.cp_id?"上传者："+o.userid:"内容提供商："+o.cp_name)+' | <a href="javascript:changeCacheDir();">设置</a></span>正在播放：'+o.movie_name;
        }
        function _ul_same(o){
            var s=o.newmovie;
            var size = s.length-1;
            var tmp="";
            for(var i=0;i<size&&i<2;i++){
                tmp+='<li><a href="javascript:_GP(\''+s[i].movieid+'\',null,\''+s[i].cp+'\',\'JH\');" title="点击播放&#13;&#10;'+s[i].moviename+'">'+s[i].moviename+'</a>&nbsp;<span>'+s[i].other+'</span></li>';
            }
            $("same").innerHTML = tmp;
            $("same_more").innerHTML = '<a href="javascript:;" onclick="$(\'subtype_hot_'+o.movie_type+'\').click()" class="more">更多</a>';
        }
		function _ul_sub_item(o){
			var names=o.subnames, ids=o.subids, pubs=o.subpubs;
            var isArt=(3==Math.floor(o.movie_type/100));
            var pattern=/([\d]{4}\-[\d]{1,2}\-[\d]{1,2})(期)/;
            if(isArt&&pattern.test(o.other_desc)){
                setArtSubs(null, true);
            }else{
                outputNormalSubs(names,ids,names.length);
            }
		}
		function _ul_movie_info(o){
            var s = '<h3>'+ o.movie_name +'的视频信息</h3><ul>';
            if(1==o.video_type){
                s+='<li class="actor"><span>标签：</span>'+sliceActor((o.tag).replace(/\|/g,","),72,true,'JA')+'</li><li class="small"><span>人气：</span>'+setHotLevel(o.play_time)+'</li><li class="small"><span>类型：</span>'+o.movie_type_name+'</li><li><span>简介：</span>'+slice(o.movie_desc,156)+'</li>';
            }else{
                s+='<li class="actor"><span>主演：</span>'+sliceActor(o.actor,72,true,'JA')+'</li><li class="small"><span>人气：</span>'+setHotLevel(o.play_time)+'</li><li class="small"><span>地区：</span>'+o.Area+'</li><li class="small"><span>年份：</span>'+o.year+'</li><li class="small"><span>类型：</span>'+o.movie_type_name+'</li><li><span>看点：</span>'+slice(o.focus,156)+'</li>';
            }
            s+='<li class="more"><span>您还可以</span> <a href="javascript:_GDL(\''+o.movie_name+'\',\'ID\');">下载</a> | <a onclick="_GDT(\''+o.movie_name+'\',\'JA\')" href="javascript:;">详情</a> | <a href="javascript:collectMovie('+o.movie_id+');">收藏</a> | <a href="javascript:shareIt();">复制分享</a> | <a href="javascript:feedBack('+o.movie_id+',\''+o.movie_name+'\',0);">提建议</a></li><li class="comment"><!--已有<span id="users">0</span>位用户发表了看法，--><a href="javascript:_GDC(\''+o.movie_name+'\',\'IC\');">点击查看用户评论</a></li></ul><div id="div_comment_note" style="width:150px;position:absolute;left:320px;bottom:-10px;background:#FFF2E9;line-height:18px;height:18px;border:1px solid #FF6600;display:none;text-align:center;"></div>';
			$('ul_movie_info').innerHTML=s;
		} 
        buildHotPlay('/list/vodlist_play.html?cacheTime='+getCacheTime());
    }
}
function setArtSubs(date, isfirst){
    var names=G_MOVIE_DATA.subnames, ids=G_MOVIE_DATA.subids;
    var pattern = /^(\d{4})\-(\d{1,2})\-(\d{1,2}).*/;
    var isMatch = false;
    var size = names.length;
    var defDate="";    
    for(var m=size-1; m>=0; m--){
       isMatch = pattern.test(names[m]);
       if(isMatch){
           defDate=(parseInt(RegExp.$1, 10)+"年"+parseInt(RegExp.$2, 10)+"月");
           break;
       }
    }
    if(!date){date=defDate;}
    outputArtSubs(date, isMatch, isfirst);
}
function outputArtSubs(_date, _isMatch, isfirst){
    var names=G_MOVIE_DATA.subnames, ids=G_MOVIE_DATA.subids;
    var pattern = /^(\d{4})\-(\d{1,2})\-(\d{1,2}).*/;
    var labels = [];
    var year=month=date=0;
    var size = names.length;
    var s1="",s2="",s3="",css="",a="",b="",c="";
    var isMatch = false;
    if(_isMatch){
        for(var i=0; i<size; i++){
            isMatch = pattern.test(names[i]);
            year=RegExp.$1;month=RegExp.$2;date=RegExp.$3;
            s1=parseInt(year, 10)+"年"+parseInt(month, 10)+"月";
            if(isMatch){
                if(labels.toString().indexOf(s1)==-1){
                    labels.push(s1);
                }
                if(_date.trim()==s1.trim()){css=""}else{css=' style="display:none;"'}
                s2+='<li'+css+'><a href="javascript:_G('+i+')" id="sub_'+ids[i]+'">'+names[i]+'</a></li>';
            }
        }
        labels.sort();
        var lSize = labels.length;
        var offset = 5;
        var offsetStart=lSize-offset<0?0:lSize-offset;
        var offsetEnd=lSize-1;
        if(isfirst){
            G_DATETIME_LABEL.lastIndex=lSize-1;G_DATETIME_LABEL.start=offsetStart;G_DATETIME_LABEL.end=offsetEnd;
        }else{
            offsetStart = G_DATETIME_LABEL.start;offsetEnd=G_DATETIME_LABEL.end;
        }
        if(lSize>0 && ""!=s2){
            s3='<li class="nobor"><a href="javascript:__pre();">&lt;&lt;上一月</a></li>';
            for(var j=0;j<lSize;j++){
                if(_date.trim()==labels[j].trim()){
                    G_DATETIME_LABEL.index=j;
                    a=' class="selected"'; b=" javascript:void(0);";
                }else{a="";b=' href="javascript:__cur('+j+');"';}
                if(j<offsetStart||j>offsetEnd){c=' style="display:none;"';}else{c="";}
                s3+='<li id="dtLabel'+j+'"'+a+''+c+'><a'+b+'>'+labels[j]+'</a></li>';
            }
            s3+='<li class="nobor"><a href="javascript:__next();">下一月&gt;&gt;</a></li>';
            $('ul_sub_label').innerHTML=s3;
            $('ul_sub_label').style.display="block";
            $('ul_sub_item').innerHTML=s2;  
            if(null!=$('sub_'+G_CURSUB)){$('sub_'+G_CURSUB).parentNode.className='selected';}
        }else{
            outputNormalSubs(names,ids,size);
        }        
    }else{
        outputNormalSubs(names,ids,size);
    }    
}
function setDateLabel(index){
    var label = null;
    label = $("dtLabel"+index);
    label.className = "selected";
    $("dtLabel"+G_DATETIME_LABEL.index).className = "";
    if(index < G_DATETIME_LABEL.start){
        $("dtLabel"+G_DATETIME_LABEL.end).style.display = "none";
        G_DATETIME_LABEL.start--;
        G_DATETIME_LABEL.end--;
    }
    if(index > G_DATETIME_LABEL.end){
        $("dtLabel"+G_DATETIME_LABEL.start).style.display = "none";
        G_DATETIME_LABEL.start++;
        G_DATETIME_LABEL.end++;
    }
    label.style.display = "block";    
}
function autoChangeDTLabel(subname){
    try{
        var pattern = /^(\d{4})\-(\d{1,2})\-(\d{1,2}).*/;
        var isMatch = pattern.test(subname);
        var date = null;
        var sLabel = null;
        if(isMatch){
            sLabel = $("dtLabel"+G_DATETIME_LABEL.index).firstChild.firstChild.nodeValue;
            date=(parseInt(RegExp.$1, 10)+"年"+parseInt(RegExp.$2, 10)+"月");
            if(date != sLabel){
                __next();
            }
        }
    }catch(e){};
}
function __pre(){
    var index=G_DATETIME_LABEL.index-1;
    if(index<0){return;}
    setDateLabel(index);
    outputArtSubs($("dtLabel"+index).firstChild.firstChild.nodeValue, true, false);
}
function __cur(index){
    setDateLabel(index);
    outputArtSubs($("dtLabel"+index).firstChild.firstChild.nodeValue, true, false);
}
function __next(){
    var index=G_DATETIME_LABEL.index+1;
    if(index>G_DATETIME_LABEL.lastIndex){return;}
    setDateLabel(index);
    outputArtSubs($("dtLabel"+index).firstChild.firstChild.nodeValue, true, false);
}
function outputNormalSubs(names,ids,size){
    var aHtml=[];
    $('ul_sub_label').style.display="none";
    for(var i=0,l=size;i<l;i++){                
        if(names[i]){
            if(G_SNO_FLAG && "1"==G_SNO_FLAG+"" && (ids[i]+"").indexOf("p")==-1){
                css=' style="display:none"';
            }else{css="";}
            aHtml[i]='<li'+css+'><a href="javascript:_G('+i+')" id="sub_'+ids[i]+'">'+names[i]+'</a></li>';
        }
    }
    $('ul_sub_item').innerHTML=aHtml.join('');
}
function _G(index){
    G_SUBINDEX = index;
	playMovie(index);
}
function getGCID(url){
    var gcid = (url.split("/")[4]).toUpperCase();
    return gcid;
}
function getCID(url){
    var cid = (url.split("/")[5]).toUpperCase();
    return cid;
}
function getFileSize(url){
    var fileSize = parseInt(url.split("/")[6], 16);
    return fileSize;
}
function getBitrate(url){
    var bit = parseInt(url.split("/")[9], 16);
    return bit;
}
function getMovieTime(fileSize, bitrate){
    return (fileSize * 8)/bitrate;
}
function sendResHasIP(){
    G_CDN_STAT_RES_HAS_IP.removeAttribute("src");
    G_CDN_STAT_RES_HAS_IP.src="http://kkpgv.xunlei.com/?u=res_has_ip";    
}
function sendResNoIP(){
    G_CDN_STAT_RES_NO_IP.removeAttribute("src");
    G_CDN_STAT_RES_NO_IP.src="http://kkpgv.xunlei.com/?u=res_no_ip";    
}
function sendNoRes(){
    G_CDN_STAT_NO_RES.removeAttribute("src");
    G_CDN_STAT_NO_RES.src="http://kkpgv.xunlei.com/?u=no_res";    
}
function sendSTSErr(){
    G_STS_STAT_ERR.removeAttribute("src");
    G_STS_STAT_ERR.src="http://kkpgv.xunlei.com/?u=websts_err_"+encodeURI(navigator.userAgent)+"_"+G_VERSION;    
}
function sendSTSNum(){
    G_STS_STAT_NUM.removeAttribute("src");
    G_STS_STAT_NUM.src="http://kkpgv.xunlei.com/?u=websts_num";    
}

function defaultPlayMovie(index){
    G_PRE_MOVIEINDEX=index;
    setCDNBalance(index,true);
}
function playMovie(index){
    var cp = G_MOVIE_DATA.cp_id;
    if(G_51TV==cp){
        G_PLAY_STARTTIME = new Date().getTime();  
        includeCooperateJS();
        if(G_PRE_MOVIEINDEX>-1){
            sendCooperatePackage("PCK@51TV#04",G_PRE_MOVIEINDEX,new Date().getTime());
        }
        sendCooperatePackage("PCK@51TV#01",index,G_PLAY_STARTTIME,null);
        //sendCooperatePackage("PCK@51TV#02",index,new Date().getTime(),"V-_adseg_nike_3");
    }else{
        defaultPlayMovie(index);
    }
}
function corePlayMovie(index){
    G_IPLAYINGAD=0;
    var oPlayer=G_DAPCTRL_INSTANCE;
    var hasNext=G_MOVIE_DATA.subids[index+1]?true:false;	
	var movieid=G_MOVIE_DATA.movie_id;
	var subid=G_MOVIE_DATA.subids[index];
	var pubid=G_MOVIE_DATA.subpubs[index];
    var url=G_MOVIE_DATA.suburls[index];
	var aCid=formateCID(movieid,subid);
    /*
	if(pubid==0||pubid==10||pubid==11){
		oPlayer.CID2="NOVDA";
	}else{
		oPlayer.CID2=aCid[0];
	}
	oPlayer.CID=aCid[1];
    */
    oPlayer.Put("sCID", getCID(url));
    oPlayer.Put("sUserName", getCookie("usrname"));
    oPlayer.Put("iUrlType", 1);
    oPlayer.Put("iLinkFrom",G_CPID);

    setInfo(movieid,G_MOVIE_DATA.movie_name,G_MOVIE_DATA.cp_id,subid,G_MOVIE_DATA.subnames[index],G_MOVIE_DATA.subids[index+1]||'NO',G_MOVIE_DATA.subnames[index+1]||'NO');
	changeSubStyle(subid);	
	G_PLAY_SATE_TEXT[0]=G_MOVIE_DATA.movie_name;
	G_PLAY_SATE_TEXT[1]=(G_MOVIE_DATA.cp_id==14?"上传者:"+G_MOVIE_DATA.userid:"内容商:"+G_MOVIE_DATA.cp_name);
	G_PLAY_SATE_TEXT[2]=G_MOVIE_DATA.subnames[index];

    autoChangeDTLabel(G_MOVIE_DATA.subnames[index]);
	//openVodurl(url,0);
    if(hasNext && checkKankanVersion(G_VERSION,92)){
	    G_PRE_INTERVAL=setTimeout(function(){setCDNBalance(index+1, false)},60000);
    }
	function formateCID(mid,subid){
		var aCid = [];
		var sZero = "00000000";
		var aTemp = mid.toString().split("");
		var sMid = sZero.slice(0,8-aTemp.length)+mid;
		aCid[0] = "00000000000000000000000000000000"+sMid;
		aTemp = subid.toString().split("");
		var sSubid = sZero.slice(0,8-aTemp.length)+subid;
		aCid[1] = "000000000000000000000000"+sMid+sSubid;
		return aCid;
	}
	function changeSubStyle(subid){
		if(G_CURSUB!=0){
			$('sub_'+G_CURSUB).parentNode.className='';
		}		
		$('sub_'+subid).parentNode.className='selected';
		G_CURSUB=subid;
	}
}
function replaceVodURL(oldAddr,newAddr){
    if("" != newAddr){
        var items = oldAddr.split("/");
        items.splice(2,1,newAddr);
        oldAddr=items.join("/");
    }
    return (oldAddr.lTrim()).rTrim();
}


function setCDNBalance(url){
    var gcid=getGCID(url);
    getCDNManageData(url);
}
function getCDNManageData(url){
    var oPlayer=document.getElementById("pplayer");
    var gcid=getGCID(url);
    var ifr=document.createElement("iframe");
    var vodurl = url;
    ifr.style.cssText="display:none";
    $P(ifr);
    ifr.src="http://cl.kankan.xunlei.com/getCdnresource/"+gcid;
    ifr.attachEvent("onload", function(){
        try{
            var json = ifr.contentWindow.jsonObj;
            var list = json.cdnlist1;
            var size = list.length;
            if(size > 0){
                vodurl = replaceVodURL(vodurl,list[0].ip+":"+list[0].port);
            }
        }catch(e){}
		openVodurl(vodurl,0);
        $R(ifr);
    });
}

function openVodurl(vodurl,pay){
	G_DAPCTRL_INSTANCE.Put("sUrlType", "vod");
    vodurl = G_DAPCTRL_INSTANCE.GetPlayUrlSync(vodurl);
    G_DOWNLOAD_SPEED_INTERVAL=setInterval("setDownloadSpeed()", 1000);
	var movie={
        'URL':vodurl,
        'Desc':''
    }
    $("kankanPlayer").MP_PlayMovie(movie);
}

function playNextSubAuto(){
	var o=$('sub_'+G_CURSUB);
	if(o&&o.parentNode.nextSibling){
        o.parentNode.nextSibling.getElementsByTagName('a')[0].click();
    }else{
        $("kankanPlayer").MP_Stop();
    }
}
function generateSerialNumber(){
    var prefix = new Date().getTime();
    var suffix = (Math.random()+"").substr(5,10);
    return prefix+"_"+suffix;
}G_REQ_SERIAL_NUMBER = generateSerialNumber();
function getPeerID(){
    try{
        var pplayer=G_DAPCTRL_INSTANCE;
        var peerID=pplayer.get("speerid") || "0000000000000000";
        return peerID;
    }catch(e){return 0;}
}
function includeCooperateJS(){
    _51tvContentNo = G_MOVIE_DATA.movie_id;
    _51tvContentName = G_MOVIE_DATA.movie_name;
    _51tvUserName = getPeerID();
    var s = $C("script");
    s.type="text/javascript";
    s.language="javascript";
    s.src="http://d.51tv.com/js/_51tvCooperateXunLei.js";
    $P(s, document.getElementsByTagName("header")[0]||null);
    s.attachEvent("onreadystatechange",function(){
        var state = s.readyState;
        if("loaded"==state){
            $P(_51tvCreateScript(), document.getElementsByTagName("header")[0]||null);
            $R(s,document.getElementsByTagName("header")[0]||null);
        }
    });
}
function sendCooperatePackage(){
    var args = arguments.callee.arguments;  
    var url = G_MOVIE_DATA.suburls[args[1]];
    var partnerCode = "XunLei";
    var username = getPeerID();
    var contentno = G_MOVIE_DATA.code;
    var contentname = G_MOVIE_DATA.movie_name;
    var contentindex = getContentIndex();
    var contentSubIndex = args[1];
    G_CONTENTSUBINDEX = args[1];
    switch(args[0])
    {
        case "PCK@51TV#01":
            playMonitor();break;
        case "PCK@51TV#02":
            getADInfoMonitor();break;
        case "PCK@51TV#03":
            insertADMonitor();break;
        case "PCK@51TV#04":
            stopMonitor();break;
        default:
            break;
    }
    function playMonitor(){//监播
        var action = 600;        
        var starttime = args[2];
        var adpolicy = args[3];
        var pck="http://d.51tv.com/cooperate/`"+partnerCode+"`"+action+"`"+G_REQ_SERIAL_NUMBER+"`"+username+"`"+contentno+"`"+contentname+"`"+contentindex+"`"+contentSubIndex+"`"+starttime+"`"+adpolicy+"`.html";
        sendPackage(args[0], pck);
    }
    function getADInfoMonitor(){//获取广告        
        var action = 500;
        var starttime = args[2];
        var adpolicy = args[3];
        var pck="http://d.51tv.com/cooperate/`"+partnerCode+"`"+action+"`"+G_REQ_SERIAL_NUMBER+"`"+username+"`"+contentno+"`"+contentname+"`"+contentindex+"`"+contentSubIndex+"`"+starttime+"`"+adpolicy+"`.html";
        sendPackage(args[0], pck);
    }
    function insertADMonitor(){//广告插入
        var action = 510;
        var playadno = args[2];
        var playadname = args[3]; 
        var playadtype = args[4]
        var playadstarttime = args[5];
        var playadfinishtime = args[6];
        var playadduration = args[7];
        var playadflux = args[8];
        var playadurl = args[9];
        var pck="http://d.51tv.com/cooperate/`"+partnerCode+"`"+action+"`"+G_REQ_SERIAL_NUMBER+"`"+username+"`"+contentno+"`"+contentname+"`"+contentindex+"`"+contentSubIndex+"`"+playadno+"`"+playadname+"`"+playadtype+"`"+playadstarttime+"`"+playadfinishtime+"`"+playadduration+"`"+playadflux+"`"+playadurl+".html";
        sendPackage(args[0], pck);
    }
    function stopMonitor(){//停止播放
        var fileSize = getFileSize(url);
        var bitRate = getBitrate(url);
        var time = getMovieTime(fileSize, bitRate);        
        var action = 320; 
        var starttime = G_PLAY_STARTTIME;
        var finishtime = args[2];
        var ms=(0==G_PLAY_STARTTIME)?0:(finishtime-G_PLAY_STARTTIME);
        var duration = 0==ms?0:Math.round(ms/60000);
        var flux = 0;/*Math.floor(((duration*60*bitRate)/8)/1024/1024);*/
        var pck="http://d.51tv.com/cooperate/`"+partnerCode+"`"+action+"`"+G_REQ_SERIAL_NUMBER+"`"+username+"`"+contentno+"`"+contentname+"`"+contentindex+"`"+contentSubIndex+"`"+starttime+"`"+finishtime+"`"+duration+"`"+flux+"`.html";
        sendPackage(args[0], pck);
    }
    function getContentIndex(){
        var type=G_MOVIE_DATA.movie_type;
        var subName=G_MOVIE_DATA.subnames[args[1]];
        var index = 1;
        var pattern=""
        if(type > 199 && type < 300){
            index = parseInt(subName.replace(/[^\u0000-\u00FF]+/gi,""), 10);
        }
        return index;
    }
    function resonseBodyDeal(type){
        switch(type){
            case "PCK@51TV#01"://_51tvPlayCheckRes
                try{
                    if("200"==_51tvPlayCheckRes.code && "1"==_51tvPlayCheckRes.copyrightStatus){
                        defaultPlayMovie(args[1]);
                    }else{
                        if("-1" == _51tvPlayCheckRes.code){
                            alert("签权时发生未知错误");
                        }else{
                            alert("["+_51tvPlayCheckRes.code+"] " + _51tvPlayCheckRes.msg);
                        }
                    }
                }catch(e){
                    alert("获取版权时发生系统内部错误");
                }break;
            case "PCK@51TV#02"://_51tvAdFetchRes
                break;
            case "PCK@51TV#03"://_51tvAdReportRes
                break;
            case "PCK@51TV#04"://_51tvPlayReportRes
                break;
            default:
                break;
        }
    }
    function sendPackage(type, pck){
        var s = $C("script");
        s.type="text/javascript";
        s.language="javascript";
        s.lang="zh-cn";
        s.src=pck;
        $P(s, document.getElementsByTagName("header")[0]||null)
        s.attachEvent("onreadystatechange",function(){
            var state = s.readyState;
            if("loaded"==state){
                resonseBodyDeal(type);
                $R(s,document.getElementsByTagName("header")[0]||null);
            }
        });
    }
}
function collectMovie(movieid){
	logForClick('IE');
	if(!getUserInfo()){
		return showLogin();
	}
	var ifr=$C('<iframe id="ifr_collection" style="display:none">');
    $P(ifr);
	ifr.src='http://bdynamic.xunlei.com/cgi-bin/cgi_kankan_collect?hallid='+movieid+'&catchtime='+getCacheTime();
	ifr.attachEvent('onload',function(){
		var return_code = $("ifr_collection").contentWindow.return_code;
		switch(return_code){
			case "0":
				getCollectionNum(getCookie("usrname"));
				commentNote('收藏该片成功');
			break;
			case "1":
				showLogin();
			break;
			case "2":
				commentNote('您已经收藏过该影片');
			break;
			case "3":
				commentNote('以超过您收藏数量上限');
			break;
			case "4":
				commentNote('抱歉，操作失败');
			break;
		}
		$R($('ifr_collection'));
	});
}
function commentNote(s){
	var o=$('div_comment_note');
	o.innerHTML=s;
	setTimeout(hideIt,2000);
	$('div_comment_note').style.display='block';
	function hideIt(){
		$('div_comment_note').style.display='none';
	}
}
function printRelative(o){
    var a=[G_HOTPLAY_DATA.hot_all,G_HOTPLAY_DATA.hot_movie,G_HOTPLAY_DATA.hot_serial,G_HOTPLAY_DATA.hot_art,G_HOTPLAY_DATA.hot_cartoon];
    var sHtml='',o=o.relative;
    var _l=o.length-1,i=0;
    var tmp=null;
    var tmpid=",";
    for(i=0; i<_l&&i<4; i++){
        sHtml += '<li><a title="点击播放&#13;&#10;'+o[i].movie_name+'" href="javascript:_GP('+o[i].movie_id+',null,\''+o[i].cp_id+'\',\'JB\')" class="img"><img onabort="this.src=this.src" src="'+o[i].pic_url+'" onmouseover="showItemDetail(\''+o[i].movie_name+'\',\''+o[i].actors+'\',\''+o[i].other_desc+'\','+o[i].play_time+','+o[i].year+',null,0,-1,-1,\''+o[i].attract+'\',\''+o[i].cp_id+'\',\''+o[i].cp_name+'\',\''+o[i].userid+'\',1)" onmousemove="showItemDetail(\''+o[i].movie_name+'\',\''+o[i].actors+'\',\''+o[i].other_desc+'\','+o[i].play_time+','+o[i].year+',null,0,-1,-1,\''+o[i].attract+'\',\''+o[i].cp_id+'\',\''+o[i].cp_name+'\',\''+o[i].userid+'\',1)" onmouseout="hideItemDetail()"/><span class="back"></span><span>'+o[i].other_desc+'</span></a><a href="javascript:_GP('+o[i].movie_id+',null,\''+o[i].cp_id+'\',\'JB\')" title="点击播放&#13;&#10;'+o[i].movie_name+'">'+o[i].movie_name+'</a></li>'; 
        tmpid+=o[i].movie_id+",";
    }
    for(var j=i; j<4; j++){
        var main = Math.floor(Math.random()*a.length);
        var sub = Math.floor(Math.random()*(a[main].length-1));
        tmp=a[main][sub];
        if(tmpid.indexOf(","+tmp.movie_id+",")!=-1){
            tmp=a[main][Math.abs(sub-1)];
        }
        tmpid+=tmp.movie_id+",";
        sHtml += '<li><a title="点击播放&#13;&#10;'+tmp.movie_name+'" href="javascript:_GP('+tmp.movie_id+',null,\''+tmp.cp_id+'\',\'JB\')" class="img"><img onabort="this.src=this.src" src="'+tmp.img_url+'" onmouseover="showItemDetail(\''+tmp.movie_name+'\',\''+tmp.actors+'\',\''+tmp.other_desc+'\','+tmp.play_time+','+tmp.year+',null,0,-1,-1,\''+tmp.attract+'\',\''+tmp.cp_id+'\',\''+tmp.cp_name+'\',\''+tmp.userid+'\',1)" onmousemove="showItemDetail(\''+tmp.movie_name+'\',\''+tmp.actors+'\',\''+tmp.other_desc+'\','+tmp.play_time+','+tmp.year+',null,0,-1,-1,\''+tmp.attract+'\',\''+tmp.cp_id+'\',\''+tmp.cp_name+'\',\''+tmp.userid+'\',1)" onmouseout="hideItemDetail()"/><span class="back"></span><span>'+tmp.other_desc+'</span></a><a href="javascript:_GP('+tmp.movie_id+',null,\''+tmp.cp_id+'\',\'JB\')" title="点击播放&#13;&#10;'+tmp.movie_name+'">'+tmp.movie_name+'</a></li>'; 
    }
    return sHtml;
}
function printLeiyouPlay(obj){
    var s="";
    try{
        if(null != G_TIMER_DATA){
            var o=G_TIMER_DATA.recentview;
            var n=o.length-1;        
            for(var i=0;i<n&&i<4;i++){
                s += '<li><a title="点击播放&#13;&#10;'+o[i].movie_name+'" href="javascript:_GP('+o[i].movie_id+',null,\''+o[i].cp_id+'\',\'JI\')" class="img"><img id="oImg_'+i+'" onabort="this.src=this.src" src="'+o[i].img_url+'" onmouseover="showItemDetail(\''+o[i].movie_name+'\',\''+(o[i].actors.replace(/\|/gm,","))+'\',\''+o[i].other_desc+'\','+o[i].play_time+','+o[i].year+',null,0,-1,-1,\''+o[i].attract+'\',\''+o[i].cp_id+'\',\''+o[i].cp_name+'\',\''+o[i].userid+'\',1)" onmousemove="showItemDetail(\''+o[i].movie_name+'\',\''+(o[i].actors.replace(/\|/gm,","))+'\',\''+o[i].other_desc+'\','+o[i].play_time+','+o[i].year+',null,0,-1,-1,\''+o[i].attract+'\',\''+o[i].cp_id+'\',\''+o[i].cp_name+'\',\''+o[i].userid+'\',1)" onmouseout="hideItemDetail()"/><span class="back"></span><span>'+o[i].other_desc+'</span></a><a href="javascript:_GP('+o[i].movie_id+',null,\''+o[i].cp_id+'\',\'JI\')" title="点击播放&#13;&#10;'+o[i].movie_name+'">'+o[i].movie_name+'</a></li>'; 
            }
        }else{
            var ifr=$C("iframe");
            ifr.style.cssText="display:none";
            $P(ifr);
            ifr.src="/list/vodlist_timer.html?cacheTime="+getCacheTime();
            ifr.attachEvent("onload",function(){
                var json=ifr.contentWindow.jsonObj;
                G_TIMER_DATA=json;
                s=printLeiyouPlay(obj);
                if(""==s){
                    $('CRTitle').innerHTML = "看过该片的人还看过";
                    $('ul_relative').innerHTML=printRelative(G_MOVIE_DATA); 
                    obj.innerHTML = "看看其他雷友正在看什么？";
                }else{
                    $('CRTitle').innerHTML = "看看其他雷友正在看什么";
                    $('ul_relative').innerHTML=s;
                    obj.innerHTML = "返回看过该片的人还看过";
                }
                $R(ifr);
            });
        }
    }catch(e){
        s="";
    }
    return s;
}
function changeRelative(obj){
    var nodeValue = obj.firstChild.nodeValue;
    var s = ""
    if("看看其他雷友正在看什么？"==nodeValue){        
        if(null==G_TIMER_DATA){
            printLeiyouPlay(obj);
        }else{
            s=printLeiyouPlay(obj);
            if(""==s){
                $('CRTitle').innerHTML = "看过该片的人还看过";
                $('ul_relative').innerHTML=printRelative(G_MOVIE_DATA); 
                obj.innerHTML = "看看其他雷友正在看什么？";
            }else{
                $('CRTitle').innerHTML = "看看其他雷友正在看什么";
                $('ul_relative').innerHTML=s;
                obj.innerHTML = "返回看过该片的人还看过";
            }
        }
    }else{
        $('CRTitle').innerHTML = "看过该片的人还看过";
        $('ul_relative').innerHTML=printRelative(G_MOVIE_DATA); 
        obj.innerHTML = "看看其他雷友正在看什么？";
    }
}
function printNewShortV(obj,mid){
    var str = '<span style="display:none;"><a id="new_shortart_1">四川汶川7.8级地震视频专题</a></span><h2><a href="javascript:;" onclick="$(\'subtype_hot_1207\').click()" class="more">更多</a>四川汶川7.8级地震视频专题<span style="color:#666666;"></span></h2><div class="relLink"><label>合作媒体：</label><a href="http://news.163.com/special/00012MS5/sichuan0512.html" target="_blank">网易</a> <a href="http://news.sohu.com/s2008/dizhen/" target="_blank">搜狐</a> <a href="http://news.sina.com.cn/z/08earthquake/index.shtml" target="_blank">新浪</a></div><div class="list7"><div id="scrollNews"><iframe frameborder="0" border="0" width="516" height="90" marginwidth="0" marginheight="0" vspace="0" hspace="0" scrolling="no" src="/scrollNews.html"></iframe></div><ul>'+generateShortVideoUpdate(obj,'IJ',mid)+'</ul></div>';
    return str;
}
function buildHotPlay(url){
	var ifr=$C('<iframe id="ifr_get_hot_paly" style="display:none">');
    $P(ifr);
	ifr.src=url;
	ifr.attachEvent('onload',callback);
	function callback(){
		var jsonObj=$('ifr_get_hot_paly').contentWindow.jsonObj;
		G_HOTPLAY_DATA=jsonObj;
		$R($('ifr_get_hot_paly'));
        var a=[jsonObj.hot_all,jsonObj.hot_movie,jsonObj.hot_serial,jsonObj.hot_art,jsonObj.hot_cartoon];
		$('ul_relative').innerHTML=printRelative(G_MOVIE_DATA);
        $('CRLink').innerHTML='<a href="javascript:;" onclick="changeRelative(this)" class="more">看看其他雷友正在看什么？</a>';
		$('totay_shortart').innerHTML=printNewShortV(jsonObj.new_shortart,G_MOVIE_DATA.movie_id);		
		var o;
		var aHtml='';
		for(var i=0;i<a.length;i++){
			o=a[i];
			aHtml+='<ul class="rank_list" style="display:none;">';
            for(var j=0;j<o.length && j<10;j++){
                if(j<3){
                    aHtml+='<li class="top3"><em>'+(j+1)+'</em><a title="点击播放&#13;&#10;'+o[j].movie_name+'" href="javascript:_GP('+o[j].movie_id+',null,\''+o[j].cp_id+'\',\'JD\')">'+slice(o[j].movie_name,14)+'</a><span>'+slice(o[j].other_desc,10)+'</span></li>';
                }else{
                    aHtml+='<li><em>'+(j+1)+'</em><a title="点击播放&#13;&#10;'+o[j].movie_name+'" href="javascript:_GP('+o[j].movie_id+',null,\''+o[j].cp_id+'\',\'JD\')">'+slice(o[j].movie_name,14)+'</a><span>'+slice(o[j].other_desc,10)+'</span></li>';
                }
            }
            aHtml+="</ul>"
		}
		$('div_hot_content').innerHTML=aHtml;
		switchHot(Math.floor(Math.random()*5));			
        setTruns(jsonObj.posterlist,"JE");
        drawHeader();
	}
}
function switchHot(index){
	var a=$('ul_hot_title').childNodes;
	var b=$('div_hot_content').childNodes;
	for(var i=0;i<5;i++){
		a[i].className='';
		b[i].style.display='none';
	}
	a[index].className='selected';
	b[index].style.display='block';
}
function shareIt(){
	logForClick('IA');
	copyToClip('《'+G_MOVIE_DATA.movie_name+'》来自迅雷看看--免费高清电影在线播放\r\nhttp://play.kankan.xunlei.com/?hallid='+G_MOVIE_DATA.movie_id+'&subid='+G_CURSUB+'&id=38');	
	alert('已复制到剪贴板！');
}
function feedBack(mid,mn,t){
	openAndLog('http://kankan.xunlei.com/feedback.html?mid='+mid+'&mn='+mn+'&t='+t,'IB');
}
function jumpToKankan(){
	var cpid = getParameter("cpid");
	var id = getParameter("id");
    var tmpId;
	tmpId=id==null?cpid:id;
    G_CPID=tmpId==null?-1:parseInt(tmpId, 10);
	getMovieInfo(getParameter("hallid"),getParameter("subid"));
}
function sentPV(){
    $("ifr_pgv").attachEvent("onload",setSysTime);
    $("ifr_pgv").src="http://dynamic.kankan.xunlei.com/fcg-bin/cgi_pv_statis.fcg?u='"+encodeURIComponent((window.location.href+"default=2").replace(/\?|&|#/g,""))+"'&catchTime="+getCacheTime();
}
function sendStartPGV(){
	$("ifr_pgv").src='http://kkpgv.xunlei.com/?u=kankan_play_start_208';
}
function changeCacheDir(){
    logForClick('IF');
    var str='<div class="change_cache" style="line-height:1.5em;"><div class="cc_div">&nbsp;&nbsp;&nbsp;&nbsp;检测到您目前的看看播放组件版本过低，不支持该功能，建议您升级到最新版本看看播放组件后再使用。 <div id="upgradeNow"><a onclick="window.open(\''+g_sThunderSteup_url+'\')" style="cursor:pointer;">立即升级更新</a></div></div></div>';
    if(pplayer.CacheCanModified==1){
        str='<div class="change_cache"><span>提示：修改目录后，需关闭所有页面，重启迅雷5后方可生效。暂不支持WEB迅雷用户。缓存最多占用900M。</span><label for="cacheDir">选择目录：<input class="dir" name="cacheDir" id="cacheDir" readonly="readonly" value="'+(pplayer.VodCachePath?pplayer.VodCachePath:"")+'" type="text" />&nbsp;<input type="button" value="浏览..." onclick="modifyCacheDir()" /></label><ul><input id="sureModify" type="button" value="确定" />&nbsp;&nbsp;<input id="cancelModify" type="button" value="取消" /></ul></div>';  
        showDailogBox("修改看看缓存目录",str,true,392,158,135);
        $("sureModify").attachEvent("onclick",function(){if(G_CACHE_PATH){pplayer.VodCachePath = G_CACHE_PATH;}hideDailogBox();});
        $("cancelModify").attachEvent("onclick",function(){hideDailogBox();}); 
    }else{
        showDailogBox("修改看看缓存目录",str,true,392,158,135);
    }
    
}
function modifyCacheDir(){
   G_CACHE_PATH = pplayer.OpenDirDialog();  
   if(G_CACHE_PATH){$("cacheDir").value=G_CACHE_PATH;}
}
var Drag={
	x : 0,
	y : 0,
	iOffsetX : 0,
	iOffsetY : 0,
	sObjHTML : '',
	oTargetId : '',
	oTargetObj : null,
	iDragEnabled : false,
	initialize : function(id){
		Drag.oTargetId=id;
		document.onmousedown = this.drag;
		document.onmouseup = function(){
			document.onmousemove = null;
		};
	},
	disableDrag : function(){
		Drag.oTargetId=null;
		document.onmousedown = document.onmouseup = null;
	},
	drag : function(e){
		window.event.cancelBubble=true;
		var oEvent = e? e:window.event;
		this.oTargetObj = e? e.target:event.srcElement;
		if (this.oTargetObj.id == Drag.oTargetId){
			this.iDragEnabled = true;
			var oStyle = this.oTargetObj.offsetParent.style;
			if (isNaN(parseInt(oStyle.left))){
				oStyle.left = 0;
			}
			if (isNaN(parseInt(oStyle.top))){
				oStyle.top = 0;
			}
			this.iOffsetX = parseInt(oStyle.left);
			this.iOffsetY = parseInt(oStyle.top);
			this.x = oEvent.clientX;
			this.y = oEvent.clientY;
			if (oEvent.preventDefault){
				oEvent.preventDefault();		
			}
			document.onmousemove=Drag.move;
		}
	},
	move : function(e){
		var oEvent = e? e:window.event;
		var obj = this.oTargetObj.offsetParent;
		var oStyle = obj.style;
		var oP = {x:this.iOffsetX + oEvent.clientX - this.x ,y:this.iOffsetY + oEvent.clientY - this.y }
		var winSize = getWindowSize();
		if(oP.x>0&&oP.x<=winSize.Width-obj.offsetWidth-1){oStyle.left = oP.x+"px";}
		if(oP.y>0&&oP.y<=winSize.Height-obj.offsetHeight-1){oStyle.top = oP.y+"px";}
		return;
	}
}
function setDStyle(obj,css){
	var arr1=css.split(";"),l=arr1.length,o=obj.style,arr2=[];
	for(var i=0;i<l;i++){
		arr2 = arr1[i].split(":");
		o[arr2[0]] = arr2[1];
	}
}
function initDailog(){
	var winSize = getWindowSize();
	var p = $C('<div id="DailogPop">');
	p.style.zIndex='104';
	setDStyle(p,'display:none;width:100%;height:'+getWindowSize().Height+'px;filter:alpha(opacity=50);background:#ffffff;position:absolute;left:0px;top:0px;');
	var o = $C('<div id="DailogBox" class="div_dailog_box" >');
	setDStyle(o,'top:'+(winSize.Height-200)/2+'px;left:'+(winSize.Width-300)/2+'px');
	o.innerHTML = '<div id="DailogHead" class="div_dailog_head" unselectable="on"><span><a onclick="hideDailogBox();" style="cursor:pointer" alt="关闭"  class="a_close">关闭</a></span><a id="span_DailogTitle">看看提醒您</a></div><div id="DailogBody" class="div_dailog_body" ></div>';
	$P(p);$P(o);
	window.attachEvent("onresize",function(){
		var winSize = getWindowSize();
		$('DailogPop').style.height=winSize.Height+'px';
		$('DailogPop').style.width=winSize.Width+'px';
	});
}
function showDailogBox(t,s,m,boxWidth,boxHeight,bodyHeight){
	if(m){
		Drag.initialize("DailogHead");
		$("DailogHead").style.cursor="move";
	}else{
		Drag.disableDrag();
		$("DailogHead").style.cursor="default";
	}
	var dbody=$("DailogBody");
	var dbox =$("DailogBox");
	var winSize = getWindowSize();
	$("span_DailogTitle").innerHTML=t;
	dbody.innerHTML = s;
	if(boxWidth&&boxHeight){
		setDStyle(dbox,'width:'+boxWidth+'px;height:'+boxHeight+'px;top:'+(680-boxHeight)/2+'px;left:'+(winSize.Width-boxWidth)/2+'px');
	}
	if(bodyHeight){
		setDStyle(dbody,'height:'+bodyHeight+'px');
	}
	hidePlayer();
	$("DailogPop").style.display="block";
	dbox.style.display="block";
}
function hideDailogBox(){
	$("DailogBox").style.display="none";
	$("DailogPop").style.display="none";
	displayPlayer();
}
