// JavaScript Document

// check if device is iPhone/iPod
function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}

// check if device is iPad
function isiPad(){
    return (navigator.platform.indexOf("iPad") != -1);
}


$(document).ready(function(){
    
    // Update realtime clock
    $('#data').jclock({
        timeNotation: '24h',
        am_pm: false,
        format: '%A, %d %B %Y %H:%M:%S'
    });

    // Update view count banner
    $("div.banner li a ").click(function(e) {
        e.preventDefault();
        var id = this.id.substr(7);
        var href = $(this).attr('href');
        $.ez( 'ezjscViewCount::increaseViewCount', {nodeId: id}, function(data){});
        if (href != '#'){
            window.open(this.href,'_newtab');
        }
    });

    // Meteo
    $('#follow').find('li:first a').mouseover(function(){
        var meteo = $(this).parent().find('div.meteo');
		if (meteo.length < 1) {
			$(this).parent().append($('<div class="meteo" />').html(
				'<iframe src="http://meteolive.leonardo.it/webservice-meteo/getData.php?mode=3&locID=3153&cl=C9D4FF&cd=EBF2F8&ct1=DEE9FA&ct2=F2FBFF&cct=000000&cc=000000&wsize=150&spcst=1"'
				+' width="150" height="193" scrolling="no" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0"></iframe>'
				//+'<iframe src="http://www.spaziometeo.altervista.org/Banner/Banner_125X125.php"'
				//+' width="125" height="125" scrolling="no" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0"></iframe>'
			).mouseout(function(){$(this).remove();})); 
		}
    });
    
    // Marsica
    $(".sezione-marsica #logo a").attr("href", "/Dalla-Marsica");

});
