var countInfo = createSendRequestObject();
function createSendRequestObject()
{
	var xmlHttp;
	if(window.ActiveXObject)
	{
		try
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = false;
		}
	}
	else
	{
		try
		{
			xmlHttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlHttp = false;
		}
	}
	if (xmlHttp)
		return xmlHttp;
}
function sendClickInfo(click_url,keyword)
{

	var params="clickurl="+click_url+"&"+"keyword="+keyword;
	if (countInfo.readyState == 4 || countInfo.readyState == 0)
	{		

		var url=server_url+"/Count_Ads.php";

		url=client_url+"/php_proxy.php?ajax_path="+encodeURIComponent(url);

		countInfo.open("POST", url,"false");		
		countInfo.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		countInfo.setRequestHeader("Content-length", params.length);
		countInfo.setRequestHeader("Connection", "close");
		countInfo.onreadystatechange = handleServerResponse1;		
		countInfo.send(params);		
	}
	else
		setTimeout('sendClickInfo()', 1000);
}
function sendViewInfo(view_url,keyword)
{

	var params="viewurl="+view_url+"&"+"keyword="+keyword;
	if (countInfo.readyState == 4 || countInfo.readyState == 0)
	{	

		var url=server_url+"/Count_Ads.php";
		url=client_url+"/php_proxy.php?ajax_path="+encodeURIComponent(url);

		countInfo.open("POST", url,"false");
		countInfo.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		countInfo.setRequestHeader("Content-length", params.length);
		countInfo.setRequestHeader("Connection", "close");

		countInfo.onreadystatechange = handleServerResponse1;
		countInfo.send(params);	
	}
	else
		setTimeout('sendViewInfo()', 1000);
}
function handleServerResponse1()
{
	if (countInfo.readyState == 4)
	{
		if (countInfo.status == 200)
		{	
		//	alert(countInfo.responseText);
		}
		else
		{
			alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
	}
}