var xmlhttpobj;

function GetXmlHttpObject()
{
	var xmlHttpObj = null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttpObj = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
    	{
    		xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
    	}
		catch (e)
		{
			xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttpObj;
}

function sendRequest(param, pages)
{
	xmlhttpobj = GetXmlHttpObject();
	
	if (xmlhttpobj == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var string = 'param=' + param + '&pages=' + pages;
		
	xmlhttpobj.onreadystatechange = stateChanged;
	xmlhttpobj.open("POST", 'http://www.inhive.com/scripts/ajax-script.php', true);
	
	xmlhttpobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttpobj.setRequestHeader("Content-length", string.length);
	xmlhttpobj.setRequestHeader("Connection", "close");

	xmlhttpobj.send(string);
}

function stateChanged() 
{
	document.getElementById('portPages').innerHTML = xmlhttpobj.responseText;
}

/*function sendRequestPrj()
{
	xmlhttpobj = GetXmlHttpObject();
	
	p1 = '0';
	if(document.getElementById('cid').checked)
		p1 = '1';

	p2 = '0';
	if(document.getElementById('web').checked)
		p2 = '1';

	p3 = '0';
	if(document.getElementById('3d').checked)
		p3 = '1';

	p4 = '0';
	if(document.getElementById('print').checked)
		p4 = '1';

	p5 = '0';
	if(document.getElementById('free').checked)
		p5 = '1';
	
	if (xmlhttpobj == null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var string = 'crits=' + p1 + p2 + p3 + p4 + p5;
		
	xmlhttpobj.onreadystatechange = stateChangedPrj;
	xmlhttpobj.open("POST", 'scripts/ajax-prj-script.php', true);
	
	xmlhttpobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttpobj.setRequestHeader("Content-length", string.length);
	xmlhttpobj.setRequestHeader("Connection", "close");

	xmlhttpobj.send(string);
	
}

function stateChangedPrj() 
{ 
	if (xmlhttpobj.readyState == 4)
		document.getElementById("portfolio").innerHTML = xmlhttpobj.responseText;
}*/