function AddFavorite(sURL, sTitle)
{try
    {window.external.addFavorite(sURL, sTitle);}
    catch (e)
    {
        try
        {window.sidebar.addPanel(sTitle, sURL, ""); }
        catch (e)
        {alert("加入收藏失败，请使用Ctrl+D进行添加");}
    }
}


function t(lei,zs,dq){
for(i=1;i<=zs;i++){
document.getElementById("pic_"+lei+"_"+i).className="xxiaolan";
document.getElementById("table_"+lei+"_"+i).style.display="none";}
document.getElementById("pic_"+lei+"_"+dq).className="hei";
document.getElementById("table_"+lei+"_"+dq).style.display="";
}
function ts(lei,zs,dq){
for(i=1;i<=zs;i++){
document.getElementById("pic_"+lei+"_"+i).className="show";
document.getElementById("pic1_"+lei+"_"+i).style.background ="";
document.getElementById("table_"+lei+"_"+i).style.display="none";}
document.getElementById("pic_"+lei+"_"+dq).className="yin";
document.getElementById("pic1_"+lei+"_"+dq).style.background ="url(/images/tt.PNG)";
document.getElementById("table_"+lei+"_"+dq).style.display="";
showMsg("table_"+lei+"_"+dq);
}
function ss(){
document.getElementById("s_1").style.display="none";
document.getElementById("s_3").style.display="";
document.getElementById("s_2").style.display="";
}
function ss1(aa){
document.getElementById("s_3").style.display="none";
document.getElementById("s_2").style.display="none";
document.getElementById("s_1").style.display="";
document.getElementById("ss_1").innerHTML=document.getElementById("ss_"+aa).innerHTML;
document.getElementById("lei").value=document.getElementById("ss_"+aa).innerHTML;
}

function mkk(ss){
	ss++;
	if (ss>5 ) {ss=1;}
	ts(12,5,ss);
 setTimeout("mkk("+ss+")",10000);
 }

function setOpacity(obj, value){
	//if(document.all){ 
	if(value == 100){ 
	obj.style.filter = ""; 
	obj.style.opacity =1; 
	obj.style.MozOpacity = 1; 
	obj.style.KHTMLOpacity = 1;
	
	}else{ 
	obj.style.filter = "alpha(opacity=" + value + ")"; 
	obj.style.opacity = ""+value / 100; 
	obj.style.MozOpacity = ""+value / 100; 
	obj.style.KHTMLOpacity =""+value / 100;
	
	} 
	//}else{
	 //obj.style.MozOpacity = value / 100; 
	 
	 //} 
	} 
function changeOpacity(obj, startValue, endValue, step, speed){ 
	if(step > 0 && startValue < endValue || step < 0 && startValue > endValue){ 
	setOpacity(obj, endValue); return; 
	} 
	setOpacity(obj, startValue); 
	setTimeout(function(){changeOpacity(obj, startValue-step, endValue, step, speed);}, speed); }
	function showMsg(a){ 
	var msg = document.getElementById(a); 
	var step = 20, speed = 10; 
	//msg.isShow = !msg.isShow; 
	if(!msg.isShow){ 
	changeOpacity(msg, 0, 100, -step, speed); 
	}else{ 
	changeOpacity(msg, 100, 0, step, speed); 
	} 
	}
	
	function bb(p_id){
			$("#a_4_"+p_id).html("loading...");
			for (j=1;j<4;j++){
			$("#a_5_"+j).removeClass("tdhong");
			$("#a_5_"+j).addClass("tdwu");
			}
			$("#a_5_"+p_id).removeClass("tdwu");
			$("#a_5_"+p_id).addClass("tdhong");
		$.ajax( {
			type: "get",
			cache: false,
			url: "/or"+p_id+".asp",
			data: "id=" + p_id ,
			dataType:"text",
			success: function(result) {
			$("#nr_2").html(result);
 			}
		} );
		}
	function bb_2(p_id,p_id1){
			$("#a_4_"+p_id).html("loading...");
			for (j=1;j<4;j++){
			$("#a_5_"+j).removeClass("tdhong");
			$("#a_5_"+j).addClass("tdwu");
			}
			$("#a_5_"+p_id).removeClass("tdwu");
			$("#a_5_"+p_id).addClass("tdhong");
		$.ajax( {
			type: "get",
			cache: false,
			url: "/or"+p_id+"_2.asp",
			data: "id=" + p_id +"&id1="+p_id1,
			dataType:"text",
			success: function(result) {
			$("#nr_2").html(result);
 			}
		} );
		}
		
		function ma(aa){
document.getElementById("cd_"+aa).style.display="";
document.getElementById("a_"+aa).className="daohang12";
}
function mb(aa){
document.getElementById("cd_"+aa).style.display="none";
document.getElementById("a_"+aa).className="daohang11";
}
function mc(){
	for(i=1;i<10;i++){
document.getElementById("cd_"+i).style.display="none";
	}
}

function xm_2(p_id,p_id1){
			$("#a_1_"+p_id).html("loading...");
			for (j=0;j<7;j++){
			$("#a_2_"+j).removeClass("tdhong");
			$("#a_2_"+j).addClass("tdwu");
			}
			$("#a_2_"+p_id1).removeClass("tdwu");
			$("#a_2_"+p_id1).addClass("tdhong");
		$.ajax( {
			type: "get",
			cache: false,
			url: "/or1r_2.asp",
			data: "id=" + p_id+"&id1=<%=t_id%>" ,
			dataType:"text",
			success: function(result) {
			$("#nr_1").html(result);
 			}
		} );
		}
		
if (!String.prototype.subString) {
	String.prototype.subString = function(length, han, dot, dotstr) {
		han = han || 2;
		dotstr = dotstr || "…";
		var newLength = 0;
		var newStr = "";
		var chineseRegex = /[^\x00-\xff]/g;
		var singleChar = "";
		var strLength = this.replace(chineseRegex, "**").length;
		for (var i = 0; i < strLength; i++) {
			singleChar = this.charAt(i).toString();
			if (singleChar.match(chineseRegex) != null) {
				newLength += han
			} else {
				newLength++
			}
			if (newLength > length) {
				break
			}
			newStr += singleChar
		}
		if (dot && strLength > length) {
			newStr += dotstr
		}
		return newStr
	}
}
		
function xm(p_id,p_id1){
			$("#a_1_"+p_id).html("loading...");
			for (j=0;j<8;j++){
			$("#a_2_"+j).removeClass("tdhong");
			$("#a_2_"+j).addClass("tdwu");
			}
			$("#a_2_"+p_id1).removeClass("tdwu");
			$("#a_2_"+p_id1).addClass("tdhong");
		$.ajax( {
			type: "get",
			cache: false,
			url: "/or1r.asp",
			data: "id=" + p_id ,
			dataType:"text",
			success: function(result) {
			$("#nr_1").html(result);
 			}
		} );
		}
		function HTMLDecode(text) {
	var temp = document.createElement("div");
	temp.innerHTML = text;
	var output = temp.innerText || temp.textContent;
	temp = null;
	return output
}
					  function tq_fx(type) {
	var link = '';
	var pics = new Array();
	switch (type) {
	case 'sina':
		link = 'http://v.t.sina.com.cn/share/share.php?appkey=174056365&url={url}&title={title}&content=gb2312';
		break;
	case 'qq':
		link = 'http://v.t.qq.com/share/share.php?title={title}&url={url}&pic={pic:|}&appkey=8491faab72034c9d968bf5319fd9db5e';
		break;
	case 'kaixin':
		link = 'http://www.kaixin001.com/repaste/share.php?rtitle={title}&rurl={url}&rcontent={content}';
		break;
	case 'sohu':
		link = 'http://t.sohu.com/third/post.jsp?&url={url}&title={title}&content=utf-8&pic={pic}';
		break;
	case 'renren':
		link = 'http://share.renren.com/share/buttonshare.do?link={url}&title={title}';
		break;
	case 'baidu':
		link = 'http://tieba.baidu.com/i/sys/share?type=text&title={title}&link={url}';
		break;
	case 'baiduhi':
	     link = 'http://apps.hi.baidu.com/share/?url={url}&title={title}&content={content}';
		 break;
	case 'qqzone':
	     link = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}&title={title}&pic={pic}';
		 break;
	case 'douban':
		link = 'http://www.douban.com/recommend/?url={url}&title={title}';
		break;
	case 'feixin':
		link = 'http://space.feixin.10086.cn/api/share?source={source}&title={content}&url={url}';
		break;
	case 'taojianghu':
		link = 'http://share.jianghu.taobao.com/share/addShare.htm?url={url}&title={title}&content={content}';
		break;
	case 'maopu':
		link = 'http://tk.mop.com/api/post.htm?url={url}&title={title}&desc={content}';
		break;
	}
	$('#neirong img').each(function(i, n) {
		 pics.push(n.src)
	});
	link = link.replace('{title}', encodeURIComponent(HTMLDecode(document.getElementsByTagName('h1')[0].innerHTML.replace(new RegExp(' ','gm'),''))));
	link = link.replace('{url}', encodeURIComponent(window.location.href));
	link = link.replace('{source}', 'gamerlol.com');
	link = link.replace('{pic:|}', pics.join('|'));
	link = link.replace('{cont}', encodeURIComponent($('#neirong').text().replace(new RegExp(' ','gm'),'').subString(100, 1, true)));
	link = link.replace('{content}', encodeURIComponent($('#neirong').text().replace(new RegExp(' ','gm'),'').subString(500, 1, true)));
	window.open(link)
	//alert($('#neirong').text().replace(new RegExp('&nbsp;','gm'),'').subString(500, 1, true))
}

function abc1(page,id){
$.ajax( {
type: "get",
cache: false,
url: "/plajax.asp",
data: "id="+id+"&act=lb&CurPage="+page,
//"gjz="+escape(gjc)
dataType:"text",
success: function(result) {	 
	$("#pl").html(result);}
} );
}

function abc(url,dataa,id){
$.ajax( {
type: "get",
cache: false,
url: url,
data: dataa,
//"gjz="+escape(gjc)
dataType:"text",
success: function(result) {
	if (result=="tq"){alert("您已经支持过该评论");}else{
	$("#pl_z_"+id).html(result);}
	}
} );
}
function abc2(){
	
	 if($("#bx1").val()==""){
		alert("该信息已删除");
		 
		return false;
	}
    if($("#bx2").val()==""){
		alert("请输入登陆后留言或者选择匿名发言！");
		 
		return false;
	}
	if($("#bx3").val()==""){
		alert("请输入留言内容！");
		$("#bx3").focus();
		return false;
	}
	if($("#yzm").val()==""){
		alert("请输入验证码！");
		$("#yzm").focus();
		return false;
	}
	var id=$("#bx1").val();
	
$.ajax( {
type: "get",
cache: false,
url: "/ajax_bxadd.asp",
data: "yzm="+escape($("#yzm").val())+"&bx1="+escape($("#bx1").val())+"&bx2="+escape($("#bx2").val())+"&bx3="+escape($("#bx3").val())+"&bx4="+escape($("#bx4").val()),

//"gjz="+escape(gjc)
dataType:"text",
success: function(result) {
 
	if (result=="0"){alert("验证码不正确，请重新填写");$("#yzm").focus();
	}else if(result=="1"){
		alert('评论成功，感谢您的支持');
		abc1(1,id);
	    $("#yzm").val("");
		$("#bx3").val("");
		$("#bx4").val("");
		$("#imgyzm").attr("src","/public/getcode.asp?"+parseInt(10000*Math.random()));
		
		}
	}
} );
}
						 
function hf(id){
$("#hf").html("<span style='color:#0B3B8C'>回复:</span> "+$("#pl_n_"+id).html()+" <span style='color:#0B3B8C;cursor:pointer' onclick='qc()'>取消回复</span>");
							 $("#bx4").val(id);
							 }
							  function qc(){
							 $("#hf").html("");
							 $("#bx4").val("");
							 }
function zc(id){
							  abc("/plajax.asp","id="+id+"&act=plz",id);
							 }
function img1(){
								 $("#imgyzm").attr("src","/public/getcode.asp?"+parseInt(10000*Math.random()));
								 }
function abck(idx){
$.ajax( {
type: "get",
cache: false,
url: "/pl.asp",
data: "id="+idx,
dataType:"text",
success: function(result) {
	 
	$("#plall").html(result);}
 
} );
}
