//作者：李思若
//QQ:554892


/*

参数说明:
	1 目的地地区评论
	2 目的地景点评论
	3 视频评论
	4 新闻评论
	5 博客文章评论
	6 博客图片评论

*/
function AllSiteComment(Num,Parameter)
{
	AllSiteCommentShowInfo('/Comment/AllSiteCommentList.asp',Parameter+'&Num='+Num,'AllSiteCommentContentValue');
}


function AllSiteCommentShowInfo(Url,Parameter,InsertID) {
		
	var xmlhttp = null;
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("microsoft.xmlhttp");
		} catch(e) {
			try {
				xmlhttp = new ActiveObject("msxml2.xmlhttp");
			} catch(e) {
				try {
					xmlhttp = new ActiveObject("msxml3.xmlhttp");
				} catch(e) {
					xmlhttp = null;
				}
			}
		}
	} else {
		xmlhttp = null;
	}


	var getValue;
	xmlhttp.open("post",Url,true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
    xmlhttp.send(Parameter);
	xmlhttp.onreadystatechange = function() 
	{ 
		if ( xmlhttp.readyState==4 ) 
		{ 
			if(xmlhttp.status==200)
			{
				getValue = xmlhttp.responseText;
			}
			else
			{
				getValue = '读取失败，请<a href="javascript:AllSiteCommentShowInfo(\''+Url+'\',\''+Parameter+'\',\''+InsertID+'\');" class="red">重新</a>刷下';
			}
								
			document.getElementById(InsertID).innerHTML=getValue;			
		} 
	} 
}

function AllSiteCommentPostData(Num,ID)
{
	var Url='/Comment/AllSiteCommentAddSave.asp';
	var TargetUrl='/Comment/AllSiteCommentList.asp';
	var Parameter='ID='+ID+'&UpDown='+document.all.UpDown.value+'&CueNum='+document.all.CueNum.value+'&AbPage='+document.all.TotalPage.value+'&Content='+escape(document.all.Post.value)+'&TmpPetName='+escape(document.all.TmpPetName.value)+'&Num='+Num;
	var InsertID='AllSiteCommentContentValue';
	
	
	var xmlhttp = null;
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("microsoft.xmlhttp");
		} catch(e) {
			try {
				xmlhttp = new ActiveObject("msxml2.xmlhttp");
			} catch(e) {
				try {
					xmlhttp = new ActiveObject("msxml3.xmlhttp");
				} catch(e) {
					xmlhttp = null;
				}
			}
		}
	} else {
		xmlhttp = null;
	}

	var getValue;
	xmlhttp.open("post",Url,true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
    xmlhttp.send(Parameter);
	xmlhttp.onreadystatechange = function() 
	{ 
		if ( xmlhttp.readyState==4 ) 
		{ 
			if(xmlhttp.status==200)
			{
				getValue = xmlhttp.responseText;
				if(getValue=='请输入评论内容')
				{
					alert('请输入评论内容');	
				}
				else if(getValue=='验证码错误')
				{
					alert('验证码错误');
					document.getElementById('CueNumPic').innerHTML='<img src="/INC/code.asp">';
				}
				else
				{
					AllSiteCommentShowInfo(TargetUrl,Parameter,InsertID);
					document.getElementById('TmpPetName').value='';
					document.getElementById('Post').value='';
					document.getElementById('CueNum').value='';
				}
			}
		} 
	} 


}



