var texto = new Array(4);
var zona = new Array(4);
var itexto = 0;

zona[0] = -3;
zona[1] = 1;
zona[2] = 1;
zona[3] = 0;

function WorldClock(zone, isitlocal){
    isitlocal = typeof(isitlocal) != 'undefined' ? isitlocal : true;
    now=new Date();
    ofst=now.getTimezoneOffset()/60;
    secs=now.getSeconds();
    sec=-1.57+Math.PI*secs/30;
    mins=now.getMinutes();
    min=-1.57+Math.PI*mins/30;
    hr=(isitlocal)?now.getHours():(now.getHours() + parseInt(ofst)) + parseInt(zone);
    hrs=-1.575+Math.PI*hr/6+Math.PI*parseInt(now.getMinutes())/360;
    if (hr < 0) hr+=24;
    if (hr > 23) hr-=24;
    ampm = (hr > 11)?"PM":"AM";
    statusampm = ampm.toLowerCase();

    hr2 = hr;
    if (hr2 == 0) hr2=12;
    (hr2 < 13)?hr2:hr2 %= 12;
    if (hr2<10) hr2="0"+hr2

    // var finaltime = hr2+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;
    var finaltime = hr2+':'+((mins < 10)?"0"+mins:mins)+' '+statusampm;
                        
    texto[0] = '<strong>S&atilde;o Paulo</strong> ' + finaltime;
    texto[1] = '<strong>Paris</strong> '  + finaltime;
    texto[2] = '<strong>Madrid</strong> ' + finaltime;
    texto[3] = '<strong>London</strong> ' + finaltime;
                        
    if (document.all)
        worldclock.innerHTML=texto[itexto];
    else if (document.getElementById)
        document.getElementById("worldclock").innerHTML=texto[itexto];
                          
    setTimeout('WorldClock(zona[itexto],false)',2000);
    (itexto > 2)?itexto=0:itexto++;
}
