function popup(name, title, URL, w, h){
	if (!w){
	  w = 500;
	}
  if (!h){
	  h = 600;
	}

	if (document.all){
  	var x = window.screenLeft;
    var y = window.screenTop;
    var wi = window.document.body.offsetWidth;
    var hi = window.document.body.offsetHeight;
  }else{
		var x = window.screenX;
		var y = window.screenY;
		var wi = window.outerWidth;
		var hi = window.outerHeight;
	}
  var cntx = x + Math.round((wi - w) / 2);
  var cnty = y + Math.round((hi - h) / 2);

	name = window.open(URL, title, "screenX="+ cntx + ", screenY=" + cnty + ",resizable=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=0,width=" + w + ",height=" + h);
	name.location = URL;
	
}

function del_foto(file, id){
	document.location.href = "album_foto_ins_act.php?file=" + file + "&id=" + id;
}

function IsDigitP( e ){
	
	if(e.which){
		var iCode =  e.which;
	}else{ //IE
		var iCode = e.keyCode;
	}

	if(iCode == 44 || iCode == 46){		
		var dec = document.getElementById("impD");
		dec.focus();
		return false;
	}else if(iCode == 9){ //tab
		return true;
	}else if(iCode >= 48 && iCode <= 57 ){
		return true;
	}else if(iCode == 37 || iCode == 39){ //37 = <-, 39 = ->
		return true;
	}else if(iCode == 8 || iCode == 46){ //8 = Backspace, 46 = Canc
		return true;
	}

	return false;

	/*
	( iCode >= 48 && iCode <= 57 )		// Numbers
	iCode == 8		// Backspace
	iCode == 44		// virgola
	iCode == 46		// punto
	*/
}

function ShowHideIdw(e, cosa, a_s){
	var x;
	var y;
	var idw;
	
	x = e.clientX;
	y = e.clientY;
	
	idw = document.getElementById("idw");
	
	if(a_s){

		idw.innerHTML = cosa;
		idw.style.display = '';
		idw.style.top = (y + 5) + "px";
		idw.style.left = (x + 15) + "px";
		
	}else{
		idw.style.display = 'NONE';
	}
}


function slide_(){
	s = document.getElementById('slide');
	r = s.style.right.toString().substr(0, (s.style.right.toString().length - 2))
	
	r = Number(r);

	if(r < 500){
		r += 100;
		s.style.right = r + "px";
		setTimeout("slide()", 100);
	}
	
}

function dona(form){
	
	form.amount.value = form.impI.value + "." + form.impD.value;
	
	return true;
	
}

function selMenu(riga, cosa){
	
	if(cosa){ //onmouseover
		riga.style.background = "#E1E1E1";
	}else{ // onmouseout
		riga.style.background = "#FFFFFF";
	}
}

function aggiornaOnline(lista){
	var mostra = parent.document.getElementById("online");
	
	testo = "<b>Utenti on-line</b><br>";
	for(ute in lista){
		testo += lista[ute] + "<br>";
	}
	
	if(mostra){
		mostra.innerHTML = testo;
	}
	
}

/*script creato da fabrizio palazzo
http://wwww.fabriziopalazzo.com 
le parti personalizzabili hanno un commento a lato*/
function getTime(){
	now = new Date();
	
	mese = now.getMonth()
	if(mese == 0 || mese == 1 || mese == 2 || mese == 3){
		anno = now.getYear() + 1900
	}else{
		anno = now.getYear() + 1900 + 1
	}
	
	//anno = "2012";
	y2k = new Date("Apr 30 "+anno+" 16:00:00"); /*inerisci la data di scadenza (tipo il latte!)*/
	
	days = (y2k - now) / 1000 / 60 / 60 / 24;
	daysRound = Math.floor(days);
	
	hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
	hoursRound = Math.floor(hours);

	minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
	minutesRound = Math.floor(minutes);

	seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
	secondsRound = Math.round(seconds);

	hoursRound   = (hoursRound < 10) ? "0"+hoursRound : hoursRound;
	minutesRound = (minutesRound < 10) ? "0"+minutesRound : minutesRound;
	secondsRound = (secondsRound < 10) ? "0"+secondsRound : secondsRound;
	
	sec = (secondsRound == 1) ? "s" : "s";     /*  puoi cambiare il testo tra virgolette */
	min = (minutesRound == 1) ? "m " : "m "; /* puoi cambiare il testo tra virgolette */
	hr = (hoursRound == 1) ? "h " : "h ";    /*  puoi cambiare il testo tra virgolette */
	dy = (daysRound == 1) ? " giorno " : " giorni "      /*  puoi cambiare il testo tra virgolette */

	document.getElementById("countdown").innerHTML = daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec; /* puoi inserire untesto nelle virgolette esepio puoi mettere - per il countdown */
	//document.timeForm.input.value = " " + daysRound + dy + hoursRound + hr + minutesRound + min + secondsRound + sec; /* puoi inserire untesto nelle virgolette esepio puoi mettere - per il countdown */
	newtime = window.setTimeout("getTime();", 1000);
}













