/**
 * @author vally
 */
function cambiaCSS(classe,element,value) 
{
	 var cssRules;
	 if (document.all)
	 {
		cssRules = 'rules';
	 }
	 else if (document.getElementById) 
	 {
		cssRules = 'cssRules';
	 }
	 for (var i=0; i < document.styleSheets.length; i++)
	 {
	 	for (var t=0; t < document.styleSheets[i][cssRules].length; t++) 
		{
			if (document.styleSheets[i][cssRules][t].selectorText == classe)
			{
				document.styleSheets[i][cssRules][t].style[element] = value;
			}
		}
	}
}

function randRange(min, max)
{
    var randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
    return randomNum;
}

function doRefresh() {
  // refresh della pagina corrente
  document.location.reload();
}

/* #####################################################################################
								Visibilità Obj by ID
								--------------------
Uso: 	
		Definire una variabile "status = hide|show" globale nella pagina per gli oggetti che useranno questa funzione;
		Richiamare così: "javascript:control('divDaGestire')"
########################################################################################*/
function control(id) {
	if(status == "hide") {
		status = "show";
	} else {
		status = "hide";
	}
	toggleVisibility(id, status);
}
function toggleVisibility(id, mode)
{
	var NNtype = (mode == "show") ? mode : "hidden";
	var IEtype = (mode == "show") ? "visible" : "hidden";
	var WC3type = (mode == "show") ? "visible" : "hidden";
	if (document.getElementById)
	{
		eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
	} 
	else 
	{
		if (document.layers)
		{
			document.layers[id].visibility = NNtype;
		} 
		else
		{
			if (document.all)
			{
				eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
			}
		}
	}
}
