/*
* Author: 	Girish Bauskar girishbauskar@gmail.com
* Date:		20/MAR/2010
*/

var http = getHTTPObject();
//var http2 = getHTTPObject();

function getHTTPObject() 
{
	var http = false;
	//Use IE's ActiveX items to load the file.
	if(typeof ActiveXObject != 'undefined') {
		try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {http = false;}
		}
	//If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
	} else if (XMLHttpRequest) {
		try {http = new XMLHttpRequest();}
		catch (e) {http = false;}
	}
	return http;
}

function handler() {//Call a function when the state changes.
	if(http.readyState == 4 && http.status == 200) {
		//doument.write(http.responseText);
	}
}

//function handler2() {//Call a function when the state changes.
//	if(http2.readyState == 4 && http2.status == 200) {
//		alert(http2.responseText);
//	}
//}

function keywordTrack(campaign, creative, keyword, page, action)
{
	var url = "http://www.paidforresearch.com/keywordtracker/keywordTracker.php";
	
	if(action=='view')
	{
		//doument.write('view section');
		var params = "campaign="+campaign+"&creative="+creative+"&keyword="+keyword+"&page="+page+"&action="+action;
		http.open("GET", url+"?"+params, true);
		http.onreadystatechange = handler;
		http.send(null);
		//http = null;
	}
	
//	if(action=='submit')
//	{
//		var params = "campaign="+campaign+"&creative="+creative+"&keyword="+keyword+"&page="+page+"&action="+action;
//		http2.open("GET", url+"?"+params, true);
//		http2.onreadystatechange = handler2;
//		http2.send(null);
//	}
}
