function toggleFlash(state) {
	var objects = this.doc.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	var embeds = this.doc.getElementsByTagName("embed");
	for (var i = 0; i < embeds.length; i++) {
		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
}
function querySt(ji) 
{
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) 
    {
	ft = gy[i].split("=");
	    if (ft[0] == ji) 
	    {
		return ft[1];
	    }
    }
}
function showSearch(str)
{
	$.doTimeout( 'typing', 50, function(){
		if (str.length<=1)
		{ 
			$("#content_box").hide(150);
			return;
		}
		else if (!document.getElementById("results"))
		{
			document.getElementById("content_box").innerHTML = '<div id="results"></div>';
			$("#content_box").show(150);
		}
		else
		{
			$("#content_box").show(150);
		}

		var http = GetXmlHttpObject();
		var url = "ajax.aspx";
		var params = "search="+str+"&rnd="+Math.random();
		http.open("POST", url, true);

		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http.setRequestHeader("Content-length", params.length);
		http.setRequestHeader("Connection", "close");

		http.onreadystatechange = function() {//Call a function when the state changes.
			if(http.readyState == 4 && http.status == 200) {
				document.getElementById('results').innerHTML = http.responseText
				$("#content_box").animate( { height: $("#results").height() }, 150, "swing" );
			}
		}
		http.send(params);

	});
} 

function getComment(comment_id, page_id)
{
	http = GetXmlHttpObject();
	var url="ajax.aspx?c=" + comment_id + "&p=" + page_id + "&rnd="+Math.random();
	http.onreadystatechange= function() { 
		if (http.readyState==4)
		{
			document.getElementById('comment_'+comment_id).innerHTML = http.responseText;
		}
		
	}
	http.open("GET",url,true);
	http.send(null);
}

function getAComment(comment_id, r, page_id)
{
	http = GetXmlHttpObject();
	var url="ajax.aspx?c=" + comment_id + "&rmv="+r+"&p=" + page_id + "&rnd="+Math.random();
	http.onreadystatechange= function() { 
		if (http.readyState==4)
		{
			document.getElementById('comment_'+comment_id).innerHTML = http.responseText;
		}
		
	}
	http.open("GET",url,true);
	http.send(null);
}


function postComment(comment_id, page_id)
{
	http = GetXmlHttpObject();
	var url = "ajax.aspx";
	var params = "post_comment=" + comment_id + "&page_id=" + page_id;
	if(document.getElementById('author_'+comment_id))
		params += "&author=" + encodeURIComponent(document.getElementById('author_'+comment_id).value);
	if(document.getElementById('subject_'+comment_id))
		params += "&subject=" + encodeURIComponent(document.getElementById('subject_'+comment_id).value);
	if(document.getElementById('http_'+comment_id))
		params += "&http=" + encodeURIComponent(document.getElementById('http_'+comment_id).value);
	if(document.getElementById('email_'+comment_id))
		params += "&email=" + encodeURIComponent(document.getElementById('email_'+comment_id).value);
	if(document.getElementById('message_'+comment_id))
		params += "&message=" + encodeURIComponent(document.getElementById('message_'+comment_id).value);
		
	params += "&rnd="+Math.random();
	http.open("POST", url, true);

	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			document.getElementById('comment_'+comment_id).innerHTML = http.responseText
		}
	}
	http.send(params);
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
