/**
 * MAR s.r.l. - tutti i diritti sono riservati / all right reserved
 * @author Marino Bonetti
 * @email marinobonetti at gmail dot com
 */
window.GS = window.GS || {};
GS.AC = GS.AC || {};

GS.AC.arrayImg = [];

$(document).ready(function(){

    $(document).pngFix();
    //precarico le immagini dei menu
    $('.gs-menu img').each(function(){
        var img = new Image();
        if (this.src.match(/_evid/)) {
            img.src = this.src.replace('_evid', '');
        }
        else {
            img.src = this.src.replace(/.png$/, '_evid.png');
        }
        GS.AC.arrayImg.push(img);
    });
    
    if (jQuery.browser.msie != 6) {
        $('.gs-menu img').mouseover(function(){
            window.clearTimeout(GS.AC.timerMenu);
            GS.AC.resetBtnsMenu();
            var img;
            if (this.nodeName != 'IMG') {
                img = $(this).children('img')[0];
            }
            else {
                img = this;
            }
            img.src = img.src.replace(/(_evid)?\.png$/, '_evid.png');
        });
        
        $('.gs-menu').mouseout(function(){
          //  GS.AC.timerMenu = window.setTimeout(GS.AC.resetMenu, 300);
		  GS.AC.resetMenu();
        });
    }
    
    //carico i video
    var divVideo = $('#videoChiSiamo')[0];
    if (typeof divVideo != "undefined") {
        ext = '';
        if (window.location.href.match(/chisiamo(_ie)?_it\.html$/)) {
            ext = 'it';
        }
        else 
            if (window.location.href.match(/chisiamo(_ie)?_en\.html$/)) {
                ext = 'en';
            }
            else 
                if (window.location.href.match(/chisiamo(_ie)?_ru\.html$/)) {
                    ext = 'ru';
                }
        if (ext !== '') {
            swfobject.embedSWF("/clients/arcari/video/video" + ext + ".swf", 'videoChiSiamo', 386, 282, "9.0.0");
        }
    }
    
});

GS.AC.resetBtnsMenu = function(){
    $('.gs-menu img').each(function(){
        this.src = this.src.replace(/_evid.png$/, '.png');
    });
};
GS.AC.timerMenu = null;
GS.AC.resetMenu = function(){
    GS.AC.resetBtnsMenu();
    var imgEvid = $('.gs-menu div.evid img')[0];
    imgEvid.src = imgEvid.src.replace(/(_evid)?\.png$/, '_evid.png');
};


