

	var sURL = unescape(window.location.pathname);
	
	// Updating immagini table --------------------------------------------------------------------------------
	
	var httpUpdateTable = createRequestObject();
	
	function updateVotiimmaginiTable()
	{
		str = getFormValues(document.formVoti);
		httpUpdateTable.open('post', 'ajaxScripts/updateHotOrNotTable.php');
		httpUpdateTable.onreadystatechange = handleUpdateTableResponse;
		httpUpdateTable.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");
		httpUpdateTable.send(str);
	}
	
	function handleUpdateTableResponse()
	{
		if(httpUpdateTable.readyState == 4)
		{
			document.getElementById("response").style.display = "none";
			var response = httpUpdateTable.responseXML;
			
			switch(response.getElementsByTagName("exitCode")[0].firstChild.nodeValue)
       		{
				case '0':
					var content = response.getElementsByTagName("content")[0].firstChild.nodeValue;
					document.getElementById("votiimmaginiTable").innerHTML = content;
           			break;
           			
				case '7':
       			case '-1':
       			default:
					var content = response.getElementsByTagName("content")[0].firstChild.nodeValue;
					document.getElementById("votiimmaginiTable").innerHTML = content;
           			break;
			}
		}
		else
		{
			document.getElementById("votiimmaginiTable").innerHTML = "<p class=\"testoSemplice\"><b>Reloading table..</b></p>";
		}
	}
	
	// Updating immagini table --------------------------------------------------------------------------------
	
	
	
	
	
	// Adding vote --------------------------------------------------------------------------------------
	
	var httpAdd = createRequestObject();
	
	function addVote()
	{
		str = getFormValues(document.formVoti);
		httpAdd.open('post', 'ajaxScripts/addVote.php');
		httpAdd.onreadystatechange = handleResponse;
		httpAdd.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");
		httpAdd.send(str);
	}
	
	function handleResponse()
	{
		if(httpAdd.readyState == 4)
		{
			var response = httpAdd.responseXML;
			
			switch(response.getElementsByTagName("exitCode")[0].firstChild.nodeValue)
       		{           				
				case '0':
					var content = response.getElementsByTagName("content")[0].firstChild.nodeValue;
					document.getElementById("subResponse").innerHTML = content;
					setTimeout('updateVotiimmaginiTable()', 1500);
           			break;
           			
				case '7':
       			case '-1':
       			default:
       				var content = response.getElementsByTagName("content")[0].firstChild.nodeValue;
					document.getElementById("subResponse").innerHTML = content;
					setTimeout('updateVotiimmaginiTable()', 1500);
           			break;
			}
		}
	}
	
	// Adding vote --------------------------------------------------------------------------------------

	function refresh()
	{
		window.location.reload(true);
	}
	
	
	function checkRadio(value_p)
	{
		for(counter=0; counter<formVoti.voto.length; counter++)
		{
			if(formVoti.voto[counter].value == value_p)
				formVoti.voto[counter].checked = true; 
		}
	}