var ie4 = false; if(document.all) { ie4 = true; }

function getObject(id) {
	if (ie4) { 
		return document.all[id]; 
	} else {
		return document.getElementById(id); 
	}
}

function ToggleImage(imgId) {
	var d = getObject("div_"+imgId);
	var i = getObject("img_"+imgId);
	if (i != null) {
		if (d.style.display != "none")
			i.src = img_block;
		else
			i.src = img_none;
	}
}

function ToggleBlock(divId) {
	var d = getObject(divId);
	if (d != null) 	{
		if (d.style.display != "none")
			d.style.display = 'none';
		else
			d.style.display = 'block';
	}
	SetCookie(divId,d.style.display,30);
}

function TZDemo(){
   var d, tz, s = "The current local time is ";
   d = new Date();
   tz = d.getTimezoneOffset();
   if (tz < 0)
      s += -tz / 60 + " hours before GMT";
   else if (tz == 0)
      s += "GMT";
   else
      s += tz / 60 + " hours after GMT";
   return(s);
}

function GetTimeZone(){
	var d, tz, m, s="GMT"; 
	d = new Date();
	tz = d.getTimezoneOffset();
	if (tz < 0) {
		m=-tz%60;if(m<10) m="0"+m;
		s+="+"+parseInt(-tz/60) + ":" + m;
	} else if (tz == 0)
		s+="";
	else {
		m=tz%60;if(m<10) m="0"+m;
		s+="-"+parseInt(tz/60)+":" + m;
	}
	return(s);
}

function GetTZoffset(){
	var d = new Date();
	return(d.getTimezoneOffset());
}

// time function by Zach Nakaska
function SetCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
}

function getZone() {
	// Get local timezone and set cookie
	var d = new Date();
	var offset = (d.getTimezoneOffset());
	SetCookie('timezone', offset, 30);
}

function encodemail(utente, dominio) {
	window.location.href = 'mailto:' + utente + '@' + dominio;
}

function PopUpCenter(urlen, name) {
	var winTop = (screen.height / 8);
	var winHeight = (screen.height / 4)*3;
	var winLeft = (screen.width / 8);
	var winWidth = (screen.width / 4)*3;
	var win2 = window.open(urlen, name, 'width='+winWidth+',height='+winHeight+',left='+winLeft+',top='+winTop+',scrollbars=yes,toolbar=no,location=no,menubar=no,status=no,resizable=yes');
}


// Clock Part 1 - Put Anywhere Before Part 2 -->
// Clock Script Generated By Maxx Blade's Clock v2.0
// http://www.maxxblade.co.uk/clock
// modified by Mr.Spock/Rolf Thomassen,  MrSpock(at)rediffmail.com
//             C. Lopes, webmaster(at)numisnet.tk
//             remove 'fjern' from e mail to get address 
function dClock(){
	var objDate = getObject('tDate');
	var objTime = getObject('tTime');
	objDate.innerHTML = dateCL();
	objTime.innerHTML = timeCL();
	setTimeout('dClock()',1000);
}
// modified again by Mythril/Johan Ho, mythril@start.no" & vbCrLf
//	(changed the script to Java Script to support Opera)" & vbCrLf
// modified again by Mr.Spock, Rolf Thomassen, MrSpock(at)rediffmail.com" & vbCrLf
//	(changed the script to Java Script to use LCID, Month, Days)" & vbCrLf
function dateCL(){
	var d = new Date();
	return days[d.getDay()]+", "+d.getDate()+" "+ months[d.getMonth()] + " " + d.getFullYear();
}
function timeCL(){
	var d = new Date();
	min = d.getMinutes();
	if (min<10) min = "0"+min;
	sec = d.getSeconds();
	if (sec<10) sec = "0"+sec;
	return d.getHours()+ ":" + min + ":" + sec;
}
