//显示内容的位置
var div;
var _path;

function show_detail(method,path,showcontent) {
	var url = method+path; 
	_path = path;
	div=document.getElementById(showcontent);
	ajaxRequest(url, show1);
}
function show1(){
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	    if(xmlHttp.responseText!=null){
	      div.innerHTML=xmlHttp.responseText;
	      	if(document.getElementById('if1'))
	      		document.getElementById('if1').src="public/pagination.jsp?pagination=PAGENITION_TEST";
	    }
  	} 
}
function show2(){
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	    if(xmlHttp.responseText!=null){
	    	if(document.getElementById("detail_comment")){
	      		document.getElementById("detail_comment").innerHTML=xmlHttp.responseText;
	      	}
		    if(document.getElementById('if1')){
		      document.getElementById('if1').src="public/pagination.jsp?pagination=PAGENITION_TEST&r="+Math.random();
		    }
	    }
  	} 
}
function goPage(p1){
	ajaxRequest(_path+"&page="+p1, show2);
}
function savecomment(){
	 var commentcontent=document.getElementById("comment_content");
     if(commentcontent.value=="请完整输入你要评论的内容" || commentcontent.value==""){
        alert("请完整输入你要评论的内容");
        return false;
     }
     var commentname=document.getElementById("commentname");
     if(commentname.value==""){
        alert("请输入姓名");
        return false;
     }
     var commentemailresult="N";
     var commentemail=document.getElementById("commentemail");
     if(commentemail.value=="请输入电子邮箱地址" || commentemail.value==""){
       
     }else{
        var a=commentemail.value.indexOf('@');
	    var b=commentemail.value.lastIndexOf('.');
	    var len=commentemail.value.length-1;
	    if ((a<1) || (b==len) || (a>=b))
	    {
	      alert("email输入有误!");
		  return false;
	    }else{
	      commentemailresult=commentemail.value;
	    }
     }
     var commentyzm=document.getElementById("commentyzm");
     if(commentyzm.value=="输入验证码" || commentyzm.value=="" || commentyzm.value.length!=4){
       alert("验证码有误！");
       return false;
     }
     var chickshowip="N";
     var chickshowip1=document.getElementById("chickshowip");
     
     if(chickshowip1.checked){
        chickshowip="Y";
     }
     if(document.getElementById("username").value){
     	commentname.value=document.getElementById("username").value;
     }
     var infoid=document.getElementById("info_id");
     var url = "show.do?method=saveOneInfo_comment";
     var sendcontent=encodeURI("commentcontent="+commentcontent.value+"&commentname="+commentname.value+"&commentemail="+commentemail.value+"&chickshowip="+chickshowip+"&commentyzm="+commentyzm.value+"&infoid="+infoid.value);
	 ajaxRequest_submit(url, document.getElementById("commentsubmit"),sendcontent);
	 setTimeout("cancelsavecomment()", 3000);
	 
}

function cancelsavecomment(){
     var commentsubmit=document.getElementById("commentsubmit");
     if(commentsubmit.innerText=="评 论 已 提 交 , 正 在 审 核"){
     	
     	commentsubmit.innerText="";
     	document.getElementById("comment_content").value="";
     	document.getElementById("commentyzm").value="";
     	//刷新验证码
     	//document.getElementById("codecode").src='showpage/image.jsp?'+Math.random();
     }
}

function setBackColor(color){
	if(!color||color=='')
		color='FFFFFF';
	detail_content.style.backgroundColor=color;
}

function chgfsize(size){
	document.getElementById("detail_content").style.fontSize=size+"px";
	var node = document.getElementById("detail_content").childNodes;
	
	for(var i=0;i<node.length;i++){
		if(node[i].style){
			node[i].style.fontSize=size+"px";
		}
	}
	
}

function CopyURL(){
	document.getElementById("zzz-6").src="images/zzzz-6.jpg";
	var myHerf=top.location.href;
	var title=document.title;
	if(window.clipboardData){
		var tempCurLink=title + "\n" + myHerf;
		var ok=window.clipboardData.setData("Text",tempCurLink);
		if(ok) alert("按Ctrl + V ,粘贴到QQ或MSN上发给你的好友们吧 ！");
	}else{
		alert("对不起，目前此功能只支持IE，请直接复制地址栏的地址！");
	}
	document.getElementById("zzz-6").src="images/zzz-6.jpg";
}
function givePath(path){chgfsize(12)
	_path="show.do?method=getInfo_comment"+path;
	ajaxRequest(_path+"&page=1", show2);
	
}
