/**
 * @author vally
 */
 

function goTo(id_pag){
	/* SETTINGS: */
	var page = "details.php";
	var id_var = "pag";
	var homepage = "http://www.proprionoi.it";
	/* end settings */
	
	if(id_pag != "home"){
		//window.location = page + "?" + id_var + "=" + id_pag;
		window.location = "http://www.proprionoi.it/it/" + id_pag;
	} else {
		window.location = homepage;
	}
}
 
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" 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 + "\"");
    }
  }
 }
}
