function checkForm(file,id_univoco,pollValue)
{
	if(!getCheckedValue(pollValue))
	{
		alert('Seleziona la tua preferenza');
	}
	else
	{
		ajaxFunction(file,id_univoco);
	}
		return false;
}


function ajaxFunction(file,id_univoco)
{
var xmlhttp,
	id_to_change = document.getElementById(id_univoco),
	heigthIdUnivoco = id_to_change.offsetHeight;
		
	id_to_change.innerHTML = '<div id="loading"><img src="/template/'+globalTemplate+'/images/loading.gif" alt="Loading" /></div>';
	var loading = document.getElementById('loading'),
		newpaddingTop = Math.round((heigthIdUnivoco - 8) / 2),
		newHeight = heigthIdUnivoco - newpaddingTop;
	loading.style.height = newHeight + 'px';
	loading.style.textAlign = 'center';
	loading.style.paddingTop = newpaddingTop + 'px';
	
	
	
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  id_to_change.innerHTML = xmlhttp.responseText;
  }
}
xmlhttp.open("GET",file,true);
xmlhttp.send(null);
return false;
}







function getCheckedValue(radioObj) {
	if(!radioObj)
		return false;
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}


