//var base_path = "http://searchthesemanticweb.com:8889/ptsw/";
var base_path = "http://pingthesemanticweb.com/";

function ping()
{
	var url = document.getElementById("url").value;
	
//	window.location = base_path + "ping/" + escape(entityify(url));
//	window.location = base_path + "system/ping.php?url=" + escape(entityify(url));
	window.location = base_path + "ping.php?url=" + escape(entityify(url));
} 

function entityify(string)
{
	if(string)
	{
		return string.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;").replace("&#039;", "&quot;");
	}
	else
	{
		return string;
	}
}

function pingsList()
{
	var namespace = document.getElementById("namespace").value;		

	var serialization = document.getElementsByName("serialization");
	var req_serialization;
	
	var timeframe = document.getElementsByName("timeframe");
	var req_timeframe;
	
	for (counter = 0; counter < serialization.length; counter++)
	{
		if (serialization[counter].checked)
		{
			req_serialization = serialization[counter].value; 
		}
	}	

	for (counter = 0; counter < timeframe.length; counter++)
	{
		if (timeframe[counter].checked)
		{
			req_timeframe = timeframe[counter].value; 
		}
	}	

	window.location = base_path + "export/?serialization=" + req_serialization + "&ns=" + escape(namespace) + "&timeframe=" + escape(req_timeframe);

}



function onEnterPressBlock(field, event)
{
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) 
	{
		ping();
		return false;
	} 
	else
	{
		return true;
	}
}


function onEnterPressBlockSignup(field, event)
{
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) 
	{
		return false;
	} 
	else
	{
		return true;
	}
}
