/*author by ligang*/
var gVipUserStateHtml = "";
var XL_pgStop =
{
	fn_evt:function(){},
	fn_start:function(){try{$("stop_page").setCapture()}catch(e){}},
	fn_stop:function(){try{$("stop_page").releaseCapture()}catch(e){}},
	fn_stop_timer:function(_time){XL_pgStop.fn_start();setTimeout("XL_pgStop.fn_stop()",_time)}
}

var OFF_MACHING_TEXT = "<img style='vertical-align:text-top;' src='images/off_maching.gif' />&nbsp;&nbsp;完成后关机  <a style='color:#fff' title='取消下载完成后关机的功能' href='javascript:top.off_maching_fun()'>取消</a>"
var OFF_BOOL
var objX = 0;
var objY = 0;
var dragInTitle;
var userinfo = 0;
var g_SafeElemId;


var bar_time = 0;
var hreftemp = "http://i.xunlei.com"
/*屏蔽鼠标左右键*/
if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
if (window.event.srcElement.id=="search_text"||window.event.srcElement.id=="user_name"||window.event.srcElement.id=="txtFilePath")
{
event.cancelBubble = false
event.returnValue = true;
return
}
event.cancelBubble = true;
event.returnValue = false;

return false;
}

function norightclick(e)
{
if (window.event.srcElement.id=="search_text")
{
event.cancelBubble = false
event.returnValue = true;
return
}
else if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others


/*公用函数*/
/*取得触发当前事件的对象*/
function get_event_obj()
{
	var evt = window.event;
	var obj=evt.srcElement;
	return obj
}
/*对象的显示隐藏及怎么实现显示隐藏*/
function show_hidden_float_obj(float_obj, obj_event, obj_click_name)
{
	var float_obj = float_obj?float_obj:"";
	var obj_event = obj_event?obj_event:"";
	var obj_click_bool = obj_click_bool?obj_click_bool:"";
	
	document.body.onmouseup = function()
	{
	
	    var obj = get_event_obj();
	    for(i=0;i<obj_click_name.length;i++)
	    {
	        if(obj.name == obj_click_name[i])
	            {
	                document.body.onmouseup="";
	                window.top.show_hidden_float_obj(float_obj, obj_event, obj_click_name);
	                return;
                }

	    }
	    window.top.remove_or_display_obj(float_obj, obj_event);
	};
	window.frames['view'].document.body.onmouseup = function()
	{
	    window.top.remove_or_display_obj(float_obj, obj_event);
	};
	
}
/*点击body后实现的事件*/
function remove_or_display_obj(float_obj, obj_event)
{
	obj_event == 'remove'?document.body.removeChild(float_obj):float_obj.style.display = "none";
	document.body.onmouseup = "";
}

/*公用函数结束*/
function open_new_works()
{
	if (event != null)
		event.cancelBubble = true;
	clear_all_float_window("new_works_id");
    if($("new_works_id").style.display == "none")
    {
        $("new_works_id").style.display = "block";
        $("new_works_span").innerText = "6";
    }
    else
    {
        $("new_works_id").style.display = "none";
        $("new_works_span").innerText = "4";
    }

}
function set_news_bar()
{
    var newScript=document.createElement('script');
	newScript.src = 'http://biz5.sandai.net/webthunder/show/main_1.js';
	document.body.appendChild(newScript);
}
function set_left_bottom()
{
	var newScript1=document.createElement('script');
	var newScript2=document.createElement('script');
	newScript1.src = 'http://biz5.sandai.net/webthunder/show/leftbanner.js';
	newScript2.src = 'http://biz5.sandai.net/webthunder/show/lefttxt.js';
	document.body.appendChild(newScript1);
	document.body.appendChild(newScript2);
	show_media_ad();
}
function show_media_ad()
{
	$("media_ad").style.display = "block";	
}
function right_button_onclick(obj)
{
	event.cancelBubble = false
	event.returnValue = false;
	if(event.button == 2)
	{
		if($("right_button"))
			document.body.removeChild($("right_button"))
		var lw = document.createElement("div");
		var lw_id = "right_button";
		var width = 140;
		var height = 160;
		var lw_left = event.clientX;
		var lw_top = event.clientY;
		var lw = set_div_style(lw,lw_id,lw_top,lw_left,width,height,"absolute","2px solid #e9f2fe","default","#fff");
		document.body.appendChild(lw);
		obj.onblur = function (){document.body.removeChild(lw);}
	}
}
function set_state_bar(_string,_time)
{
        set_state_bar_empty();
        //var obj = $("state_bar");
		var obj = $("BarInfo");		
        obj.style.display = "block";
        if(_string == "off_maching")
        {
            obj.innerHTML = OFF_MACHING_TEXT;
            OFF_BOOL = true;
        }
        else{
            obj.innerHTML = _string;
            bar_time  = setTimeout("set_state_bar_empty()",_time);
        }
}
function set_state_bar_empty()
{
        if(OFF_BOOL)
        {
            $("BarInfo").innerHTML = OFF_MACHING_TEXT;
        }
        else if(bar_time!=0)
        {
            $("BarInfo").style.display = "none";
            clearTimeout(bar_time);
            bar_time = 0;
        }else{
			try{
            $("BarInfo").style.display = "none";
			}
			catch(e){}
		}
}

function off_maching_fun()
{
    set_finish_shutdown(0);
    OFF_BOOL = false;
    set_state_bar_empty();
}
function set_div_style(obj,id,top,left,width,height,position,border,cursor,background,filter)
{
	var obj = obj;
	obj.style.filter=filter?"Alpha(Opacity="+filter+")":0;
	obj.id = id?id:null;
	obj.style.top = top?top:0;
	obj.style.left = left?left:0;
	obj.style.width = width?width:0;
	obj.style.height = height?height:0;
	obj.style.position = position?position:"static";
	obj.style.border = border?border:"1px #000 solid";
	obj.style.cursor = cursor?cursor:"default";
	obj.style.background = background?background:"";
	return obj
}

function layout_user_grade(nLevel)
{
var strResult = "未知";
var nLevel = Number(nLevel);
	if(nLevel > 47)
		strResult = "三军统帅";
	else if(nLevel > 31)
		strResult = "上将";
	else if(nLevel > 15)
		strResult = "中将";
	else if(nLevel > 11)
		strResult = "少将";
	else if(nLevel > 7)
		strResult = "大校";
	else
	{
		switch(nLevel)
		{
		case 7:
			strResult = "上校";
			break;
		case 6:
			strResult = "中校";		
			break;
		case 5:
			strResult = "少校";		
			break;
		case 4:
			strResult = "上尉";		
			break;
		case 3:
			strResult = "中尉";		
			break;
		case 2:
			strResult = "少尉";		
			break;
		case 1:
			strResult = "列兵";		
			break;
		}
	}
	return strResult;
}
function open_login()
{
	XL_popUpWindow.fn_open("login_window")
}
function open_content(T_safe)
{
	XL_popUpWindow.fn_open("file_info_box");
	$("backDiv").onclick = function (){close_content()};

    set_content_info(T_safe);
	
	/*
	try{document.body.removeChild($("leiyanscript"))}catch(e){};
	var sct = document.createElement("script");
	var cid = g_TaskInfo[Cid]
	sct.id  = "leiyanscript";
	sct.src = "http://leiyanstatic.xunlei.com/js/eyesfunc.js?channelid=3&replaceid=leiyancontent&leiyancachehref=http://my.xunlei.com/"+cid;
	document.body.appendChild(sct);
	*/
	var g_leiyanHref = "";

}
function close_content()
{
	XL_popUpWindow.fn_close();
	LOGIN_FOR_ID = false;
	clear_time_out();
	//$("p4pcon").src="";
	clear_content_all_set();
	fresh_tasklist(0);
	g_dragBool = false;
}
function close_safe()
{
	$("variable_menu_name").innerText = "";
	$("safe_list_box_bt2_div").style.height = "";
	XL_popUpWindow.fn_close();
	top.fresh_tasklist(0);
}
function open_config()
{
	fn_config_state('open_config');
	XL_popUpWindow.fn_open("set_config");
	//$('set_config').style.visibility='visible';
	$("backDiv").onclick = function (){close_all_popUpWindow()};
}
function open_help_page()
{
	window.open("http://help.xunlei.com/newhelp/02/content000000140.html", "_blank");
}
function close_all_popUpWindow()
{
	$("set_config_iframe").src = "";
	XL_popUpWindow.fn_close();	
}
function close_login_popUpWindow()
{
	$("user_name").value = "";
	$("pass_word").value = "";
	XL_popUpWindow.fn_close();	
}
var XL_popUpWindow = 
{
	allPopObjId:["login_window","variable_menu","file_info_box","set_config"],
	fn_open:function(_objId)
	{

		XL_popUpWindow.fn_hidden_all_popObj(_objId);
		XL_popUpWindow.fn_hidden_all_select();
		XL_popUpWindow.fn_open_obj(_objId);
		XL_popUpWindow.fn_open_backdiv();
		XL_popUpWindow.fn_set_resize(_objId);
	},
	fn_close:function()
	{
		XL_popUpWindow.fn_hidden_all_popObj();
		XL_popUpWindow.fn_hidden_backdiv();
		XL_popUpWindow.fn_show_all_select();
	},
	fn_hidden_all_popObj:function(_objId)
	{
		var o = XL_popUpWindow.allPopObjId;
		for(var i=0;i<o.length;i++)
		{
			$(o[i]).style.display = "none";	
		}	
	},
	fn_hidden_backdiv:function()
	{
		$("backDiv").style.display = "none"
	},
	fn_open_obj:function(_objId)
	{
		$(_objId).style.display = "block";
		$(_objId).style.left = document.body.clientWidth/2 - parseInt($(_objId).offsetWidth)/2;
		$(_objId).style.top = document.body.clientHeight/3 - parseInt($(_objId).offsetHeight)/3;
		if(_objId == "set_config")
			setTimeout("XL_popUpWindow.set_config_iframe()",500);
	},
	fn_open_backdiv:function()
	{
		$("backDiv").style.display = "block";
	},
	fn_set_resize:function(_objId)
	{		
		window.onresize = function (_objId)
		{
			if($("backDiv")!=null)
			{
				try
				{
					$(_objId).style.left = document.body.clientWidth/2-parseInt($(_objId).offsetWidth)/2;
					$(_objId).style.top  = document.body.clientHeight/3-parseInt($(_objId).offsetHeight)/2;
				}
				catch(e){}
			}
		}
	},
	fn_hidden_all_select:function()
	{
		var all_select = null;
		try{all_select = top.document.frames["view"].document.getElementsByTagName("SELECT");}catch(e){}
		if (all_select!=null)
		{
			for(i=0;i<all_select.length;i++)
			{
				all_select[i].style.clip="rect(0 0 0 0)";
				all_select[i].style.position="absolute"
			}
			all_select = null;
		}
	},
	fn_show_all_select:function()
	{
		try
		{
		var all_select = top.document.frames["view"].document.getElementsByTagName("SELECT");
		for(i=0;i<all_select.length;i++)
		{
			all_select[i].style.clip="rect(auto)";
			all_select[i].style.position="static"
		}
		all_select = null;
		}
		catch(e){}
	},
	set_config_iframe:function()
	{
		$("set_config_iframe").src = "task_config.htm"	
	}
}
function open_the_set2_for_id()
{
	set_content_info_for_id();
}
function open_the_set_safe()
{
	XL_IMG.remove_img($("variable_menu_img"));
	$("variable_menu_txt").innerHTML = "正在获取病毒信息……";
	$("backDiv").onclick = function(){close_safe()}
	XL_popUpWindow.fn_open("variable_menu");
}
//设置安全信息
function show_variable_menu()
{
	window.frames["view"].event.cancelBubble = true;
	$("safe_list_box_common").style.display = "none";
	$("safe_list_common").innerText = "";
	$("safe_list_box_bt1").style.display = "none";
	$("safe_list_box_bt2").style.display = "none";
	$("safe_list_bt").innerText = "";
	open_the_set_safe();
	set_variable_menu();
}
function show_variable_menu2(_taskId)
{
	try{window.frames["view"].event.cancelBubble = true}catch(e){};
	$("safe_list_box_common").style.display = "none";
	$("safe_list_common").innerText = "";
	$("safe_list_box_bt1").style.display = "none";
	$("safe_list_box_bt2").style.display = "none";
	$("safe_list_bt").innerText = "";
	open_the_set_safe();
	g_SafeElemId =_taskId.toString()
	thunder_server.NotifySafeInfoQuery(2,g_SafeElemId);
}
function set_variable_menu()
{
	var elem = window.frames["view"].event.srcElement;
	while(elem.tagName!="TR"&&elem!=null)
	elem = elem.parentElement;
	g_SafeElemId = elem.id.toString()
	thunder_server.NotifySafeInfoQuery(2,g_SafeElemId);
}
function safe_find_anain()
{
	$("safe_list_box_common").style.display = "none";
	$("safe_list_common").innerText = "";
	$("safe_list_box_bt1").style.display = "none";
	$("safe_list_box_bt2").style.display = "none";
	$("safe_list_bt").innerText = "";
	XL_IMG.remove_img($("variable_menu_img"));
	$("variable_menu_txt").innerHTML = "正在获取病毒信息……";
	thunder_server.NotifySafeInfoQuery(2,g_SafeElemId)	
}
function get_variable_menu()
{
	var g_safeStatusBack = thunder_server.GetVariable("GetTaskSafeInfo");
	thunder_server.SetVariable("AddTaskSafeInfo","");
	if(g_safeStatusBack.substring(0,2)=="GE")
		set_variable_menu_for_common(g_safeStatusBack);
	else
		set_variable_menu_for_bt(g_safeStatusBack);
}
function set_variable_menu_for_common(g_safeStatusBack)
{
	var tempSed = g_safeStatusBack.split(SPLITTER_RECORD);
	var tempTrd  = tempSed[0].split(SPLITTER_FIELD);
	g_safeFileName = tempTrd[1];
	g_safeStatus = tempTrd[2];
	$("variable_menu_name").innerHTML = "<span style='color:blue' title="+tempTrd[1]+">"+tempTrd[1]+"</span>";
	if(tempSed.length>=2&&tempSed[1]!="")
	{
		$("safe_list_box_common").style.display = "block";
		for(var i=1;i<tempSed.length-1;i++)
		{
			var temptr = document.createElement("tr");
			var temptd1 = document.createElement("td");
			var temptd2 = document.createElement("td");
			var tempSplit = tempSed[i].split(SPLITTER_FIELD);
			temptd1.className = "fst";
			temptd2.className = "sed";
			temptr.appendChild(temptd1);
			temptr.appendChild(temptd2);
			temptd1.innerHTML = get_safe_factory(tempSplit[0]);
			temptd2.innerHTML = get_safe_result(tempSplit[1].toString(),g_safeFileName.substring(g_safeFileName.indexOf(".")));
			$("safe_list_common").appendChild(temptr);
		}
	}
	var safeHtml;
	g_safeStatus = (g_safeStatus.match(/\S*/)!=null?g_safeStatus.match(/\S*/):g_safeStatus).toString();
	if(g_safeFileName.toLowerCase().indexOf("rmvb")!=-1||g_safeFileName.toLowerCase().indexOf("rm")!=-1)
	{
		if(g_safeStatus.indexOf("AD@RMF")!=-1)
		{
			safeImgClass = "safe_openwindow";
			safeHtml= "该视频可能含有弹窗广告，请访问<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>获取安全清晰版本。"
		}
		else if(g_safeStatus == "XLSafe_Safe")
		{
			safeImgClass = "safe_safe";
			safeHtml = "<span>该视频已通过安全检测，未发现弹窗广告。</span>";
		}
		else if(g_safeStatus == "XLSafe_UserLimit")
		{
			safeImgClass = "safe_userlimit";
			safeHtml = "<br /><span>现在登录，立刻查询此文件是否包含病毒木马威胁。</span><br /><a target='_blank'  href='http://i.xunlei.com/register/register.htm'>还没有帐号？</a>  <a target='_blank' href='http://safe.xunlei.com/client/linksjump/webvirus.htm'>如何登录</a>？</span>";
		}
		else if(g_safeStatus == "" || g_safeStatus == "XLSafe_Fail" || g_safeStatus == "XLSafe_Unknown")
		{
			safeImgClass = "safe_unknow";
			safeHtml = "未获取到此资源的安全信息。<br />为保障系统安全，建议打开前进行病毒查杀。";
		}
		else
		{
			safeImgClass = "safe_variable";
			safeHtml= "经迅雷安全平台检测，此文件含有威胁，请访问<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>搜索替代资源。"
		}
	}
	else
	{
		if(g_safeStatus == "XLSafe_Safe")
		{
			safeImgClass = "safe_safe";
			safeHtml = "<span>经迅雷安全平台检测，未发现此文件含有威胁，但不表示绝对安全。</span>";
		}
		else if(g_safeStatus == "XLSafe_UserLimit")
		{
			safeImgClass = "safe_userlimit";
			safeHtml = "<br /><span>现在登录，立刻查询此文件是否包含病毒木马威胁。</span><br /><a target='_blank'  href='http://i.xunlei.com/register/register.htm'>还没有帐号？</a>  <a target='_blank' href='http://safe.xunlei.com/client/linksjump/webvirus.htm'>如何登录</a>？</span>";
		}
		else if(g_safeStatus == "" || g_safeStatus == "XLSafe_Fail" || g_safeStatus == "XLSafe_Unknown")
		{
			safeImgClass = "safe_unknow";
			safeHtml = "未获取到此资源的安全信息。<br />为保障系统安全，建议打开前进行病毒查杀。";
		}
		else
		{
			if(tempSplit[0]=="Xunlei Plugin Checker")
			{
				safeImgClass = "safe_openwindow";
				safeHtml= "此文件可能捆绑有插件，安装时请注意选择。"
			}
			else
			{
				safeImgClass = "safe_variable";
				safeHtml= "经迅雷安全平台检测，此文件含有威胁，请访问<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>搜索替代资源。"
			}
		}
	}
	XL_IMG.set_img($("variable_menu_img"),safeImgClass);
	$("variable_menu_txt").innerHTML = safeHtml;
}
function set_variable_menu_for_bt(g_safeStatusBack)
{
	var tempSed = g_safeStatusBack.split(SPLITTER_RECORD);
	var tempTrd  = tempSed[0].split(SPLITTER_FIELD);
	g_safeFileName = tempTrd[1];
	g_safeStatus = tempTrd[2];
	$("variable_menu_name").innerHTML = "<span style='color:blue' title="+tempTrd[1]+">"+tempTrd[1]+"</span>";
	if(tempSed.length>=2&&tempSed[1]!="")
	{
		$("safe_list_box_bt1").style.display = "block";
		$("safe_list_box_bt2").style.display = "block";
		
		if(tempSed.length<13)
		{
			$("safe_list_box_bt2").style.width = "100%"	
		}
		else
		{
			$("safe_list_box_bt2").style.width = "96%";
			$("safe_list_box_bt2_div").style.height = (tempSed.length-3)*21+"px";
		}
		for(var i=1;i<tempSed.length-1;i++)
		{
			var temptr = document.createElement("tr");
			var temptd1 = document.createElement("td");
			var temptd2 = document.createElement("td");
			var tempSplit = tempSed[i].split(SPLITTER_FIELD);
			temptd1.className = "fst";
			temptd2.className = "sed";
			temptr.appendChild(temptd1);
			temptr.appendChild(temptd2);
			temptd1.innerHTML = "<span title="+tempSplit[0]+">"+tempSplit[0]+"</span>";
			temptd2.innerHTML = get_safe_result(tempSplit[1].toString(),tempSed[i].substring(tempSed[i].indexOf(".")));
			$("safe_list_bt").appendChild(temptr);
		}
	}
	var safeHtml;
	g_safeStatus = (g_safeStatus.match(/\S*/)!=null?g_safeStatus.match(/\S*/):g_safeStatus).toString();
	if(g_safeFileName.toLowerCase().indexOf("rmvb")!=-1||g_safeFileName.toLowerCase().indexOf("rm")!=-1)
	{
		if(g_safeStatus.indexOf("AD@RMF")!=-1)
		{
			safeImgClass = "safe_openwindow";
			safeHtml= "<span>此BT任务中发现包含威胁的文件，建议删除有威胁文件。登录<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>搜索替代资源</span>"
		}
		else if(g_safeStatus == "XLSafe_Safe")
		{
			safeImgClass = "safe_safe";
			safeHtml = "<span>该视频已通过安全检测，未发现弹窗广告。。</span>";
		}
		else if(g_safeStatus == "XLSafe_UserLimit")
		{
			safeImgClass = "safe_userlimit";
			safeHtml = "<br /><span>现在登录，立刻查询此文件是否包含病毒木马威胁。</span><br /><a target='_blank'  href='http://i.xunlei.com/register/register.htm'>还没有帐号？</a>  <a target='_blank' href='http://safe.xunlei.com/client/linksjump/webvirus.htm'>如何登录</a>？</span>";
		}
		else if(g_safeStatus == "" || g_safeStatus == "XLSafe_Fail" || g_safeStatus == "XLSafe_Unknown")
		{
			safeImgClass = "safe_unknow";
			safeHtml = "未获取到此资源的安全信息。<br />为保障系统安全，建议打开前进行病毒查杀。";
		}
		else
		{
			safeImgClass = "safe_variable";
			safeHtml= "经迅雷安全平台检测，此文件含有威胁，请访问<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>搜索替代资源。"
		}
	}
	else
	{
		if(g_safeStatus == "XLSafe_Safe")
		{
			safeImgClass = "safe_safe";
			safeHtml = "<span>此BT任务中所有文件通过安全平台检测，未发现威胁。</span>";
		}
		else if(g_safeStatus == "XLSafe_UserLimit")
		{
			safeImgClass = "safe_userlimit";
			safeHtml = "<br /><span>现在登录，立刻查询此文件是否包含病毒木马威胁。</span><br /><a target='_blank'  href='http://i.xunlei.com/register/register.htm'>还没有帐号？</a>  <a target='_blank' href='http://safe.xunlei.com/client/linksjump/webvirus.htm'>如何登录</a>？</span>";
		}
		else if(g_safeStatus == ""|| g_safeStatus == "XLSafe_Unknown")
		{
			safeImgClass = "safe_unknow";
			safeHtml = "<span>此Bt任务中部分文件安全信息未知，请打开前使用杀毒软件进行扫描，以确保安全。</span>";
		}
		else if(g_safeStatus == "XLSafe_Fail")
		{
			safeImgClass = "safe_unknow";
			safeHtml = "<span>安全信息查询失败，请确认网络通畅后再试。</span>";	
		}
		else
		{
			if(tempSplit[0]=="Xunlei Plugin Checker")
			{
				safeImgClass = "safe_openwindow";
				safeHtml= "此文件可能捆绑有插件，安装时请注意选择。"
			}
			else
			{
				safeImgClass = "safe_variable";
				safeHtml= "<span>此BT任务中发现包含威胁的文件，建议删除有威胁文件。登录<a target='_blank' href='http://www.gougou.com'>http://www.gougou.com</a>搜索替代资源</span>"
			}
		}
	}
	XL_IMG.set_img($("variable_menu_img"),safeImgClass);
	$("variable_menu_txt").innerHTML = safeHtml;
}
function get_safe_factory(name)
{
	switch(name)
	{
		case "Kingsoft":
		return "<img src='../images/kingsoft.ico' />金山杀毒模块";
		break;
		case "Rising":
		return "<img src='../images/rising.ico' />瑞星杀毒模块";
		break;
		case "Norton":
		return "<img src='../images/norton.ico' />诺顿杀毒模块";
		break;
		case "KAV":
		return "<img src='../images/kav.ico' />卡巴斯基杀毒模块";
		break;
		case "Jiangmin":
		return "<img src='../images/jiangmin.ico' />江民杀毒模块";
		break;
		case "XLRMFClean":
		return "<img src='../images/rmvbl.ico' />迅雷rmvb弹窗查杀工具";
		break;	
		case "Xunlei Plugin Checker":
		return "插件检查"
	}	
}
function get_safe_result(safeTemp,safeFileClass)
{
	if(safeFileClass.toLowerCase().indexOf("rmvb")!=-1||safeFileClass.toLowerCase().indexOf("rm")!=-1)
	{
		if(safeTemp == "XLSafe_Safe")
		{
			return "<span style='color:green'>无弹窗</span>";
		}
		else if(safeTemp == "XLSafe_UserLimit")
		{
			return "<span style='color:blue'>无权限</span>";
		}
		else if(safeTemp == "" || safeTemp == "XLSafe_Unknown")
		{
			return "<span style='color:blue'>未知</span>";
		}
		else if(safeTemp == "XLSafe_Fail")
		{
			return "<span style='color:blue'>查询失败</span>";	
		}
		else
		{
			safeTemp = (safeTemp.match(/\S*/)!=null?safeTemp.match(/\S*/):safeTemp).toString();
			if((safeTemp.indexOf("AD@RMF")!=-1))
			{
				return "<span style='color:red'>有弹窗</span>";	
			}
			else
			{
				return "<span style='color:red' title="+safeTemp+">危险:"+safeTemp+"</span>";
			}
		}		
	}
	else
	{
		if(safeTemp == "XLSafe_Safe")
		{
			return "<span style='color:green'>安全</span>";
		}
		else if(safeTemp == "XLSafe_UserLimit")
		{
			return "<span style='color:blue'>无权限</span>";
		}
		else if(safeTemp == "" || safeTemp == "XLSafe_Unknown")
		{
			return "<span style='color:blue'>未知</span>";
		}
		else if(safeTemp == "XLSafe_Fail")
		{
			return "<span style='color:blue'>查询失败</span>";	
		}
		else
		{
			return "<span style='color:red' title="+safeTemp+">危险:"+safeTemp+"</span>";
		}
	}
}
function layout_login()
    {
        var usnm = $("user_name").value;
        var uspwd = $("pass_word").value;
        
        if(usnm=="")
            {
                alert("请输入用户名");
                $("user_name").focus();
            }
        else if(uspwd=="")
            {
                alert("请输入密码");
                $("pass_word").focus();
            }
        else
            {
                var logintemp = login(usnm,uspwd);
                XL_popUpWindow.fn_close()
            }
    }
/*
var XL_login = 
{
	bannerObjId:"login_banner",
	bannerObjLoginImgBoxId:"login_banner_login",
	bannerObjRegImgBoxId:"login_banner_reg",
	bannerObjUserSexImgBoxId:"login_banner_user_sex",
	bannerWindowErrorObjId:"login_error_div",
	bannerWindowErrorObjBackColorId:"login_error_div_back",
	bannerWindowErrorObjBackColor:"#ffffd2",
	
	bannerObjLoginImgClass:"login",
	bannerObjRegImgClass:"reg",
	bannerObjMenImgClass:"user_men",
	bannerObjWomenImgClass:"user_women",
	bannerObjUnknowImgClass:"user_unknow",
	
	dftHtm:'<div id="login_banner_login"></div><a id="LOGIN" href="javascript:on_login_dft()" class="white">登 录</a><div id="login_banner_reg"></div><a id="REG" class="white" target="_blank" href="http://i.xunlei.com/register/register.htm">注 册</a>',
	loginTimeHtm:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在登陆中...",
	loginSuccHtm:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在登陆中...",
	outError:'退出失败，请<a href="javascript:XL_login.fn_login_out()">重新注销</a>',
	outTimeHtm:'正在退出',
	fn_string_replace:function(str)
	{
		var str = String(str);
		var str = str.replace(/网络/g,"<b style='color:#f00'>网络</b>");
		var str = str.replace(/用户名/g,"<b style='color:#f00'>用户名</b>");
		var str = str.replace(/密码/g,"<b style='color:#f00'>密码</b>");
		var str = str.replace(/重启/g,"<b style='color:#f00'>重启</b>");
		return str
	},
	fn_set_banner_dft:function()
	{
		this.fn_set_banner_empty();
		$(this.bannerObjId).innerHTML = this.dftHtm;
		XL_IMG.set_img($(this.bannerObjLoginImgBoxId),this.bannerObjLoginImgClass)
		XL_IMG.set_img($(this.bannerObjRegImgBoxId),this.bannerObjRegImgClass)	
	},
	fn_set_banner_empty:function()
	{
		try{
		XL_IMG.remove_img($(this.bannerObjLoginImgBoxId));
		XL_IMG.remove_img($(this.bannerObjRegImgBoxId));
		XL_IMG.remove_img($(this.bannerObjUserSexImgBoxId));
		XL_IMG.remove_img($(this.bannerObjRegImgBoxId));
		}
		catch(e){}//$(this.bannerObjId).innerHTML = "";
	},
	fn_set_window_error:function()
	{
		$(this.bannerWindowErrorObjBackColorId).style.backgroundColor = this.bannerWindowErrorObjBackColor;
        $(this.bannerWindowErrorObjId).innerHTML = this.fn_string_replace(String(get_register_error_string(get_register_last_error())));
	},
	fn_set_login_banner:function(_code)
	{
        switch (String(_code))
        {
            case "2":
                this.fn_set_banner_empty();
                $(this.bannerObjId).innerHTML = this.loginTimeHtm;
                break;
            case "3":
                this.fn_set_banner_empty();
                $(this.bannerObjId).innerHTML = this.loginTimeHtm ;
                this.fn_set_login_banner_succ_txt();
                break;
            case "4":
                XL_popUpWindow.fn_open("login_window");
				this.fn_set_window_error();
				$("user_name").focus();
				this.fn_set_banner_dft()
                break;
            default: 
				return;
				break;
        }
	},
	fn_set_login_banner_succ_txt:function()
    {
        var a = a?a:1;
        if(get_login_response()!=null)
        {
            if($("user_sex_img")!=null)
				return
            var user_info = String(get_login_response());
            var user_info = user_info.split(',');
            var user_name = user_info[0];
            var user_grade = layout_user_grade(user_info[3]);
            var user_point = user_info[2];
            var user_sex = user_info[11];
			var user_sex_img_obj_classname;
			switch (user_sex)
			{
				case "0":
				user_sex_img_obj_classname = this.bannerObjMenImgClass;
				break;
				case "1":
				user_sex_img_obj_classname = this.bannerObjWomenImgClass;
				break;
				default:
				user_sex_img_obj_classname = this.bannerObjUnknowImgClass;
				break;
			}
			this.fn_set_banner_empty()
            var user_info_all = "<div class='loging_suscc'>&nbsp;&nbsp;&nbsp;&nbsp;欢迎您,&nbsp;<div id='login_banner_user_sex'></div>&nbsp;&nbsp;&nbsp;<a href='javascript:OpenPortalPage(hreftemp)' class='white'>"+user_name+"</a>&nbsp<div style='margin-top:-2px;overflow:hidden;width:40px;height:16px; position:absolute;' id='vip_user_state'></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<a  class='white' href='javascript:get_my_blog();'>我的博客</a>&nbsp,&nbsp<a href='javascript:XL_login.fn_login_out()' class='white'>注销</a>] &nbsp|&nbsp 等级："+user_grade+"&nbsp&nbsp积分："+user_point+"</div>";
            $(this.bannerObjId).innerHTML = user_info_all;
			XL_IMG.set_img($(this.bannerObjUserSexImgBoxId),user_sex_img_obj_classname)
            XL_popUpWindow.fn_close()
            return  
        }
        else
		{
            userinfo = setTimeout("XL_login.fn_set_login_banner_succ_txt()",50);
            var a =a + 1;
        }		
	},
	fn_login_out:function()
	{
		var b = b?b:1;
		if(logout()==1)
		{
			this.fn_set_banner_dft()
			top.fresh_tasklist(0);
			return  
		}
        else if(b==5&&logout()!=1)
		{
			this.fn_set_banner_empty();
		 	$(bannerObjId).innerHTML = this.outError;
		 	return 
		}
        else if(b<5&&logout()!=1)
		{
			this.fn_set_banner_empty();
		 	$(bannerObjId).innerHTML = this.outTimeHtm;
		 	return 
		}
        else
		{
			var userinfo = setTimeout("XL_login.fn_login_out()",50);
			var b =b + 1;
		}
	}
}   
*/
/*子页面加载完后自适应高度及除去loading函数*/
function height_auto(_id){	 
	try{
	 top.document.getElementById("set_config_iframe").style.height=top.frames["set_config_iframe"].document.getElementById("bg_config").offsetHeight+22;
     top.document.getElementById("set_config_iframe_parent").style.height=top.frames["set_config_iframe"].document.getElementById("bg_config").offsetHeight+22;
	}catch(e){}
 
   }

function show_hidden_search_menu()
{
    $("search_menu").style.display = "block";
	var float_obj = $("search_menu");
	var name = ["all","client","search_img"]
	show_hidden_float_obj(float_obj,"",name);
}
function jump_to_where(url)
{
    OpenPortalPage(url)
}
document.onkeydown=function()
{
	try{
		switch (event.keyCode)
		{
			case 27:
			close_all_popUpWindow();
			break;
			case 33:
			if($("file_info_box").style.display!="block")
			window.frames["view"].flip_over(1);
			break;
			case 34:
			if($("file_info_box").style.display!="block")
			window.frames["view"].flip_over(2);
			break;
			case 35:
			if($("file_info_box").style.display!="block")
			window.frames["view"].flip_over(3);
			break;
			case 36:
			if($("file_info_box").style.display!="block")
			window.frames["view"].flip_over(0);
			break;
			case 37:
			if($("file_info_box").style.display=="block")
			content_on_front();
			break;
			case 39:
			if($("file_info_box").style.display=="block")
			content_on_next();
			break;
			case 46:
			for(i=0;i<$("tb_list").getElementsByTagName("input").length;i++)
			{
				if($("tb_list").getElementsByTagName("input")[i].checked == true)
				{
					window.frames["view"].delete_task(0);
					window.frames["view"].after_bt_click("del");
					return;
				}
			}
			break;
		}
	}
	catch(e){}
}
function clear_content_all_set()
{
	var content_all_set =  ["file_name","file_size","file_type","save_catalog","file_loading","average_rapidity","work_ing_resource","work_all_resource","down_load_ed","time_ed","remnant_time","complete_time","start_time","ajax_file_name","res_for_com","bt_down_load_plan","bt_average_rapidity","bt_health_size","bt_remnant_time","bt_up_sed","bt_down_load_ed","bt_start_time","bt_complete_time","bt_time_ed"]
	for(i=0;i<content_all_set.length;i++)
	{
		$(content_all_set[i]).innerText = "";
	}


	if(document.getElementById("bt_table_list").firstChild)
	{
		document.getElementById("bt_table_list").firstChild.innerText = "";
	}
	$("left_info_box_img").src = "images/left_info_default.gif";
	//set_null
	viewArray = null;
	goodViewArray = null;
	viewArrayTemp = null;
	goodViewArrayNameDate = null;
	AjaxTxt = null;
	AjaxObj = null;
	SetWorkArray = null;
	CountTtClick = null;
	g_TaskId = null;
	report_type = null;
	characteristic = null;
	have_preview_video = null;
	all_select = null;
	SetBtFileList = null;
	AjaxImageSrc = null;
	AjaxJsonV = null;
	AjaxFileType = null;
	AJF = null;
	bt_table_list_tbody = null;
    BT_NODES = null;
    T_body = null;
}
function close_iframe()
{
	if(window.frames['ifr_json_id2']!=null)
	{
		try{window.frames['ifr_json_id'].jsonObj = null;
		window.frames['ifr_json_id2'] = null;
		//window.frames['p4pcon'] = null;
		}catch(e){}
	}
	if(window.frames['ifr_json_id']!=null)
	{
		try{window.frames['ifr_json_id'].jsonObj = null;
		window.frames['ifr_json_id'] = null;
		//window.frames['p4pcon'] = null;
		}catch(e){}
	}
}
function left_tb_class_change_for_over(obj)
{
	obj.style.backgroundColor = XL_cutis.styleBackGround;
}
function left_tb_class_change_for_out(obj)
{
	obj.style.backgroundColor = "";
}
var XL_tips_dft =
{
	Timer:{EntCnt:10,OutCnt:10},
	Layout:{MaxTop:190,MinTop:6,Unit:4},
	fn_set_time_news_media:function()
	{
		try{XL_tips.fn_set_resize_layout();XL_tips.fn_popup()}catch(e){}
	},
 	fn_set_tips:function()
	{
		var xlList = XL_partner.fn_get_partner_id();
		if(xlList == "1111"||xlList == null)
		{
			XL_tips_dft.fn_set_tips_news_media()	
		}
		else
		{
			XL_tips_dft.fn_set_tips_gut_partner();
			XL_tips_dft.fn_set_resize_listen()
		}
	},
	fn_set_tips_news_media:function()
	{
		var _srt = document.createElement("script");
		_srt.src = "http://biz5.sandai.net/tips/webtips.js";
		document.body.appendChild(_srt);
		//$("tipsBox").style.display = "block";
		$("tipsBox").style.width = "262px";
		$("tipsBox").style.height = "173px";
		$("tips").style.width = "258px";
		$("tips").style.height = "161px";
		setTimeout("XL_tips_dft.fn_set_time_news_media()",5000);
	},
	fn_set_tips_gut_partner:function()
	{
		try
		{
			var ptn_id = XL_partner.fn_get_partner_id();
			if(top.CopartnersJsonObj)
				var CJO = top.CopartnersJsonObj
			else
				return;
			for(i=0;i<CJO.copartners.length;i++)
			{
				if(CJO.copartners[i].coid==ptn_id)
				{
					var nowTime		= XL_time.fn_get_parseint_time(new Date());
					var URL			= XL_partner.fn_get_url(CJO);
					var upDateTime	= parseInt(CJO.copartners[i].copupdtime.replace(/-/g,""));
					var lastTime	= parseInt(get_config("Cooper", "CopartnersLastTime", "0"));
					var cptTitle	= CJO.copartners[i].title;
					var _ifr = document.createElement("iframe");
					_ifr.frameBorder = "0"; 
					_ifr.id = "tipsIframe";
					_ifr.scrolling = "no";
					_ifr.style.width = "285px";
					_ifr.style.height = "150px"
					_ifr.style.border = "0px"
					$("tipscontent").appendChild(_ifr);
					if(lastTime!="0"||lastTime<upDateTime||nowTime-lastTime>parseInt(CJO.copartners[i].copflag+"0000"))
					{
						_ifr.src = URL;
						$("cptTitle").innerText = cptTitle;
						set_config("Cooper","CopartnersLastTime",nowTime);
					}
				}
			}
		}
		catch(e){}
	},
	fn_set_tips_ent_timer: function (){g_TipsEntTimer = window.setInterval("XL_tips_dft.fn_layout_ent()",XL_tips_dft.Timer.EntCnt)},
	fn_set_tips_out_timer: function (){g_TipsOutTimer = window.setInterval("XL_tips_dft.fn_layout_out()",XL_tips_dft.Timer.OutCnt)},
	fn_layout_ent:function(){
		try{
			var TipsTop = parseInt($("tips").style.marginTop,10);
			if(TipsTop <= XL_tips_dft.Layout.MinTop)
				window.clearInterval(g_TipsEntTimer);
			$("tips").style.marginTop = TipsTop - XL_tips_dft.Layout.Unit;
			TipsTop = null;
			}
		catch(e){}
	},
	fn_layout_out:function()
	{
		try{
			var TipsTop = parseInt($("tips").style.marginTop,10);
			if(TipsTop>XL_tips_dft.Layout.MaxTop)
			{
				window.clearInterval(g_TipsOutTimer);
				$("tipsBox").style.display = "none";	
			}
			$("tips").style.marginTop = TipsTop + XL_tips_dft.Layout.Unit;
			}
		catch(e){}
	},
	fn_close_tips:function()
	{
		g_TipsEntTimer!=null?window.clearInterval(g_TipsEntTimer):g_TipsEntTimer=null;
		XL_tips_dft.fn_set_tips_out_timer();
	},
	fn_set_resize_layout:function()
	{
		try{
			var docElmet = document.documentElement;
			$("tipsBox").style.display = "block"; 
			$("tipsBox").style.top  = docElmet.scrollTop  + docElmet.clientHeight - $("tipsBox").offsetHeight - 2;
			$("tipsBox").style.left = docElmet.scrollLeft + docElmet.clientWidth  - $("tipsBox").offsetWidth  - 3 ;
			}
		catch(e){}
	},
	fn_set_resize_listen:function()
	{
		try
		{
			$("tipsIframe").attachEvent('onload',function()
			{
				top.XL_tips_dft.fn_set_resize_layout();
				top.XL_tips_dft.fn_set_tips_ent_timer();
			});
			window.onresize = XL_tips_dft.fn_set_resize_layout;
			window.onscroll = XL_tips_dft.fn_set_resize_layout;
		}
		catch(e){}
	}
};
var XL_time = 
{
	fn_get_parseint_time:function(_Date){
		return parseInt(_Date.getYear()+XL_time.fn_date_to_string(_Date.getMonth()+1)+XL_time.fn_date_to_string(_Date.getDate())+XL_time.fn_date_to_string(_Date.getHours())+XL_time.fn_date_to_string(_Date.getMinutes()))
	},
	fn_date_to_string:function(Str){
		Str = Str.toString();
		if(Str.length<2)
			Str = "0"+	Str
		return Str;
	}
};
var XL_partner =
{
	fn_get_url:function(CJO){
		return	"http://cop.my.xunlei.com/"+CJO.copartners[i].coid+"/"+CJO.copartners[i].coid+".htm";
	},
	fn_get_partner_id:function()
	{
		var _sfid;
		try{_sfid = thunder_server.GetPartnerId()}catch(e){}
		return _sfid!="" ? _sfid:"1111";
	},
	fn_set_logo_img:function()
	{
		/*
		var _sfid = XL_partner.fn_get_partner_id();
		if(_sfid=="1111")
		{
			//$("head_logo").src = "images/web_thunderlogo.gif";
		}
		else
		{
			if(window.location.href.indexOf("my.xunlei.com")!=-1)
				//$("head_logo").src = "images/"+_sfid+".gif"	;
			else
				//$("head_logo").src = "images/web_thunderlogo.gif";
			//$("head_logo").onerror = function(){$("head_logo").src = "images/web_thunderlogo.gif";}
		}*/
	}
};
var XL_strongTaskCnt =
{
	cnt:null,
	fn_get_cnt:function()
	{
		try	
		{
			XL_strongTaskCnt.cnt = parseInt(get_unopened_task_count());
		}
		catch(e){}
	},
	fn_set_cnt:function()
	{
		try	
		{
			XL_strongTaskCnt.fn_get_cnt();
			var tempCnt = XL_strongTaskCnt.cnt?XL_strongTaskCnt.cnt:0;
			if(tempCnt == 0)
				$("strong_task_cnt").innerText = "";
			else
				$("strong_task_cnt").innerText = "("+tempCnt+")";
			tempCnt = null;
		}
		catch(e){}
	}
}
var XL_cutis = 
{
	styleBackGround:"#b9d7f9",
	styleId:"new_style_id",
	styleIframeId:"new_style_iframe_id",
	fn_set_empty_style_index:function()
	{
		try{document.body.removeChild(document.getElementById(this.styleId))};
		catch(e){};
	},
	fn_set_empty_style_iframe:function()
	{
		try{window.frames["view"].document.body.removeChild(window.frames["view"].document.getElementById(this.new_style_iframe_id))};
		catch(e){};
	},
	fn_set_style:function(styleFile)
	{
		fn_style_state(styleFile);
		if(styleFile == "style")
		{
			thunder_server.SetConfig("Skin", "SkinType", "1");
		}
		else if(styleFile == "style_blue")
		{
			thunder_server.SetConfig("Skin", "SkinType", "2");
		}
		else if(styleFile == "style_argent")
		{
			thunder_server.SetConfig("Skin", "SkinType", "3");
		}
		this.fn_set_index_style(styleFile);
		this.fn_set_iframe_style(styleFile);
	},
	fn_set_index_style:function(styleFile)
	{
		if(styleFile == "style_argent")
			this.styleBackGround = "#dddddd";
		else
			this.styleBackGround = "#b9d7f9";
		this.fn_set_empty_style_index();
		var new_style = document.createElement("link");
		new_style.id  = this.styleId;
		new_style.rel = "stylesheet";
		new_style.href = "css/"+styleFile+".css";
		document.body.appendChild(new_style)
	},
	fn_set_iframe_style:function(styleFile)
	{
		try
		{
			this.fn_set_empty_style_iframe();
			var new_style_iframe = window.frames["view"].document.createElement("link");
			new_style_iframe.id  = this.styleIframeId;
			new_style_iframe.rel = "stylesheet";
			new_style_iframe.href = "css/"+styleFile+".css";
			window.frames["view"].document.body.appendChild(new_style_iframe)
		}
		catch(e){}
	}
}
function new_bt_work()
{
	open_new_works();
    thunder_server.ImportBtTorrentFile();
}
function open_cutis_change()
{
	if (event != null)
		event.cancelBubble = true;
	clear_all_float_window("cutis_id");
	if($("cutis_id").style.display == "none")
	{
		$("cutis_id").style.display = "block";
		$("cutis_id_text").innerText = "6";
	}
	else
	{
		$("cutis_id").style.display = "none";
		$("cutis_id_text").innerText = "4";	
	}
}
function open_xl_index()
{
	/*
	if (event != null)
		event.cancelBubble = true;
	clear_all_float_window("index_float");
	if($("index_float").style.display == "none")
	{
		$("index_float").style.display = "block";
		$("index_float_text").innerText = "6";
	}
	else
	{
		$("index_float").style.display = "none";
		$("index_float_text").innerText = "4";	
	}*/
}
function clear_all_float_window(_id)
{
	try
	{
		var all_float_id = [["new_works_id_list","new_works_span_list"],["new_works_id","new_works_span"],["cutis_id","cutis_id_text"],["index_float","index_float_text"]];
		for(i=0;i<all_float_id.length;i++)
		{
			if(all_float_id[i][0]!=_id)
			{
				$(all_float_id[i][0]).style.display = "none";
				$(all_float_id[i][1]).innerText = "4";
			}
		}
	}
	catch(e){}
}