var newSticker;
var newSticker2;
var xmlhttp=false;
var now = 0;
var future = 0;
var daysToGo = 0;
var hoursToGo = 0;
var TminToGo = 0;
var TsecToGo = 0;
setTimeout('myTime()', 1000);
setTimeout('countdowngm()', 1000);
function myTime(){
if(typeof sec == 'undefined'){
return;
}
sec = sec + 1;
if((sec % 15) == 0) {
synctime();
}
if(sec > 59){
sec = 0;
min = min + 1;
if(min > 59){
min = 0;
ore = ore + 1;
if(ore > 23){
ore = 0;
}
}
}
minT = "" + min; if(minT.length == 1){ minT = "0" + minT; }
secT = "" + sec; if(secT.length == 1){ secT = "0" + secT; }
setTimeout('myTime()', 1000);
return true;
}
function countdowngm(){
var dAnno = 2008;
var dMese = 9;
var dGiorno = 1;
var dOre = 18;
var dMin = 0;
var dSec = 0;
if(typeof anno == 'undefined'){
return;
}
var nowDate=new Date(anno,mese,giorno,ore,min,sec);
var futureDate=new Date(dAnno,dMese,dGiorno,dOre,dMin,dSec);
now = nowDate;
future = futureDate;
var secRemaining = Math.abs(Math.floor((futureDate - nowDate) / 1000));
if(secRemaining > 86399){
daysToGo = Math.floor(secRemaining / 86400);
secRemaining = secRemaining - (daysToGo * 86400);
}
if(secRemaining > 3599){
hoursToGo = Math.floor(secRemaining / 3600);
secRemaining = secRemaining - (hoursToGo * 3600);
}
if(secRemaining > 59){
minToGo = Math.floor(secRemaining / 60);
secRemaining = secRemaining - (minToGo * 60);
}
secToGo = secRemaining;
if(minToGo < 10){
TminToGo = "0" + minToGo;
} else{
TminToGo = minToGo;
}
if(secToGo < 10){
TsecToGo = "0" + secToGo;
} else{
TsecToGo = secToGo;
}
setTimeout('countdowngm()', 1000);
return true;
}
function writeTime(){
var dAnno = 2008;
var dMese = 9;
var dGiorno = 1;
var dOre = 18;
var dMin = 0;
var dSec = 0;
var nowDate=new Date(anno,mese,giorno,ore,min,sec);
var futureDate=new Date(dAnno,dMese,dGiorno,dOre,dMin,dSec);
if(nowDate > futureDate){
document.getElementById("timezone").childNodes[0].nodeValue = "CET Time: " + ore + ":" + minT + ":" + secT + "";
} else{
//document.getElementById("timezone").childNodes[0].nodeValue = "" + ((daysToGo > 1) ? daysToGo + " giorni - " : "") + hoursToGo + ":" + TminToGo + ":" + TsecToGo + " nuovi uffici a Lugano di KPMG SA";
document.getElementById("timezone").innerHTML = "" + ((daysToGo > 1) ? daysToGo + " giorni - " : "") + hoursToGo + ":" + TminToGo + ":" + TsecToGo + "
nuovi uffici a Lugano di
KPMG SA";
}
}
function mailto(id){
if(id == ""){
window.open('mailto.jsp','','HEIGHT=610,WIDTH=600,scrollbars=no');
} else{
window.open('mailto.jsp?rcptto=' + id,'','HEIGHT=600,WIDTH=600,scrollbars=no');
}
}
function showNote(id){
var element = document.getElementById(id);
for(i=0; i < newsarray.length; i++){
var tmp = document.getElementById(newsarray[i]);
tmp.style.display = "none";
}
if(element.style.display == "none"){
element.style.display='list-item';
}
}
function refreshSticker(){
var fakeparam = new Date();
newSticker = new Image();
newSticker2 = new Image();
newSticker3 = new Image();
newSticker.src = "http://www.edam.ch/meteostation/sticker.PNG?" + fakeparam.getTime();
newSticker2.src = "http://www.edam.ch/meteostation/sticker2.PNG?" + fakeparam.getTime();
newSticker3.src = "http://www.edam.ch/meteostation/sticker3.PNG?" + fakeparam.getTime();
setTimeout('showit()', 10000);
}
function showit(){
document.images.stickerImg.src = newSticker.src;
document.images.stickerImg2.src = newSticker2.src;
document.images.stickerImg3.src = newSticker3.src;
}
function initiateTool(){
//IE
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(E){
xmlhttp = false;
}
}
//Firefox
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
//in caso di browser che non supporta il codice oppure di restrizioni per motivi di sicurezza
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
//alert("Spiacente, ma è probabile che il tuo browser non interpreti correttamente gli script di questa pagina: impossibile sincronizzare l'orologio!");
}
}
function synctime(){
if (!xmlhttp) {
return;
}
xmlhttp.open("POST", "synctime.jsp", true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
var status = xmlhttp.status;
if(status == 200){
var toParse = xmlhttp.responseText;
ore = parseInt(toParse.substring(2, 4), 10);
min = parseInt(toParse.substring(4, 6), 10);
sec = parseInt(toParse.substring(6, 8), 10);
//alert(toParse.substring(2, 4) + "-" + toParse.substring(4, 6) + "-" + toParse.substring(6, 8));
}
}
}
xmlhttp.send(null);
}
function blinkit(){
var whatToBlink = document.getElementById("textToblink");
if(whatToBlink.style.visibility == "visible"){
whatToBlink.style.visibility = "hidden";
setTimeout('blinkit()', 600);
} else{
whatToBlink.style.visibility = "visible";
setTimeout('blinkit()', 900);
}
//alert(whatToBlink.style.visibility);
}