
var G_BUILD_VERSION=0;
var G_FLA_VERSION=0;
var G_TV5_BUILD=0;
var G_TV6_BUILD=0;
var G_WTV_BUILD=0;
var G_DAPCTRL_VER=0;
var G_VERSION=0;
var G_OCX_XPLAYER=null;
var G_CLICK_STAT=new Image(1,1);
var G_IS_HOMEPAGE = false;
window.onerror=function(){return true;}
var isIE=(navigator.appName).indexOf("Microsoft")!=-1;if(window.Event&&!isIE){function SearchEvent(){var func=SearchEvent.caller;while(func!=null){var arg=func.arguments[0];if(arg){if(String(arg.constructor).indexOf('Event')>-1){return arg}}func=func.caller}return null};window.constructor.prototype.__defineGetter__("event",function(){return SearchEvent()});Event.prototype.__defineSetter__("returnValue",function(bool){if(!bool){this.preventDefault()}return bool});Event.prototype.__defineSetter__("cancelBubble",function(bool){if(bool){this.stopPropagation()}return bool});Event.prototype.__defineGetter__("clientX",function(){return this.pageX});Event.prototype.__defineGetter__("clientY",function(){return this.pageY});Event.prototype.__defineGetter__("keyCode",function(){return this.which});Event.prototype.__defineGetter__("button",function(){return this.which});Event.prototype.__defineGetter__("srcElement",function(){var n=this.target;while(n.nodeType!=1){n=n.parentNode}return n});Event.prototype.__defineGetter__("offsetX",function(){return this.layerX});Event.prototype.__defineGetter__("offsetY",function(){return this.layerY});Event.prototype.attachEvent=function(type,handler){this.addEventListener(type.substring(2),handler,true)};Event.prototype.detachEvent=function(type,handler){this.removeEventListener(type.substring(2),handler,true)};window.constructor.prototype.attachEvent=function(type,handler){this.addEventListener(type.substring(2),handler,true)};window.constructor.prototype.detachEvent=function(type,handler){this.removeEventListener(type.substring(2),handler,true)};document.constructor.prototype.attachEvent=function(type,handler){this.addEventListener(type.substring(2),handler,true)};document.constructor.prototype.detachEvent=function(type,handler){this.removeEventListener(type.substring(2),handler,true)};Element.prototype.attachEvent=function(type,handler){this.addEventListener(type.substring(2),handler,true)};Element.prototype.detachEvent=function(type,handler){this.removeEventListener(type.substring(2),handler,true)};HTMLElement.prototype.attachEvent=function(type,handler){this.addEventListener(type.substring(2),handler,true)};HTMLElement.prototype.detachEvent=function(type,handler){this.removeEventListener(type.substring(2),handler,true)}}
function checkOldComponent(){
    var dapCtrl = null;
    var _iThunderVersion = 0;
    var _result = 0;
    try{
        dapCtrl = new ActiveXObject("DapCtrl.DapCtrl");
        _iThunderVersion = dapCtrl.Get("iThunderVersion");
        if(330 == _iThunderVersion){
            _result = 3;
        }else{
            if(_iThunderVersion >= 463){
                _result = 1;
            }else if(_iThunderVersion < 0){
                _result = 2;
            }else if(_iThunderVersion > 0 && _iThunderVersion < 463){
                _result = -1;
            }
        }
    }catch(e){_result=-1;_iThunderVersion=0;}finally{dapCtrl = null;}
    return {result:_result, iThunderVersion:_iThunderVersion};
}
function $init(){
    var xplayer = null;
    var com = checkOldComponent();
    try{
        xplayer = new ActiveXObject("PPlayer.XPPlayer");
        var ver = xplayer.PlayerVersion;
        var build = parseInt(ver.split(".")[3],10);
        G_BUILD_VERSION = build;
        G_OCX_XPLAYER=xplayer;
        G_VERSION=ver;
        G_DAPCTRL_VER=xplayer.Get("iVersion");
        if(com.result > 0 && undefined == G_DAPCTRL_VER){
            switch(com.result){
                case 1: G_TV5_BUILD = com.iThunderVersion;break;
                case 2: G_WTV_BUILD = Math.abs(com.iThunderVersion);break;
            }
        }else if(-1 == com.result){
            G_OCX_XPLAYER = null;
            G_VERSION = 0;
            G_BUILD_VERSION = 0;
            G_DAPCTRL_VER = 0;
        }else{
            G_TV5_BUILD=xplayer.Get("iTVBuild");
            G_TV6_BUILD=xplayer.Get("iTV6Build");
            G_WTV_BUILD=xplayer.Get("iWTVBuild");
        }
    }catch(e){}finally{xplayer = null;}
    com = null;
    var pattern = /(\d+\,?)+/;
    var swf = null;
    var sVersion = 0;
    try{
        swf = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        sVersion = pattern.exec(swf.GetVariable("$version"));
        G_FLA_VERSION = parseInt(sVersion, 10);
    }catch(e){}finally{swf=null;pattern=null;}
}$init();
function cacheBackground(){
    try{
        var userAgent = navigator.userAgent.toLowerCase();
        var env = null;
        var ver = 0;
        env = userAgent.match(/msie ([\d.]+)/);
        ver = env ? parseInt(env[1], 10) : 0;
        if(ver == 6){
            document.execCommand("BackgroundImageCache", false, true);
        }
    }catch(e){}
}cacheBackground();
if(document.documentElement.addBehavior){document.documentElement.addBehavior("#default#userData");}
function setUserData(key, value, iExpires){
    with(document.documentElement){
        try{
            load("XUNLEI_KANKAN");
        }catch(e){
            save("XUNLEI_KANKAN");
            load("XUNLEI_KANKAN");
        }
        expires = new Date((new Date().getTime())+(iExpires*3600000)).toUTCString();
        setAttribute(key, value);
        save("XUNLEI_KANKAN");
    }
}
function getUserData(key){
    with(document.documentElement){
        try{
            load("XUNLEI_KANKAN");
        }catch(e){
            save("XUNLEI_KANKAN");
            load("XUNLEI_KANKAN");
        }
        return getAttribute(key);
    }
}
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;
        }
        try{
            return decodeURIComponent(document.cookie.substring(offset, end));
        }catch(e){
            try{
                return unescape(document.cookie.substring(offset, end));
            }catch(e1){
                return 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 + "=" + encodeURIComponent(value) + "; path=/; domain=xunlei.com; expires=" + expireDate.toGMTString();
    }else{
        document.cookie = name + "=" + encodeURIComponent(value) + "; path=/; domain=xunlei.com";
    }
}
var ioCtrl = {
    ioWriter:function(name,value,hours){
        if(G_DAPCTRL_VER>200000){
            this.ioCtrlWriter(name,value,hours||null);
        }else{
            if(hours){
                setCookie(name,value,hours);
            }else{
                setCookie(name,value);
            }
        }
    },
    ioReader:function(name){
        if(G_DAPCTRL_VER>200000){
            return this.ioCtrlReader(name) || "";
        }else{
            return getCookie(name);
        }
    },
    ioCtrlWriter:function(key, value, expires){
        var player = G_OCX_XPLAYER;
        var iExpire = expires || 720;
        player.Put("sCookieFileName", key+".dat");
        player.Put("sCookie", value+"～"+((new Date().getTime()) + iExpire * 3600000));
        player = null;
    },
    ioCtrlReader:function(key){
        var player = G_OCX_XPLAYER;
        var sCookie = null;
        var value = null;
        player.Put("sCookieFileName", key+".dat");
        sCookie = player.Get("sCookie")||null;
        if(null != sCookie){
            value = ioCtrlCheck(sCookie);
        }
        player = null;
        return value;
        function ioCtrlCheck(sCookie){
            var items = sCookie.split("～");
            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;
}
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(offset, id){
    var ct = (new Date()).getTime();
    if("number" != typeof(offset)){
	    return ct;
    }else{
        var cacheTime = ioCtrl.ioReader("CacheTime#"+id);
        var _offset = offset * 3600000;
        if(!cacheTime || ""==cacheTime || (ct - _offset) > parseInt(cacheTime, 10)){
            ioCtrl.ioWriter("CacheTime#"+id, ct, 720);
        }else{
            ct = cacheTime;
        }
        return ct;
    }
}
function getParameter(name){
    var search = document.location.search;
    var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
    var matcher = pattern.exec(search);
    var items = null;
    if(null != matcher){
        items = decodeURIComponent(matcher[1]);
    }
    return items;
}
function getBrowserInfo(){
    var userAgent = navigator.userAgent.toLowerCase();
    var env = null;
    return (env = userAgent.match(/msie ([\d.]+)/)) ? {browser:"MSIE", version:env[1]} :
    (env = userAgent.match(/firefox\/([\d.]+)/)) ? {browser:"FireFox", version:env[1]} :
    (env = userAgent.match(/opera.([\d.]+)/)) ? {browser:"Opera", version:env[1]} :
    (env = userAgent.match(/version\/([\d.]+).*safari/)) ? {browser:"Safari", version:env[1]} :
    (env = userAgent.match(/chrome\/([\d.]+)/)) ? {browser:"Chrome", version:env[1]} :
    {browser:"Unknown", version:0};
}
function jumpTop(){
    window.scroll(0,0);
}
function doUpgrage(){
    window.open(g_sThunderSteup_url);
}
function closePrompt(){
    $("checkTips").style.display = "none";
}
function unprompt(type, flag){
    if(0==type){
        ioCtrl.ioWriter("f_version",flag,720);
    }else if(1==type){
        ioCtrl.ioWriter("f_ua",flag,720);
    }else if(2==type){
        ioCtrl.ioWriter("f_client",flag,720);
    }else if(3==type){
        ioCtrl.ioWriter("f_fla",flag, 720);
    }else if(4==type){
        ioCtrl.ioWriter("f_in_pck",flag,720);
    }
    closePrompt();
}
function upgradePrompt(){
    $("checkTips").style.display = "none";
    $("checkTips").innerHTML = "";
    var f_ua=ioCtrl.ioReader("f_ua");
    var f_client=ioCtrl.ioReader("f_client");
    var f_version=ioCtrl.ioReader("f_version");
    var f_in_pck=ioCtrl.ioReader("f_in_pck");
    var f_fla = ioCtrl.ioReader("f_fla");
    var tips='';
    var ua=navigator.userAgent;
    var match = /(FireFox|Opera|Safari|Camino|Gecko|Netscape|Chrome)/gi.test(ua);
    if(match && "1" != f_ua){
        tips='<span><input name="" type="checkbox" value="" onclick="unprompt(1,1)" />下次不再提示 <a href="javascript://" onclick="closePrompt();">关闭</a></span>请您使用IE浏览器访问迅雷看看，建议您使用IE7.0或以上版本&nbsp;<a logForClick(\'A1004;\') href="'+g_ie_download_url+'" target="_blank">下载IE</a>';
        $("checkTips").innerHTML = tips;
        $("checkTips").style.display = "block";
        return true;
    }
    if(!match){
        if(null != G_OCX_XPLAYER){
            var chk = checkClientVersion();
            if(chk.isUpgrade && chk.sBuild!=f_version){
                tips = '<span><input name="" type="checkbox" value="" onclick="unprompt(0, \''+chk.sBuild+'\')" />下次不再提示 <a href="javascript://" onclick="closePrompt();">关闭</a></span><strong>升级提示：</strong>检测到新版看看播放组件，新的版本优化了高清影片播放体验，建议您升级到最新版本<a onclick="logForClick(\'A1000;\')" href="'+getClientDownloadURL()+'" target="_blank">立即升级</a>  <em>更新时间：'+g_upgrade_date+'</em>';
                $("checkTips").innerHTML = tips;
                $("checkTips").style.display = "block";
                return true;
            }else{
                chk = checkIncreasePackage();
                if(chk.isUpgrade && chk.sBuild!=f_in_pck){
                    tips='<span><input name="" type="checkbox" value="" onclick="unprompt(4, \''+chk.sBuild+'\')" />下次不再提示 <a href="javascript://" onclick="closePrompt();">关闭</a></span><strong>升级提示：</strong>检测到您当前的迅雷看看播放组件有最新的升级包，建议您升级至最新版本，享受流畅的高清影片播放体验。<a onclick="logForClick(\'A1001;\')" href="'+g_increase_package+'" target="_blank">立即升级</a>';
                    $("checkTips").innerHTML = tips;
                    $("checkTips").style.display = "block";
                    return true;
                }else{
                    if(checkFlashVersion(9) && G_FLA_VERSION+"" != f_fla){
                        tips='<span><input name="" type="checkbox" value="" onclick="unprompt(3, \''+G_FLA_VERSION+'\')" />下次不再提示 <a href="javascript://" onclick="closePrompt();">关闭</a></span>系统检测到您尚未安装Flash组件或您安装的Flash组件低于9.0版本。<a logForClick(\'A1003;\') href="'+g_flash_player_url+'" target="_blank">点击此处立即安装</a>';
                        $("checkTips").innerHTML = tips;
                        $("checkTips").style.display = "block";
                        return true;
                    }
                }
                return false;
            }
        }else{
            if("1"!=f_client){
                tips='<span><input name="" type="checkbox" value="" onclick="unprompt(2,1)" />下次不再提示 <a href="javascript://" onclick="closePrompt();">关闭</a></span>系统检测到您尚未安装迅雷看看播放组件，<a onclick="logForClick(\'A1002;\')" href="'+g_sThunderSteup_url+'" target="_blank">点击此处立即下载安装</a>';
                $("checkTips").innerHTML = tips;
                $("checkTips").style.display = "block";
            }
            return false;
        }
    }
    return false;
}
function getClientDownloadURL(){
    var ref = g_reference;
    if((4 == ref.mod || (ref.mod > 4 && G_TV5_BUILD <= 0 && G_WTV_BUILD > 0 && G_TV6_BUILD <= 0)) && typeof(g_sWebThunder_url)!="undefined"){
        return g_sWebThunder_url || g_sThunderSteup_url;
    }else if((2==ref.mod||((3==ref.mod||6==ref.mod||7==ref.mod) && G_TV5_BUILD <= 0 && G_WTV_BUILD <= 0 && G_TV6_BUILD > 0)) && typeof(g_sThunderS_url)!="undefined"){
        return g_sThunderS_url || g_sThunderSteup_url;
    }else{
        return g_sThunderSteup_url;
    }
}
function checkClientVersion(){
    var ref = g_reference;
    var __bool = false;
    var items = [];
    function compare(build, refBuild){
        if(build < refBuild || build <= 0){
            return true;
        }
        return false;
    }
    switch(ref.mod){
		case 1:__bool = compare(G_TV5_BUILD, ref.tv5);items.push(G_TV5_BUILD);break;
        case 2:__bool = compare(G_TV6_BUILD, ref.tv6);items.push(G_TV6_BUILD);break;
        case 3:__bool = compare(G_TV5_BUILD, ref.tv5) && compare(G_TV6_BUILD, ref.tv6);items.push(G_TV5_BUILD);items.push(G_TV6_BUILD);break;
        case 4:__bool = compare(G_WTV_BUILD, ref.wtv);items.push(G_WTV_BUILD);break;
        case 5:__bool = compare(G_TV5_BUILD, ref.tv5) && compare(G_WTV_BUILD, ref.wtv);items.push(G_TV5_BUILD);items.push(G_WTV_BUILD);break;
        case 6:__bool = compare(G_TV6_BUILD, ref.tv6) && compare(G_WTV_BUILD, ref.wtv);items.push(G_TV6_BUILD);items.push(G_WTV_BUILD);break;
        case 7:__bool = compare(G_TV5_BUILD, ref.tv5) && compare(G_TV6_BUILD, ref.tv6) && compare(G_WTV_BUILD, ref.wtv);items.push(G_TV5_BUILD);items.push(G_TV6_BUILD);items.push(G_WTV_BUILD);break;
    }
    return {isUpgrade:__bool, sBuild:items.join("|")};
}
function checkFlashVersion(version){
    return (G_FLA_VERSION < version);
}
function checkIncreasePackage(){
	function compare(v1,v2){
		var arr=v2.toString().split('|');
		for(var i=0;i<arr.length;i++){
			if(v1==arr[i]){
				return true;
			}
		}
		return false;
	}
    function checkVersion(){
        var ref = g_increase_reference;
        var __bool = false;
        var __cbool = false;
        var _items = [];
        switch(ref.mod){
	        case 1:__bool = compare(G_TV5_BUILD,ref.tv5);_items.push(G_TV5_BUILD);break;
            //case 1:__bool = (G_TV5_BUILD == ref.tv5);_items.push(G_TV5_BUILD);break;
            case 2:__bool = (G_TV6_BUILD == ref.tv6);_items.push(G_TV6_BUILD);break;
            case 3:__bool = (G_TV5_BUILD == ref.tv5) || (G_TV6_BUILD == ref.tv6);_items.push(G_TV5_BUILD);_items.push(G_TV6_BUILD);break;
            case 4:__bool = (G_WTV_BUILD == ref.wtv);_items.push(G_WTV_BUILD);break;
            case 5:__bool = (G_TV5_BUILD == ref.tv5) || (G_WTV_BUILD == ref.wtv);_items.push(G_TV5_BUILD);_items.push(G_WTV_BUILD);break;
            case 6:__bool = (G_TV6_BUILD == ref.tv6) || (G_WTV_BUILD == ref.wtv);_items.push(G_TV6_BUILD);_items.push(G_WTV_BUILD);break;
            case 7:__bool = (G_TV5_BUILD == ref.tv5) || (G_TV6_BUILD == ref.tv6) || (G_WTV_BUILD == ref.wtv);_items.push(G_TV5_BUILD);_items.push(G_TV6_BUILD);_items.push(G_WTV_BUILD);break;
        }
        switch(ref.cmod){
            case 1:__cbool = (G_BUILD_VERSION < ref.pplayer);_items.push(G_BUILD_VERSION);break;
            case 2:__cbool = (G_DAPCTRL_VER < ref.dapctrl);_items.push(G_DAPCTRL_VER);break;
            case 3:__cbool = (G_BUILD_VERSION < ref.pplayer) || (G_DAPCTRL_VER < ref.dapctrl);_items.push(G_BUILD_VERSION);_items.push(G_DAPCTRL_VER);break;
        }
        return {client:__bool, component:__cbool, items:_items};
    }
    var result = checkVersion();
    if(result.client && result.component){
        return {isUpgrade:true, sBuild:result.items.join("|")};
    }else{
        return {isUpgrade:false, sBuild:result.items.join("|")};
    }
}
function checkKankanVersion(sVersion,sn){
	if(sVersion==0||sVersion==-1||sVersion==-2) {return false;}
	return parseInt(sVersion.split(".")[3])>(!sn?23:sn)?true:false;
}
function $version(){
    var args = arguments;
    var size = args.length;
    var s = t = [0];
    var iS = iT = 0;
    var sS = sT = 0;
    if(size<2){
        return false;
    }else{
        s=(args[0]+"").split(".");
        t=(args[1]+"").split(".");
        iS = parseInt(s.join(""), 10);
        iT = parseInt(t.join(""), 10);
        if(size == 2){
            return (iS > iT);
        }else{
            var gt = false;
            var tmp = true;
            var isEntry = false;
            for(i=2; i<size; i++){
                if(typeof(s[args[i]])!="undefined" && typeof(t[args[i]])!="undefined"){
                    if(parseInt(s[args[i]], 10) != parseInt(t[args[i]], 10))
                    {
                        isEntry = true;
                        gt = parseInt(s[args[i]], 10) > parseInt(t[args[i]], 10);
                        if(false == gt){
                            tmp = false;
                        }
                    }
                }
            }
            if(false == isEntry){
                tmp = false;
            }
            return tmp;
        }
    }
}
function loadJSData(url, handler, args, isDestory){
    var head = document.getElementsByTagName("head")[0];
    var script = $C("script");
    var id = "dynamic_script_"+(new Date().getTime())+"_"+Math.random();
    var eventType = (undefined !== script.onreadystatechange && undefined !== script.readyState) ? "onreadystatechange" : "onload";
    script.language="javascript";
    script.type="text/javascript";
    script.src = url;
    script.id = id;
    script.attachEvent(eventType, function(){
        var state = script.readyState || "loaded";
        if("loaded" == state || "complete" == state){
            if(typeof(handler) == "string"){
                setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
            }else if(typeof(handler) == "function"){
                setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
            }
            if(isDestory){
                $R(script, head);
            }
            head = null;
            script = null;
        }
    });
    $P(script, head);
}
function loadJSDataByTimeslice(url, handler, args, isDestory, interval){
    var head = document.getElementsByTagName("head")[0];
    var script = $C("script");
    var intvId = null;
    var isLoaded = false;
    var id = "dynamic_script_"+(new Date().getTime())+"_"+Math.random();
    var eventType = (undefined !== script.onreadystatechange && undefined !== script.readyState) ? "onreadystatechange" : "onload";
    script.language="javascript";
    script.type="text/javascript";
    script.src = url;
    script.id = id;
    script.attachEvent(eventType, function(){
        var state = script.readyState || "loaded";
        if("loaded" == state || "complete" == state){
            if(null!=intvId){
                clearTimeout(intvId);
                intvId = null;
            }
            if(!isLoaded){
                isLoaded = true;
                args.unshift(false);
                if(typeof(handler) == "string"){
                    setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
                }else if(typeof(handler) == "function"){
                    setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
                }
            }
            if(isDestory){
                $R(script, head);
            }
            head = null;
            script = null;
        }
    });
    $P(script, head);
    intvId = setTimeout(function(){
        clearTimeout(intvId);
        intvId = null;
        if(!isLoaded){
            isLoaded = true;
            args.unshift(true);
            if(typeof(handler) == "string"){
                setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
            }else if(typeof(handler) == "function"){
                setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
            }
        }
    }, interval);
}
function loadJSONData(url, handler, args, responseObj, isDestory, _parent){
    var ifr = $C("iframe");
    var id = "dynamic_iframe_"+(new Date().getTime())+"_"+Math.random();
    ifr.style.cssText="display:none";
    ifr.width = 1;
    ifr.height = 1;
    ifr.src = url;
    ifr.id=id;
    ifr.name=id;
    ifr.attachEvent("onload", function(){
        try{
            var json = eval("ifr.contentWindow."+responseObj);
            args.unshift(json);
        }catch(e){
            args.unshift(null);
        }finally{
            if(typeof(handler) == "string"){
                setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
            }else if(typeof(handler) == "function"){
                setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
            }
            if(isDestory){
                $R(ifr, _parent||null);
            }
            ifr = null;
        }
    });
    $P(ifr, _parent||null);
}
function loadJSONDataByTimeslice(url, handler, args, responseObj, isDestory, _parent, interval){
    var ifr = $C("iframe");
    var id = "dynamic_iframe_"+(new Date().getTime())+"_"+Math.random();
    var isLoaded = false;
    var intvId = null;
    ifr.style.cssText="display:none";
    ifr.width = 1;
    ifr.height = 1;
    ifr.src = url;
    ifr.id=id;
    ifr.name=id;
    ifr.attachEvent("onload", function(){
        if(null!=intvId){
            clearTimeout(intvId);
            intvId = null;
        }
        if(!isLoaded){
            isLoaded = true;
            try{
                var json = eval("ifr.contentWindow."+responseObj);
                args.unshift(json);
            }catch(e){
                args.unshift(null);
            }finally{
                if(typeof(handler) == "string"){
                    setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
                }else if(typeof(handler) == "function"){
                    setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
                }
                if(isDestory){
                    $R(ifr, _parent||null);
                }
                ifr = null;
            }
        }else{
            if(isDestory){
                $R(ifr, _parent||null);
            }
            ifr = null;
        }
    });
    $P(ifr, _parent||null);
    intvId = setTimeout(function(){
        clearTimeout(intvId);
        intvId = null;
        if(!isLoaded){
            isLoaded = true;
            args.unshift(null);
            if(typeof(handler) == "string"){
                setTimeout(function(){try{var hdl = eval(handler);hdl.apply(null, args);}catch(e){}}, 50);
            }else if(typeof(handler) == "function"){
                setTimeout(function(){try{handler.apply(null, args);}catch(e){}}, 50);
            }
        }
    }, interval);
}
function loadAD(){
    var a = arguments;
    var size = a.length;
    var args = [];
    var items = null;
    for(var i = 0; i < size; i++){
        items = a[i].split("|");
        if(items.length == 3){
            var count = parseInt(items[2], 10);
            var showed = parseInt(getCookie("RMTimes"+items[1]) || 0, 10);
            if(showed < count){
                args.push(items[0]);
            }
        }else{
            args.push(a[i]);
        }
    }
    loadJSData("http://mtips.xunlei.com/js/kankan/banner_kankan.1.7.js", "fetchAD", args, false);
}
function loadMTips(){
    if(typeof(G_AREA_TYPE)=="undefined" || G_AREA_TYPE != "1"){
        loadJSData("http://mtips.xunlei.com/tips/tips.1.0.js", "initTips", arguments, false);
    }
}
function slice(a,l){
    if("undefined" == typeof(a)){return "";}
    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 openAndLog(u,s){
	logForClick(s);
	window.open(u);
}
function logForClick(s){
    var url = "http://statis.kankan.xunlei.com/fcg-bin/cgi_click_statis_4.0.fcg?Log4Click="+encodeURIComponent(s)+"&cachetime="+getCacheTime();
    try{$("Stat").send(url);}catch(e){G_CLICK_STAT.src=url;}
}
function getPeerID(bit){
    var player = G_OCX_XPLAYER;
    var peerId = null;
    try{
        if(32 == bit){
            peerId = player.Get("sPeerID32")||null;
        }else{
            peerId = player.Get("sPeerID")||null;
        }
    }catch(e){}finally{player=null;}
    return peerId;
}
function debug(str){
    if($("debugInfo")){
        $("debugInfo").innerHTML+=str+"<br />";
    }
}
function send_kkpgv(u){
    var url = "http://kkpgv.xunlei.com/?u=kankan_4_0_"+u;
    try{$("Stat").send(url);}catch(e){var img = new Image(1,1);img.src = url;}
}
function send_webpv(id){
    var sourceid = getParameter("id")||getCookie("qs_id")||null;
    var sourceIdStr = sourceid ? "id="+sourceid:"";
    var url = "http://statis.kankan.xunlei.com/fcg-bin/cgi_pv_statis.fcg?u='"+encodeURIComponent((window.location.href+sourceIdStr+"default="+id).replace(/\?|&|#/g,""))+"'&catchTime="+getCacheTime();
    loadJSONData(url, typeof(setSysTime)=="undefined"?null:setSysTime, [],"systime", false, null);
}
function saveURLParam(){
    var id=getParameter("id");
	var u=getParameter("u");
    if(id){setCookie("qs_id", id);}
    if(u){setCookie("qs_u",u);}
}saveURLParam();
function displaySocreTips(obj){
    var panel = $("socreTipsPanel");
    var target = obj.lastChild;
    var pos = getPosition(obj);
    if(null == panel){
        panel = $C("div");
        panel.setAttribute("id", "socreTipsPanel");
        $P(panel);
    }
    panel.innerHTML = target.innerHTML;
    panel.firstChild.style.left = pos.Left + "px";
    panel.firstChild.style.top = (pos.Top + 23) + "px";
    panel.firstChild.style.display = "block";
}
function hiddenScoreTips(obj){
    var panel = $("socreTipsPanel");if(panel){panel.innerHTML = "";}
}
function getGradePercent(score){
    var p1=0, p2=0, p3=0, p4=0, p5=0, def=0, ref=10000;
    try{
        var lv1 = typeof(score.level1.users)=="undefined" ? def : parseInt(score.level1.users, 10);
        var lv2 = typeof(score.level2.users)=="undefined" ? def : parseInt(score.level2.users, 10);
        var lv3 = typeof(score.level3.users)=="undefined" ? def : parseInt(score.level3.users, 10);
        var lv4 = typeof(score.level4.users)=="undefined" ? def : parseInt(score.level4.users, 10);
        var lv5 = typeof(score.level5.users)=="undefined" ? def : parseInt(score.level5.users, 10);
        lv1 = isNaN(lv1) ? def : lv1; p1 = lv1 / ref; p1 = p1 >= 1 ? 100 : Math.max(Math.floor(p1 * 100), 1);
        lv2 = isNaN(lv2) ? def : lv2; p2 = lv2 / ref; p2 = p2 >= 1 ? 100 : Math.max(Math.floor(p2 * 100), 1);
        lv3 = isNaN(lv3) ? def : lv3; p3 = lv3 / ref; p3 = p3 >= 1 ? 100 : Math.max(Math.floor(p3 * 100), 1);
        lv4 = isNaN(lv4) ? def : lv4; p4 = lv4 / ref; p4 = p4 >= 1 ? 100 : Math.max(Math.floor(p4 * 100), 1);
        lv5 = isNaN(lv5) ? def : lv5; p5 = lv5 / ref; p5 = p5 >= 1 ? 100 : Math.max(Math.floor(p5 * 100), 1);
    }catch(e){}
    return {level1:p5, level2:p4, level3:p3, level4:p2, level5:p1};
}
function printScore(score){
    var p = getGradePercent(score);
    var str='<div id="grade" onmouseover="displaySocreTips(this)" onmouseout="hiddenScoreTips(this)"><ul><li><div style="width:'+p.level1+'%;"></div></li><li><div style="width:'+p.level2+'%;"></div></li><li><div style="width:'+p.level3+'%;"></div></li><li><div style="width:'+p.level4+'%;"></div></li><li><div style="width:'+p.level5+'%;"></div></li></ul><div><div class="pingfen"><p>用户评价</p><ul><li><label>力荐</label><span><div style="width:'+p.level1+'%;"></div></span></li><li><label>推荐</label><span><div style="width:'+p.level2+'%;"></div></span></li><li><label>一般</label><span><div style="width:'+p.level3+'%;"></div></span></li><li><label>较差</label><span><div style="width:'+p.level4+'%;"></div></span></li><li><label>很差</label><span><div style="width:'+p.level5+'%;"></div></span></li></ul></div><div></div>';
    document.write(str);
}
function printScoreForJST(score){
    var p = getGradePercent(score);
    var str='<div id="grade" onmouseover="displaySocreTips(this)" onmouseout="hiddenScoreTips(this)"><ul><li><div style="width:'+p.level1+'%;"></div></li><li><div style="width:'+p.level2+'%;"></div></li><li><div style="width:'+p.level3+'%;"></div></li><li><div style="width:'+p.level4+'%;"></div></li><li><div style="width:'+p.level5+'%;"></div></li></ul><div><div class="pingfen"><p>用户评价</p><ul><li><label>力荐</label><span><div style="width:'+p.level1+'%;"></div></span></li><li><label>推荐</label><span><div style="width:'+p.level2+'%;"></div></span></li><li><label>一般</label><span><div style="width:'+p.level3+'%;"></div></span></li><li><label>较差</label><span><div style="width:'+p.level4+'%;"></div></span></li><li><label>很差</label><span><div style="width:'+p.level5+'%;"></div></span></li></ul></div><div></div>';
    return str;
}
function checkKeyword(f){
    var k = (f.elements["s"].value).trim();
    if("输入片名或主演名..."==k||""==k){
        alert("请输入影片名或主演名");
        return false;
    }
    return true;
}
function getUserInfo(){
	return getCookie('sessionid');
}
function checkUserTypeHandler(){
    var args = arguments;
    var vip = args[0];
    if(1 == vip){$("vip_icon").style.display='inline';}
}
function checkUserType(){
    loadJSONData("http://dynamic.kankan.xunlei.com/cgi-bin/cgi_check_info?catchtime="+getCacheTime(), checkUserTypeHandler,[],"vip", true, $("header"));
}
function logout(_target){
	setCookie("sessionid","");setCookie("usrname","");setCookie("nickname","");setCookie("score","");setCookie("order","");
	$("kk_toolbar").innerHTML = getToolbarString(_target);
}
function showProducts(){
    var obj = $('_thunderProduct');
    if(obj){obj.style.display = "block";}
}
function hiddenProducts(){
    var obj = $('_thunderProduct');
    if(obj){obj.style.display = "none";}
}
function setProductsPosition(obj){
    var panel = $('_thunderProduct');
    var pos = getPosition(obj);
    var left = pos.Left;
    var top = pos.Top;
    if(panel){
        panel.style.left = (left - 380) + "px";
        panel.style.top = (top + 12) + "px";
    }
}
function getToolbarString(_target){
    var tar = ' target="'+_target+'"';
    var tmp = '<strong>您好，欢迎使用迅雷看看</strong><a href="/4.0/login.html"'+tar+' class="blue">[登录]</a>|<a href="http://i.xunlei.com/register/register.htm" target="_blank">注册</a>';
    if(getUserInfo()){
		var sUrsName=getCookie("usrname");
        var sNickName=getCookie("nickname") || sUrsName;
        tmp = '<strong>'+sNickName+'<a href="http://vip.xunlei.com/" target="_blank" id="vip_icon" style="display:none; font-weight:bold; color:red;">(vip)</a>，您好！欢迎使用迅雷看看</strong><a href="javascript:logout(\''+_target+'\');" class="blue">[退出]</a>';
    }
    tmp+='|<a href="http://bbs.xunlei.com/forum-46-1.html" target="_blank">论坛</a>|<a href="http://bbs.xunlei.com/viewthread.php?tid=1490876" target="_blank" class="help">帮助中心</a>|<a href="javascript:;" onmouseover="setProductsPosition(this);showProducts()" onmouseout="hiddenProducts()">迅雷产品<code style="font-family:Arial; font-size:10px;">▼</code></a>';
    return tmp;
}
function getThunderProduct(){
    var str = '<div onmouseover="showProducts()" onmouseout="hiddenProducts()" class="products" id="_thunderProduct" style="display:none;z-index:999;"><span></span><div class="products_bg"></div><div class="xl_products"><dl class="w_177"><dt>装机工具</dt><dd><ul><li><a href="http://dl.xunlei.com/index.htm?tag=1" target="_blank">迅雷5</a></li><li class="tr" style="padding-left:6px;"><a href="http://safe.xunlei.com/" target="_blank">安全助手</a></li><li class="tc"  style="padding-left:3px;"><a href="http://dl.xunlei.com/index.htm?tag=8" target="_blank">游游</a></li><li><a href="http://dl.xunlei.com/index.htm?tag=2" target="_blank"> web迅雷</a></li><li  class="tr"  style="padding-left:6px;"><a href="http://dl.xunlei.com/index.htm?tag=4" target="_blank">软件助手</a></li><li class="tc"  style="padding-left:3px;"><a href="http://www.neoimaging.cn/download.shtm" target="_blank">光影</a></li></ul></dd></dl><dl class="w_162"><dt>生活品味</dt><dd><ul><li><a href="http://kankan.xunlei.com/" target="_blank">迅雷看看</a></li><li  class="tc"><a href="http://www.xunlei.com/" target="_blank">在线</a></li><li style="padding-left:10px;"><a href="http://xiaozu.xunlei.com/" target="_blank">小组</a></li><li><a href="http://www.gougou.com/" target="_blank">狗狗搜索</a></li><li  class="tc"><a href="http://music.xunlei.com" target="_blank">音乐</a></li><li style="padding-left:10px;"><a href="http://blog.xunlei.com/" target="_blank"> 博客</a></li></ul></dd></dl><dl class="w_66"><dt>休闲娱乐</dt><dd><ul><li><a href="http://game.xunlei.com/" target="_blank">游戏</a></li><li><!--a href="http://www.155.com/" target="_blank">交友</a--></li></ul></dd></dl></div></div>';
    return str;
}
function getMenuType(){
    try{
        var tmpStr = G_MOVIE_DATA.movie_type+"";
        var items = tmpStr.split("|");
        var size = items.length;
        if(1 == size){
            return Math.floor(parseInt(items[0], 10) / 100);
        }else{
            items[0] = Math.floor(parseInt(items[0], 10) / 100);
            if("1" == items[1]){
                return items.join("|");
            }else{
                return items[0];
            }
        }
    }catch(e){}
    return -1;
}
function isShowNewIcon(){
    var sTimes = ioCtrl.ioReader("newIcon")||0;
    var iTimes = parseInt(sTimes, 10);
    if(iTimes < 20){
        ioCtrl.ioWriter("newIcon", iTimes+1, 1440);
        return true;
    }
    return false;
}
function getMenuItems(tar){
    var menuItems=[{label:'首页',link:'/',type:0, isNew:false, stat:'A0001;'},{label:'电影',link:'/4.0/movie_index.html',type:1, isNew:false, stat:'A0002;'},{label:'电视剧',link:'/4.0/serial_index.html',type:2, isNew:false, stat:'A0003;'},{label:'动漫',link:'/4.0/cartoon_index.html',type:4, isNew:false, stat:'A0004;'},{label:'综艺',link:'/4.0/art_index.html',type:3, isNew:false, stat:'A0005;'},{label:'大片',link:'/4.0/dapian_index.html',type:'1|1', isNew:true,stat:'A0008;'}];
    var size = menuItems.length;
    var str = '';
    var menu = null;
    var path = location.pathname;
    var prefixPath = path.substring(0, path.lastIndexOf("_"));
    var className = '';
    var type = getMenuType();
    for(var i=0;i<size;i++){
        menu=menuItems[i];
        if(0==i){
            if(path == menu.link || path.indexOf("/index.html")!=-1 || path=="/4.0/"){className = ' class="up"';G_IS_HOMEPAGE=true;}
        }else{
            className = (path.indexOf(menu.link)!=-1||type==menu.type)?' class="up"':'';
        }
        str += '<li id="menu'+i+'"'+className+'><a onclick="logForClick(\''+menu.stat+'\')" href="'+menu.link+'"'+tar+'>'+menu.label+'</a>'+((menu.isNew&&isShowNewIcon())?'<span>&nbsp;&nbsp;new</span>':'')+'</li>';
    }
    return str;
}
function getNoticeString(){
    var str = "";
    if("undefined" != typeof(g_notice_text) && "undefined" != typeof(g_notice_url) && "" != g_notice_text && ""!=g_notice_url){
        str = '<a href="'+g_notice_url+'" target="_blank" style="color:rgb(1,118,237)">'+g_notice_text+'</a>';
    }return str;
}
function getOuterStyle(selector, attr){
    try{
        var stylesheet = document.styleSheets;
        var size = stylesheet.length;
        var sheet = null;
        var rules = null;
        var ruleSize = 0;
        var rule = null;
        for(var i = 0; i < size; i++){
            sheet = stylesheet.item(i);
            rules = sheet.rules || sheet.cssRules;
            ruleSize = rules.length;
            for(var j = 0; j < ruleSize; j++){
                rule = rules[j];
                if(!rule.selectorText)continue;
                if (selector == rule.selectorText){
                    return rule.style[attr];
                }
            }
        }
        return null;
    }catch(e){
        return null;
    }
}
function printHeader(_target, posId){
    var tar = ' target="'+(_target?_target:"_top")+'"';
    var menus = getMenuItems(tar);
    var aLogo = null;//getOuterStyle("H1 A.logo", "width");
    var left = null == aLogo ? 160 : 227;
    var width = null == aLogo ? 120 : 80;
    var subLogo = null == aLogo ? '' : '<a class="subLogo" href="http://kankan.xunlei.com/special/2009/" target="_blank">2009</a>';
    var aClass =  null == aLogo ? '' : ' class="logo"';
    var str = getThunderProduct()+'<object id="Stat" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="1" height="1"><param name="allowScriptAccess" value="always" /><param name="movie" value="/4.0/stat.swf" /></object><div class="update_bar" style="display:none;" id="checkTips"></div><div class="toolbar">'+getNoticeString()+'<span id="kk_toolbar">'+getToolbarString(_target||"_top")+'</span></div><div id="header"><h1><a'+aClass+' href="http://kankan.xunlei.com/"'+tar+'>迅雷看看</a>'+subLogo+'</h1><div id="_cpLogo" style="position:absolute;left:'+left+'px;bottom:69px;width:'+width+'px;"></div><div id="'+posId+'" style="position:absolute;top:8px; right:0px;"></div><div class="menu"><div class="sebar"><form name="searchForm" onsubmit="return checkKeyword(this)" method="get" action="http://video.gougou.com/search" target="_blank" autocomplete="off" id="sf"><input name="s" id="_keyword" maxlength="16" type="text" value="输入片名或主演名..." /><input type="hidden" name="id" id="id" value="36" /><input type="hidden" name="fr" id="fr" value="2" /><input class="button" type="submit" value="搜索" id="_btn" /></form></div><a href="http://www.gougou.com/" target="_blank" class="gougou">狗狗搜索</a><ul>'+menus+'</ul></div></div>';
    document.write(str);
}
function printFooter(){
    upgradePrompt();
    if(getUserInfo()){checkUserType();}
    var str = '<div id="footer">'+(G_IS_HOMEPAGE?'<div class="cooperation"><h6>合作伙伴</h6><ul><li><img src="http://img.kankan.xunlei.com/img/kankan/4.0/img/cooperation.gif" alt="" /></li></ul></div>':'')+'<p><a onclick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://kankan.xunlei.com\');" id="homePage" href="javascript:;">设看看为首页</a>|<a href="http://pstatic.xunlei.com/about/about.htm" target="_blank">关于迅雷</a>|<a href="http://dl.xunlei.com/index.htm?tag=1" target="_blank">下载迅雷</a>|<a href="http://kankan.xunlei.com/duty.html" target="_blank">免责声明</a>|<a href="http://pstatic.xunlei.com/about/other/banner.html" target="_blank">广告服务</a>|<a href="http://hr.xunlei.com/" target="_blank">迅雷招聘</a>|<a href="http://kankan.xunlei.com/4.0/contact.html" target="_blank" style="color:#FF3300">商务合作</a>|<a href="http://help.xunlei.com/" target="_blank">客服中心</a></p><p>网络视听许可证：<a href="http://img.kankan.xunlei.com/img/kankan/4.0/img/xkz.jpg" target="_blank">1908323号</a> 增值电信业务经营许可证：<a href="http://www.xunlei.com/web/icp.html" target="_blank">粤B2-20050219号</a>  网络文化经营许可证文网文[2007]033号 </p><p>&copy;2003-2009 Xunlei.com  版权所有</p>'+(G_IS_HOMEPAGE?'<p class="img"><a href="http://www.sznet110.gov.cn/index.jsp" target="_blank"><img src="http://img.kankan.xunlei.com/img/kankan/4.0/img/jingcha.gif" alt="" /></a><a href="http://www.sznet110.gov.cn/webrecord/innernet/Welcome.jsp?bano=4403302010122" target="_blank"><img src="http://img.kankan.xunlei.com/img/kankan/4.0/img/anwang.gif" alt="" /></a></p>':'')+'</div>';
    document.write(str);
}
function getDPIcon(flag){
    if("1" == flag){
        return '<span class="dp_icon" title="该片已被鉴定为大片"></span>';
    }return "";
}
function chkInputValue(obj, isfocus){
    var v = obj.value;
    var def = "输入片名或主演名...";
    if(isfocus){
        if(v.trim() == def){
            obj.style.color = "black";
            obj.value = "";
        }
    }else{
        if(v.trim() == ""){
            obj.style.color = "#bebebe";
            obj.value = def;
        }
    }
}
function _chkInputValue_focus(){
    chkInputValue(document.getElementById("_keyword"), true);
}
function _chkInputValue_blur(){
    chkInputValue(document.getElementById("_keyword"), false);
}
function printSearchBar(){
    var str = '<div class="ft_se"><form name="searchForm1" onsubmit="return checkKeyword(this)" method="get" action="http://video.gougou.com/search" target="_blank" autocomplete="off" id="sf1"><input name="s" id="_keyword1" type="text" value="输入片名或主演名..." onfocus="chkInputValue(this, true)" onblur="chkInputValue(this, false)" class="ft_input" style="color:#bebebe;" /><input type="hidden" name="id" id="id" value="36" /><input type="hidden" name="fr" id="fr" value="2" /><input type="submit" value="搜索" class="ft_btn" /><a href="http://www.gougou.com/" target="_blank"><img src="http://img.kankan.xunlei.com/img/kankan/4.0/img/ft_se_gglogo.gif" alt="" /></a></form></div>';
    document.write(str);
}
function setGougouACEvt(){
    document.getElementById("_keyword").attachEvent("onfocus", _chkInputValue_focus);
    document.getElementById("_keyword").attachEvent("onblur", _chkInputValue_blur);
}
function setGougouAC(){
    if(typeof(setupAC)=="function"){
        document.getElementById("_keyword").detachEvent("onfocus", _chkInputValue_focus);
        document.getElementById("_keyword").detachEvent("onblur", _chkInputValue_blur);
        setupAC(document.getElementById("_keyword"),document.getElementById("_btn"));
    }
}
/*bob add for tpl_list.html*/
function setHotLevel(time,isnew){
	if(isnew==1&&time<10000){
		return '<div class="popular"><em class="p3"></em></div>';
	}if(isnew==2){
        return '<div class="popular"><em class="p5"></em></div>';
    }if(time<5000){
		return '<div class="popular"><em class="p1"></em></div>';
	}else if(time<10000){
		return '<div class="popular"><em class="p2"></em></div>';
	}else if(time<15000){
		return '<div class="popular"><em class="p3"></em></div>';
	}else if(time<20000){
		return '<div class="popular"><em class="p4"></em></div>';
	}else{
		return '<div class="popular"><em class="p5"></em></div>';
	}
}

function floatJumpPage(url, stat){
    location.href=url+".html";
}
function floatPageBar(page, totalpage, stat){
    var urlPrefix = (location.pathname).substring(0, (location.pathname).lastIndexOf("_")+1);
    var preEvt = (page-1>0)?' href="javascript:floatJumpPage(\''+(urlPrefix+(page-2))+'\',\''+stat+(page-1)+'\')"':'';
    var nextEvt = (page<totalpage)?' href="javascript:floatJumpPage(\''+(urlPrefix+(page))+'\',\''+stat+(page+1)+'\')"':'';
    var pre = '<a class="prev" title="上一页"'+preEvt+'>上一页</a>';
    var next = '<a class="next" title="下一页" '+nextEvt+'>下一页</a>';
    //<a href="#" class="next" title="下一页" >下一页</a>
    var firstPage='',endPage='';
    var pageStr='';
    var offset = 4;
    var iLen = 0;
    var iCut2 = (offset-(totalpage-page)<0?0:offset-(totalpage-page));
    var iCut = 0;
    for(var i=page-offset-iCut2;i<page+iCut+offset+1;i++){
		if(i<1){iCut++; continue;}
		if(i>totalpage){break;}
        if(i==page){
            pageStr+="<strong>"+page+"</strong>";
        }else{
            pageStr+="<a href=\"javascript:floatJumpPage('"+(urlPrefix+(i-1))+"','"+stat+i+"');\">"+i+"</a>";
            //<a href="#">1</a>
        }
        iLen++;
    }
    if (page>offset+1&&totalpage>2*offset+1){
		firstPage="<a href=\"javascript:floatJumpPage('"+urlPrefix+"0','"+stat+"1');\">1</a><a class=\"\" title=\"更多\">...</a>";
	}
    if (page < totalpage-offset&&totalpage>2*offset+1)
	{
		endPage="<a class=\"\" title=\"更多\">...</a><a href=\"javascript:floatJumpPage('"+(urlPrefix+(totalpage-1))+"','"+stat+(totalpage)+"');\" >"+(totalpage)+"</a>";
	}
    return (pre+firstPage+pageStr+endPage+next);
}
function flash(ur,w,h){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
    document.write('<param name="movie" value="'+ur+'">');
    document.write('<param name="quality" value="high"> ');
    document.write('<param name="wmode" value="opaque"> ');
    document.write('<param name="menu" value="false"> ');
    document.write('<embed src="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="opaque">');
    document.write('</embed>');
    document.write('</object>');
}
function dpFishEyeBg(){
	flash('big.swf',960,230);
	document.write('<div><img src="http://img.kankan.xunlei.com/img/kankan/4.0/img/img_link.gif" alt="" /></div>');
}
/*bob add end*/

/*ppp add*/
var B=BigNews={
	current:0,
	next:0,
	scrollInterval:0,
	autoScroller:0
};
BigNews.turn=function(index){
	clearInterval(BigNews.autoScroller);
	BigNews.scroll(index);
}
BigNews.scroll=function(index){
	if(!$('ul_big_news_item')){
		clearInterval(BigNews.autoScroller);
		return;
	}
	var count=0;
	var step=227;
	var duration=16;
	var b=BigNews;
	b.next=index;
	if(index!=b.current&&count>duration/8){
		return;
	}
	clearInterval(b.scrollInterval);
	var items=$('ul_big_news_item').getElementsByTagName('li');
	for(var i=0;i<5;i++){
		items[i].className='';
	}
	items[index].className='up';
	var span=index-b.current;
	var begin_value=$('div_big_news_img').scrollTop;
	var chang_in_value=span*step+(b.current*step-begin_value);
	b.scrollInterval=setInterval(function(){doit(begin_value,chang_in_value)},10);
	function doit(b,c){
		$('div_big_news_img').scrollTop=cpu(count,b,c,duration);
		count++;
		if(count==duration){
			clearInterval(BigNews.scrollInterval);
			scrollInterval=0;
			count=0;
			$('div_big_news_img').scrollTop=b+c;
			BigNews.current=index;
		}
	}
	function cpu(t,b,c,d) {return c*((t=t/d-1)*t*t+1)+b;};
}
BigNews.auto=function(){
	clearInterval(BigNews.autoScroller);
	BigNews.autoScroller=setInterval(function(){
		BigNews.scroll(BigNews.current==4?0:BigNews.current+1);
	},5000);
}
window.attachEvent('onload',BigNews.auto);
var D=Detail={};
Detail.show=function(name,edition,year,renqi,director,actors,focus,user,cp){
	actors=Detail.actor(actors,24,',');
	director=director.split('|')[0];
	if(D.len(focus)>54){
		focus=focus.substr(0,26)+'...';
	}
	var html='<dl><dt>'+name+'<span>'+edition+'</span></dt><dd><p>年代：'+year+'&nbsp;&nbsp;&nbsp;<!--人气：<strong>'+renqi+'</strong>--></p><p>导演：'+director+'</p><p>主演：'+actors+'</p><p>看点：'+focus.replace(/　/g,'')+'</p></dd></dl><p class="author">'+(cp=='网锋'?'上传者：'+user:'内容商：'+cp)+'</p>';
	$('div_tip_detail').innerHTML=html;
	var p=KK.position(event.srcElement);
	var tip=$('movie_info');
	tip.style.display='';
	tip.style.top=p.Top+'px';
	tip.style.left=p.Left+96+'px';
}
Detail.actor=function (str,len,spliter){
	spliter=spliter||'|';
	var arr=str.split(spliter);
	var temp='';
	for(var i=0;i<arr.length;i++){
		temp+=arr[i]+'&nbsp;';
		if(D.len(temp)<len){
			str=temp;
		}else{
			break;
		}
	}
	return str;
}
Detail.ac_search=function (str,len,spliter){
	spliter=spliter||'|';
	var arr=str.split(spliter);
	var temp=html='';
	var l=Math.min(2,arr.length);
	for(var i=0;i<l;i++){
		temp=arr[i]+'&nbsp;';
		html+='<a style="color:#007EBC" href="http://video.gougou.com/search?s='+arr[i]+'&id=35&fr=2" title="'+arr[i]+'" target="_blank">'+arr[i]+'</a>'+'&nbsp;';
		if(D.len(temp)<30){
			str=html;
		}else{
			break;
		}
	}
	return str;
}
Detail.hide=function (){
	$('movie_info').style.display='none';
}
Detail.len=function (str){
	var l=0;
	var sl=str.length
	for(var i=0;i<sl;i++){
		l++;
   		if (str.charCodeAt(i)>256) l++;
	}
	return l;
}
var KK={};
KK.baseUrl='http://kankan.xunlei.com/4.0/';
KK.position=function(o){
	var p={Top:0,Left:0};
	while(!!o){
		p.Top+=o.offsetTop;
		p.Left+=o.offsetLeft;
		o=o.offsetParent;
	}
	return p;
}

KK.scrollCross={interval:0,count:0,duration:0,step:0,srcObj:null,callback:null};
KK.scrollCross.doit=function(obj,b,c,d){
	var s=KK.scrollCross;
	obj.style.marginLeft=cpu(s.count,b,c,d)+'px';
	s.count++;
	if(s.count==d){
		clearInterval(s.interval);
		s.count=0;
		obj.style.marginLeft=b+c+'px';
		s.callback();
	}
	function cpu(t,b,c,d) {return c*((t=t/d-1)*t*t+1)+b;};
}
KK.scrollCross.scroll=function(obj,step,span,beign,callback,duration){
	var s=KK.scrollCross;
	s.duration=duration;
	s.callback=callback;
	s.interval=setInterval(function(){s.doit(obj,beign,step*span,duration)},10);
}
KK.playUrl=function (id){
	return KK.baseUrl+'movie/'+id%100+'/'+id+'.html';
}
function imgerror(obj,type){
	obj.src=type==2?'http://www.leeboo.com/images/err2.gif':'http://www.leeboo.com/images/err.gif';
}
var List={};
List.CP= function (id,name,userid){
    var s="";
    if(14==id){s='<span>上传者：'+userid+'</span>';}else{s='<span>内容商：'+List.subStr(name.replace(/\|/g,","),0,16)+'</span>';}
    document.write(s);
}
List.GDL=function (o,name){
    o.href = 'http://movie.gougou.com/search?search='+encodeURIComponent(name)+'&id=20';
}
List.GDT=function (o,name){
    o.href = 'http://movie.xunlei.com/search/'+encodeURIComponent(name);
}
List.GRD=function (level){
    level--;
	var rArr = ['很差','较差','一般','推荐','力荐'];
	var cssArr = ["bad","bad","yiban","",""];
	var strongStr = '<strong class="'+cssArr[level]+'">'+rArr[level]+'</strong>';
	document.write(strongStr);
}
List.subStr=function(str,idx1,idx2){
    str=str.replace(/[　\s「」]/g,'');
    var n=0,start=str.length,end=str.length;
    for( var i=0;i<str.length;i++){
        if(n<=idx1)start=i;
        if(str.charCodeAt(i)<128){n++;}
        else {n+=2;}
        if(n>idx2){end=i;break;}
    }
    return str.replace(/([，。；？！\.,;\?!……]$)/g,'').substring(start,end);
}
List.actor=function(str){
	var arr=str.split(',');
	var temp='';
	for(var i=0;i<arr.length;i++){
		temp+=arr[i]+'&nbsp;';
		if(i==0||D.len(temp)<20){
			var cut=arr[i].charCodeAt(0)<128?18:9;
			str='<a onclick="logForClick(\'C0244;\')" target="_blank" title="'+arr[i]+'" class="a_blue" href="http://video.gougou.com/search?s='+encodeURIComponent(arr[i])+'&id=35&fr=2">'+arr[i].substr(0,cut)+'</a>&nbsp;';
		}else{
			break;
		}
	}
	document.write(str);
}
List.dpactor=function(str){
	var arr=str.split(',');
	var tmp = "";
  if(arr[0].length>3){
  	tmp='<a onclick="logForClick(\'C0244;\')" target="_blank" title="'+arr[0]+'" class="a_blue" href="http://video.gougou.com/search?s='+encodeURIComponent(arr[0])+'&id=35&fr=2">'+arr[0].substr(0,6)+'</a>&nbsp;';
  }else{
  	tmp+='<a onclick="logForClick(\'C0244;\')" target="_blank" title="'+arr[0]+'" class="a_blue" href="http://video.gougou.com/search?s='+encodeURIComponent(arr[0])+'&id=35&fr=2">'+arr[0]+'</a>&nbsp;';
  	tmp+='<a onclick="logForClick(\'C0244;\')" target="_blank" title="'+arr[1]+'" class="a_blue" href="http://video.gougou.com/search?s='+encodeURIComponent(arr[1])+'&id=35&fr=2">'+arr[1]+'</a>&nbsp;';
  }
	document.write(tmp);
}
List.mn=function(s){
    if(D.len(s)>24){s=s.substr(0,12);}
    document.write(s);
}
/*ppp add*/