﻿<!--

if(window.location.href.indexOf("top_session=")!=-1){window.location.href=window.location.href.replace("http://www.52buyers.com/","http://www.52buyers.com/t.asp");}

//买家网_防止js报错
function killErrors() {
return true;
}
window.onerror = killErrors;


//弹窗
//if(Math.ceil(Math.random()*10)<4){window.open('http://www.xd6666.com','newwindow','toolbar=1,location=1,directories==1,status=1,menubar=1,scrollbars=1,resizable=1');}


var searchid=0;
var thispronum=0;	//文章页tbk自动切换
function searchsort(s,n,obj){
  searchsort_c();
}
function searchsort_o(){
  if(document.getElementById("SearchSort").style.display == "none"){
    document.getElementById("SearchSort").style.display = "";
	searchid=1;
  }else{
    document.getElementById("SearchSort").style.display = "none";
	searchid=0;
  }
}
function searchsort_c(){
  searchid=0;
  document.getElementById("SearchSort").style.display = "none";
}
//控制图片显示大小
function DrawImage(srcobj,maxwidth,maxheight)
{
    var OImg=new Image();
    OImg.src=srcobj.src;
    var scale=OImg.width>OImg.height?(OImg.width>maxwidth?OImg.width/maxwidth:1):(OImg.height>maxheight?OImg.height/maxheight:1);
    srcobj.width=OImg.width/scale;
    srcobj.Height=OImg.height/scale;   
 
} 
//通过ID获取object
function byid(objname)
{
 return document.getElementById(objname);
}
//更改字体大小 Begin =============================================
function fontZoomA(){
    document.getElementById('detailcontent').style.fontSize='';
	document.getElementById('detailcontent').style.lineHeight='';
}

function fontZoomB(){
    document.getElementById('detailcontent').style.fontSize='15pt';
	document.getElementById('detailcontent').style.lineHeight='25pt';
}
//更改字体大小 End =============================================

//买家网_淡出效果，遇背景图片和position:relative无效
var op=0;
function alphaforobj(theobjname,addnum){
    if(op<=100){
     document.getElementById(theobjname).filters.alpha.opacity=op;
     //if(objwidth!=""){document.getElementById(theobjname).style.width=objwidth;}
     op+=addnum;
     setTimeout("alphaforobj('"+theobjname+"',"+addnum+")",100);
    }
}

//买家网_首页浏览公告
function openwin(href)
{
	window.open(href,'answerwin','location=no,height=400, width=355, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}

//为兼容浏览器而使用此方法
function getOs()   
{   
   var OsObject = "";   
   if(navigator.userAgent.indexOf("MSIE")>0) {   
        return "MSIE";       //IE浏览器
   }
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){   
        return "Firefox";     //Firefox浏览器
   }
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) {   
        return "Safari";      //Safan浏览器
   }
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){   
        return "Camino";   //Camino浏览器
   }
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){   
        return "Gecko";    //Gecko浏览器
   }   
} 

//买家网_ajax初始化
function InitAjax(){
var ajax=false;
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); }
return ajax;
}

//买家网_文章回复表单点击事件
function textareaclick(thisarea)
{
 var browser=navigator.appName;
 var b_version=navigator.appVersion;
 var version=b_version.split(";"); 
 var trim_Version=version[1].replace(/[ ]/g,""); 
 if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") {commentform.style.margin='-15px 0px 0px 0px;';}
 thisarea.style.display='none';
 geteditor(thisarea);
 //getmotion();
}

//买家网_获取文章评论编辑器
function geteditor(thisarea)
{
 thisarea.style.display='none';
 divforeditor.style.display='block';
 //someemotion.style.display='block';
 divforeditor.innerHTML='<iframe ID="Editor" name="Editor" src="/CommentEditor/edit.html?id=content" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:345px;width:455px"></iframe>';

}

//买家网_获取评论表情
function getmotion()
{
		var ajax = InitAjax();
		ajax.open("POST", "/someemotion.asp", true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("action=show");
	        ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){someemotion.innerHTML = ajax.responseText;}
		  }
}

//买家网_获取文章回复列表
function GetArtComment(id,page,isreply){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", "/GetArtComment.asp", true);
		//var btype=getOs();
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("id="+id+"&page="+page+"&isreply="+isreply);
		//ajax.onreadystatechange = (btype!="Firefox")?(xmlHandle):(xmlHandle(ajax.responseText));
        	ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){
			getinfo = ajax.responseText;
			CommentList.innerHTML=getinfo;
			}
	      		
		  }
}

function xmlHandle(txt)
{

}

//获取淘宝api广告
function Gettaobaoapi(keyword){
		//return false;	//暂时不显示淘宝商品
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", "http://www.52buyers.com/GetADbyAjax.asp", true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("keyword="+escape(keyword));
	    	ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;
			if (getinfo=="noapi") {byid("taobaoapi").innerHTML="";}
			 else {byid("taobaoapi").innerHTML=getinfo;}
		}
	      		
		  }
}

function ToAjax(url,Post){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send(Post);
	    	ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
		  }
	}
}


//下面三个函数是首页真假辨别分类处仿flash的js广告js部分
//当鼠标移过的时候
function change_flash_1(objname,objname_word,priceobj) {
document.getElementById(objname).style.border="1px solid #ff5500";
document.getElementById(objname_word).style.color="#ff9a00";
document.getElementById(priceobj).style.color="#ff0000";
}
//当鼠标移开的时候
function change_flash_2(objname,objname_word,priceobj) {
document.getElementById(objname).style.border="1px solid #555555";
document.getElementById(objname_word).style.color="#ffffff";
document.getElementById(priceobj).style.color="#000000";
}
//下面函数修改淘客地址
function gototaobao(flag) {
if (flag==1) {
 window.location.href='http://s.click.taobao.com/t_1?i=qz77XJlo7LqNvw%3D%3D&p=mm_17800174_0_0&n=11';
}
else {window.location.href='http://search8.taobao.com/browse/0/n-66---------------g,nvwv6mjxhaydamjxgrptaxzq----------------------0-----------------g,yk35fv6n7224oige2diky----------------40--commend-0-all-0.htm?at_topsearch=1&f=c';}
}


//0 刷新 NewRe 1刷新本页
ckreview=0;
function Clreview(){
  if(ckreview > 0){
    alert('请求已经发出，请等待片刻！\n\n'+'不要重复提交，谢谢！');
	return false;
  }
  return true;
}


//买家网_发表文章回复
function Addnewcomment(id){
  //if(getOs()=="Firefox" || getOs()=="Safari") {alert("非常抱歉，暂不支持您的浏览器，提交失败！");return false;}
  //if(typeof(Editor)=='undefined'){var contenthide;contenthide=document.getElementById("contenthide");textareaclick(contenthide);alert('请输入回复内容！');return false;};
    if(byid("contenthide").innerHTML==""){alert('请输入回复内容！');byid("contenthide").focus();return false;}
  if(Clreview()){
	ckreview=1;
	//Editor.switchEditor(0);Editor.switchEditor(1);
	//var content=Editor.posteditor_textarea.innerHTML;
	var content=byid("contenthide").innerHTML;
	window.clipboardData.setData("Text",content); 
	//Editor.posteditor_textarea.innerHTML="请稍后，您的回复正在提交中...回复内容已经复制到剪贴板...";
	byid("contenthide").innerHTML="请稍后，您的回复正在提交中...回复内容已经复制到剪贴板...";
	 if(content==""){alert("回复内容不能为空！");ckreview=0;return false;}//删除Editor.switchEditor(0);Editor.posteditor_textarea.focus();
         var Anonymity = "";
	 if(document.reform.Anonymity.checked){Anonymity = "yes"}
     var getinfo = "";
     var ajax = InitAjax();
     ajax.open("POST","/reply.asp", true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
     ajax.send("Action=ReviewSave&ID="+id+"&Content="+escape(content)+"&Anonymity="+Anonymity);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){getinfo = ajax.responseText;
	     if(getinfo!=""){
		ckreview=0;
		 if(getinfo=="error0"){alert("提交数据不能为空！");}
		 else if(getinfo=="error1"){alert("数据过长，请缩短在20000以内！\n\n插入过多的图片会占据大量的字符！");}
		 else{alert("未知错误！"+getinfo);}
		}else{
		ckreview=0;
		GetArtComment(id,'','1');
		alert("发送成功！");
		//Editor.switchEditor(0);
		//Editor.clearcontent();
		 }
		 //Editor.posteditor_textarea.innerHTML="";
		byid("contenthide").innerHTML="";
	   }
     }
  }
  return false;
}

//下面的函数是评论支持反对
function SetCommentNum(url,types,id,artid,page){
  if(Clreview()){
     ckreview=1;
     var ajax = InitAjax();
     ajax.open("POST",url, true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
     ajax.send("Action=commentnum&id="+id+"&artid="+artid+"&types="+types);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){
		  ckreview=0;
		  if (ajax.responseText!="") {alert(ajax.responseText);return false;}
			else{GetArtComment(artid,page,0);}
		}
	   }
  }
  return false;
}


//下面的函数是更新按页显示评论的
function GetCommentByPage(page,artid){
  if(Clreview()){
     ckreview=1;
     op=20;
     alphaforobj('commentlist2',5);
     var ajax = InitAjax();
     ajax.open("POST","/web_taginterface/CreatHtml.asp", true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
     ajax.send("page="+page+"&Action=AS$web_article$idarticle$Sid:"+artid+";Eid:"+artid);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){
		  op=80;
		  ckreview=0;
		  document.getElementById("CommentList2").innerHTML = ajax.responseText.replace("Next$1$1","");
	   }
     }
  }
  return false;
}

//下面的函数是获取相关文章的
function Getotherarticle(title,id){
     var ajax = InitAjax();
     var tmpotherarticle="";
     ajax.open("POST","/ArticleForGoogle.asp", true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
     ajax.send("arttitle="+title+"&id="+id);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){
		  if (ajax.responseText!="") {
			tmpotherarticle+="<div style=\"margin-top:10px;width:305px;\">";
			tmpotherarticle+=" <img src=\"/images/icon_lanse.gif\" style=\"border:0px;\">";
			tmpotherarticle+=" <img src=\"/images/other_top.gif\" style=\"border:0px;margin-bottom:-2px;width:302px;height:7px;\">";
			tmpotherarticle+=" <div style=\"background:url('/images/other_center.gif');margin-left:2px;margin-bottom:-2px;\">";
			tmpotherarticle+=" <ul style=\"height:auto;overflow-x:hidden;padding-left:10px;padding-right:10px;\">";
			tmpotherarticle+=ajax.responseText;
			tmpotherarticle+=" </ul>";
			tmpotherarticle+=" </div>";
			tmpotherarticle+=" <img src=\"/images/other_bottom.gif\" style=\"border:0px;width:302px;height:7px;\">";
			tmpotherarticle+="</div>";
			//document.getElementById("theotherarticle").innerHTML=tmpotherarticle;
			}
		else {document.getElementById("theotherarticle").innerHTML="";}
	   }
     }

}


//显示文章页面tbk搜索自动切换
function shownext(thispronum,totalnum,isalpha){
 if(thispronum>=totalnum){thispronum=0;}
 thispronum=thispronum+1;
 document.getElementById("searchpro").innerHTML=document.getElementById("searchpro"+thispronum).innerHTML;
 if(isalpha==1){op=0;alphaforobj('searchpro',20);}
 setTimeout("shownext("+thispronum+","+totalnum+",1)",8000);
}
//获取文章页面右边内容
function getartad(id){
document.writeln("<div><script type=\"text/javascript\">/*300*250，创建于2011-11-18*/ var cpro_id = 'u682182';</script><script src=\"http://cpro.baidu.com/cpro/ui/c.js\" type=\"text/javascript\"></script></div>");
	var getinfo = "";
	var ajax = InitAjax();
	ajax.open("POST", "/articlead.asp", true);
	ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
	ajax.send("id="+escape(id));
	ajax.onreadystatechange = function(){
	  if (ajax.readyState == 4){getinfo = ajax.responseText;
		if (getinfo=="") {byid("taobaoapi").innerHTML="";}
		 else {
			getinfo=getinfo.split("$mjw$");
			if(getinfo.length==1){byid("taobaoapi").innerHTML+=getinfo[0];}
			 else if(getinfo.length==2){byid("taobaoapi").innerHTML+=getinfo[0];shownext(0,getinfo[1],0);}
			 else{byid("taobaoapi").innerHTML+=getinfo[0];shownext(0,getinfo[1],0);byid("viewnumajax").innerHTML=getinfo[2];if(byid("viewnum")!=null){if(byid("viewnum").innerHTML==""){byid("viewnum").innerHTML=byid("viewnumajax").innerHTML;}}}
			}
		}
	}
}
