/*
专题页ajax
kalen 2009.4.22
*/
var NORMAL_STATE = 4;
var LOGIN_PREFIX = '/gootrip/_20include/suipian/php/html_9_002_topic_1.php?channelid=9&';
var http = getHTTPObject();

// 获得一个跨浏览器的XMLHttpRequest
function getHTTPObject() {
	var http_object;

	// MSIE

	/*@cc_on
	@if (@_jscript_version >= 5)
		try {
			http_object = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				http_object = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (E) {
				http_object = false;
			}
		}
	@else
		xmlhttp = http_object;
	@end @*/


	// Mozilla 

	if (!http_object && typeof XMLHttpRequest != 'undefined') {
		try {
			http_object = new XMLHttpRequest();
		}
		catch (e) {
			http_object = false;
		}
	}

	return http_object;
}
//发送
function send(id,content,stat)
{
	if (content != '') {	
		http.open('GET', LOGIN_PREFIX + 'cbody='+content+'&topicid='+id+'&stat='+stat, true);
		//alert(LOGIN_PREFIX + 'cbody='+content+'&topicid='+id+'&stat='+stat);
		http.onreadystatechange = handleHttpResult;
		http.send(null);
	}
}

//返回
function handleHttpResult()
{
	if (http.readyState == NORMAL_STATE) {
		document.getElementById("result").innerHTML = http.responseText;
		document.getElementById("content").value="";
		//alert(http.responseText);		
	}
}

//执行
function ajax_submit(id,stat)
{
	var content = document.getElementById('content').value;
	try {
		send(id,content,stat);
	}
	catch (e)
	{
		alert("send error!");
	}
}

//复制到剪贴板
function copyToClipBoard(){ 
	alert("复制成功!");
	var clipBoardContent=window.location.href; 
	window.clipboardData.setData("Text",clipBoardContent); 
}
