﻿<!--
/****************************************
** SCRIPT GESTIONE LA SICILIA IN TASCA **
**       CopyRight: Elio Puglisi       **
****************************************/

document.write('<style type="text/css">.close_data {display: none}</style>');

window.status=" LA SICILIA IN TASCA";

var months=new Array(13);
	months[1] = "Gennaio";
	months[2] = "Febbraio";
	months[3] = "Marzo";
	months[4] = "Aprile";
	months[5] = "Maggio";
	months[6] = "Giugno";
	months[7] = "Luglio";
	months[8] = "Agosto";
	months[9] = "Settembre";
	months[10] = "Ottobre";
	months[11] = "Novembre";
	months[12] = "Dicembre";
	
var days=new Array(8);
	days[1] = "Domenica";
	days[2] = "Lunedì";
	days[3] = "Martedì";
	days[4] = "Mercoledì";
	days[5] = "Giovedì";
	days[6] = "Venerdì";
	days[7] = "Sabato";

function openPopUp(l, h, page, name, sb)
{
	var lt = (screen.Width - l)/2
	var tp = (screen.Height - h)/2
	var scrollBar = "scrollbars=no"
	if (sb == 1) {scrollBar = "scrollbars=yes"}
	features = "width=" + l + ",height=" + h + "," + scrollBar 
	features += ",toolbars=no,resizable=no,status=no" + ",top=" + tp + ", left=" + lt
	window.open(page, name, features);
}

function scheda(id)
{
	openPopUp(636, 630, "scheda.aspx?id=" + id, "schedaArt", 1)
}

function credits(c)
{	
	var page = "credits.htm"
	if (c == 1) {page = "../credits.htm"}
	openPopUp(250, 300, page, "credits", 0)
}

function openWin(url, winName, width, height, features) 
{
	var left = (screen.Width - width - 10)/2;
	var top = (screen.Height - height - 40)/2;
	window.open(url, winName, features + ",width=" + width + ", height=" + height + ",top=" + top + ", left=" + left);
}

function calendario() 
{
	var dateObj=new Date()
	var wday=days[dateObj.getDay() + 1]
	var lmonth=months[dateObj.getMonth() + 1]
	var date=dateObj.getDate()
	var year=dateObj.getFullYear()
	var h=dateObj.getHours()
	var m=dateObj.getMinutes()
	var s=dateObj.getSeconds()
	if (h < 10) {h = "0" + h}
	if (m < 10) {m = "0" + m}
	if (s < 10) {s = "0" + s}	
	//document.write(wday + ", " + date + " " + lmonth + " " + year + " - " + h + ":" + m + ":" + s) //full
	//document.write(wday + ", " + date + " " + lmonth + " " + year + " - " + h + ":" + m) //with time
	document.write(wday + ", " + date + " " + lmonth + " " + year) //only date
}

function pref()
{
	var url="http://www.siciliaintasca.it" 
	var titolo="LA SICILIA IN TASCA"
	if (document.all) {window.external.AddFavorite(url,titolo);}
} 
									
function AddToFavourites()
{
	var urlAddress = "http://www.siciliaintasca.it"
	var pageName = "LA SICILIA IN TASCA"
	
	if (window.external)
	{
		window.external.AddFavorite(urlAddress,pageName)
	}
	else
	{ 
		alert("Attenzione! Funzione non supportata dal tuo browser.");
	}
}
			
function OpenTab(id, n)
{
	if (document.getElementsByTagName && document.getElementById)
	{			
		for (i = 1; i <= n; i++)
		{
			var tab = document.getElementById('tab_' + i)
			var linkTab = document.getElementById('link_tab_' + i)				

			if (i == id)
				{
					tab.className = "";
					linkTab.className = "selected";			
				}
			else
				{
					tab.className = "hidden";
					linkTab.className = "";
				}
		}
	}
}

String.prototype.trim = function () 
{
	//funzione trim
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function CheckFormSearch () 
{
	var frmQS = document.FRM_QSearch;
		
    if (frmQS.TXT_Search.value.trim() == "" || frmQS.TXT_Search.value.toLowerCase().trim() == "cerca nel sito")
		{
			if (frmQS.TXT_Search.value.trim() == "") {frmQS.TXT_Search.value = "";}
			
	    	alert("Immettere uno o più termini di\nricerca nell'apposita casella.")
			frmQS.TXT_Search.focus();
    		return false; 
		}
    return true 
}

function SearchFocus () 
{
	var frmQS = document.FRM_QSearch;
	
	if(frmQS.TXT_Search.value.toLowerCase().trim() == 'cerca nel sito') {frmQS.TXT_Search.value = '';}
	frmQS.TXT_Search.style.background = '#ffffff';
	frmQS.TXT_Search.style.border = '1px solid #f90';
}

function SearchBlur () 
{
	var frmQS = document.FRM_QSearch;
	
	if(frmQS.TXT_Search.value == '') {frmQS.TXT_Search.value = 'Cerca nel sito';}
	frmQS.TXT_Search.style.background = '#ecf5ff';
	frmQS.TXT_Search.style.border = '1px solid #069';
}


function jViewHideBox(id, objLink)
{
    if (objLink) jQuery(objLink).toggleClass("node_open");
	jQuery("#" + id).slideToggle("slow");
	return false;
}

function ViewHideBox(id, objLink)
{	
	if (document.getElementsByTagName && document.getElementById)
	{
		if (objLink)
		{
			if (objLink.className == "node_close") 
			{
				objLink.className = "node_open";
			} 
			else 
			{
				objLink.className = "node_close";
			}
		}
		
		var obj = document.getElementById(id)

		if (obj.className == "close_data") 
		{
			obj.className = "";
		} 
		else 
		{
			obj.className = "close_data";
		}		
	}
	return false;
}

function GoTo (list) 
{
	var id = list.options[list.selectedIndex].value
	
	if (id != -1)
	{
		location.href = "/go.aspx?localita=" + list.options[list.selectedIndex].text + "&idcat=7&id=" + id
	}
}

function ViewHideBox_OLD(id)
{
	// Con chiusura altri box
	if (document.getElementsByTagName && document.getElementById)
	{	
		for (i=1; i<=totDati; i++)
		{
			var obj = document.getElementById('box_' + i)

			if ('box_' + i == id)
				{
					if (obj.className == "close_data") 
						{
							obj.className = "";
						} 
					else 
						{
							obj.className = "close_data";
						}
				}
			else
				{
					obj.className = "close_data";
				}
		}
	}
	
	return false;
}


// AJAX
function CreateXmlHttp()
{
	//Creazione Oggetto XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	
	//Creazione Oggetto XMLHTTP in Mozilla e Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
	
	if (!XmlHttp && window.createRequest) 
	{
		try 
		{
			XmlHttp = window.createRequest();
		} 
		catch (e) 
		{
			XmlHttp = null;
		}
	}
}
// -->
