<!--
var timerID = null
var timerRunning = false
var timeValue = ""
var myX = 0
var myY = 0

num0 = new Image(7,9);
num0.src = "/images/0.gif";
num1 = new Image(7,9);
num1.src = "/images/1.gif";
num2 = new Image(7,9);
num2.src = "/images/2.gif";
num3 = new Image(7,9);
num3.src = "/images/3.gif";
num4 = new Image(7,9);
num4.src = "/images/4.gif";
num5 = new Image(7,9);
num5.src = "/images/5.gif";
num6 = new Image(7,9);
num6.src = "/images/6.gif";
num7 = new Image(7,9);
num7.src = "/images/7.gif";
num8 = new Image(7,9);
num8.src = "/images/8.gif";
num9 = new Image(7,9);
num9.src = "/images/9.gif";

function stopclock()
	{
	if(timerRunning)
	clearTimeout(timerID)
	timerRunning = false
	}

function startclock()
	{
	// Make sure the clock is stopped
	// stopclock()
	showtime()
	setInterval("showtime()", 60000)
	}

function showtime()
	{
	var now = new Date()
	var hours = now.getHours()
	var minutes = now.getMinutes()
	// var seconds = now.getSeconds()
	
	if (hours < 10)
		{
		imgObjNameH1 = "num0"
		imgObjNameH2 = "num" + hours.toString()
		}
	else
		{
		strHours = hours.toString()
		imgObjNameH1 = "num" + strHours.substr(0,1)
		imgObjNameH2 = "num" + strHours.substr(1,1)
		}
	if (minutes < 10)
		{
		imgObjNameM1 = "num0"
		imgObjNameM2 = "num" + minutes.toString()
		}
	else
		{
		strMin = minutes.toString()
		imgObjNameM1 = "num" + strMin.substr(0,1)
		imgObjNameM2 = "num" + strMin.substr(1,1)
		}
		
	/* if (seconds < 10)
		{
		imgObjNameS1 = "num0"
		imgObjNameS2 = "num" + seconds.toString()
		}
	else
		{
		strSec = seconds.toString()
		imgObjNameS1 = "num" + strSec.substr(0,1)
		imgObjNameS2 = "num" + strSec.substr(1,1)
		} */
	
	document.images["h1"].src = eval(imgObjNameH1 + ".src")
	document.images["h2"].src = eval(imgObjNameH2 + ".src")
	document.images["m1"].src = eval(imgObjNameM1 + ".src")
	document.images["m2"].src = eval(imgObjNameM2 + ".src")

	// document.images["s1"].src = eval(imgObjNameS1 + ".src")
	// document.images["s2"].src = eval(imgObjNameS2 + ".src")
	// timeValue = hours
	// timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	// timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	// document.clock.face.value = timeValue
	
	// timerID = setTimeout("showtime()",1000)
	// timerRunning = true
	// return timeValue
	}

function ricerca(tipo)
	{
	if (tipo=="a")
		altTipo = "s"
	else
		altTipo = "a"
	locNow = document.location.href
	
	if (locNow.indexOf("findNews.php") > 0)
		locNow = "index.php?sm=" + tipo
	else
		{
		elemInUrl = document.location.search
		if (elemInUrl=="")
			{
			locNow = locNow + "?sm=" + tipo
			}
		else
			{
			if (elemInUrl.indexOf("sm=") == -1)
				locNow = locNow + "&sm=" + tipo
			else
				{
				if (elemInUrl.indexOf("sm="+tipo) > 0)
					locNow = ""
				else
					{
					oldStr = "sm=" + altTipo
					newStr = "sm=" + tipo
					locNow = locNow.replace(oldStr, newStr)
					}
				}
			}
		}
	if (locNow != "")
		document.location.href=locNow
	}
	
function selSelect(selectElement, valueSelected)
	{
	if(selectElement=="" && valueSelected=="") return false;
	
	if(selectElement!="" && valueSelected=="")
		{
		if(selectElement.length > 0)
			{
			selectElement.options[0].selected = true
			}
		return false
		}

	// selectElement = eval(selectElement)
	 
	for(i=0;i<selectElement.length; i++)
		{
		if(selectElement.options[i].value == valueSelected)
			{
			selectElement.options[i].selected=true;
			return true;
			}
		}
	return false;
	}

function openWinRicerca(typeRicerca, id)
	{
	parametri = "width=400,height=350,scrollbars=no,resizable=no"
	myUrl = "finestra_ricerca.php?sm=a&typeRicerca=" + typeRicerca + "&id=" + id
	hWinRicerca = window.open(myUrl, "winRicerca", parametri)
	hWinRicerca.focus()
	}

function clearFormSearch(myform)
	{
	myform.s_titolo.value=""
	myform.s_testo.value=""
	myform.s_sezione.options[0].selected = true
	myform.s_fonte.value = ""
	myform.s_datadal.value=""
	myform.s_dataal.value=""
	return false
	}

function formatoStampa(id_news)
	{
	parametri = "width=500,height=400,scrollbars=yes,resizable=yes"
	hFormatoStampa = window.open("formato_stampa.php?id_news="+id_news, "winFormatoStampa", parametri)
	hFormatoStampa.focus()
	}

function formatoStampaAppro(id_appro)
	{
	parametri = "width=500,height=400,scrollbars=yes,resizable=yes"
	hFormatoStampaAppro = window.open("formato_stampa_appro.php?id_appro="+id_appro, "winFormatoStampaAppro", parametri)
	hFormatoStampaAppro.focus()
	}

function formatoStampaCom(id_com)
	{
	parametri = "width=500,height=400,scrollbars=yes,resizable=yes"
	hFormatoStampaCom = window.open("formato_stampa_com.php?id_com="+id_com, "winFormatoStampaCom", parametri)
	hFormatoStampaCom.focus()
	}

function checkFormSearch(typeForm, theForm)
	{
	if (typeForm == "a")
		{
		emptyFields = true
		fieldsTooShort = false
		if (theForm.s_titolo.value != "")
			{
			emptyFields = false
			if (theForm.s_titolo.value.length < 3)
				fieldsTooShort = true
			}
		if (theForm.s_testo.value != "")
			{
			emptyFields = false
			if (theForm.s_testo.value.length < 3)
				fieldsTooShort = true
			}
		if (theForm.s_sezione.options[theForm.s_sezione.selectedIndex].value > 0)
			emptyFields = false
		if (theForm.s_fonte.value != "")
			{
			emptyFields = false
			if (theForm.s_fonte.value.length < 3)
				fieldsTooShort = true
			}
		if (theForm.s_datadal.value != "")
			emptyFields = false
		if (theForm.s_dataal.value != "")
			emptyFields = false
		
		if (emptyFields)
			{
			alert("Riempire almeno un campo\nper effettuare la ricerca.")
			return false
			}
		else
			{
			if (fieldsTooShort)
				{
				alert("Per effettuare la ricerca\ninserire almeno 3 caratteri\nnei campi 'Titolo' e/o 'Testo' e/o 'Fonte'")
				return false
				}
			else
				return true
			}
		}
	else
		{
		if (theForm.s_titolo.value == "")
			{
			alert("Inserire almeno qualche carattere\nprima di effettuare la ricerca.")
			return false
			}
		else
			{
			if (theForm.s_titolo.value.length < 3)
				{
				alert("Per effettuare la ricerca\ninserire almeno 3 caratteri.")
				return false
				}
			else
				return true
			}
		}
	}
	
function openWinSuggerimenti(isNS)
	{
	if (isNS == "1")
		parametri = "width=400,height=530,scrollbars=no,resizable=no"
	else
		parametri = "width=400,height=430,scrollbars=no,resizable=no"
	hWinSuggerimenti = window.open("suggerimenti.php", "winSuggerimenti", parametri)
	hWinSuggerimenti.focus()
	}
//-->
