jQuery(document).ready(function() {

    // +----------------------------------------------------------------------+
    // | NB: non usare l'alias di jQuery ($) in quanto sono presenti anche    |
    // | strumenti di MOOTools nel sito..                                     |
    // +----------------------------------------------------------------------+

    // Fissa errore png su IE
    jQuery(document).pngFix();
   
    // Rotazione dei banner testuali nell'header basso
    jQuery('.banner').quovolver(400, 5500);

    // Rotazione dei banner testuali in tutte le pagine oltre la home
    jQuery('.banneranypage').quovolver(400, 5500);

    // Dropdown menu centrale
    if (!jQuery.browser.msie) {
        jQuery('#topmenu ul li').hover(function() {
            jQuery('ul', this).slideDown(100);
        },
        function() {
            jQuery('ul', this).slideUp(100);
        });
    }
    // Se il browser utilizzato è M$ IE, effettua il toggle, più supportato
    else {
        jQuery('#topmenu ul li').hover(function() {
            jQuery('ul', this).toggle();
        },
        function() {
            jQuery('ul', this).toggle();
        });
    }

    // Particolarità non pienamente supportate (o perlomeno schifosamente
    // renderizzate) da IE, per cui alcune classi vengono chiamate solo per gli
    // altri browser..
    if (!jQuery.browser.msie) {
        var ts = 'text-shadow';
        var ts_white = '1px 1px #ffffff';
        var ts_grey = '1px 1px #8E8E8E';
        var ts_black = '1px 1px #000000';
        jQuery('#news .scripttitle').css(ts, ts_grey);
        jQuery('#sitemap ul li.title').css(ts, ts_grey);
        jQuery('#sitemap ul li.title a').css(ts, ts_grey);
        jQuery('#contentscriptleft .title').css(ts, ts_grey);
    }

    // Tips della sezione console video sull'header
    jQuery('a.toggle_top[title]').qtip({
        content: {
            text: false // Use each elements title attribute
        },
        position: {
            corner: {
                tooltip: 'rightTop',
                target: 'topLeft'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'center',
            tip: 'rightTop',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '16px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });

    // Tips della sezione console video
    jQuery('a.toggle[title]').qtip({
        content: {
            text: false // Use each elements title attribute
        },
        position: {
            corner: {
                tooltip: 'rightBottom',
                target: 'topLeft'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'center',
            tip: 'rightBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '16px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });
    jQuery('a.toggle_header[title]').qtip({
        content: {
            text: false // Use each elements title attribute
        },
        position: {
            corner: {
                tooltip: 'rightBottom',
                target: 'topLeft'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'center',
            tip: 'rightBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '16px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });
    
    // Tip sul logo iniziale del sito
    jQuery('.logo_on_black').qtip({
        content: {
            text:   "Go to <b>My Rent</b> Homepage"
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });

    // Tip sul logo iniziale nelle pagine oltre la home
    jQuery('.logo').qtip({
        content: {
            text:   "Go to <b>My Rent</b> Homepage"
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });

    // Tip sul logo dogma systems
    jQuery('#footer .dogmapowered img').qtip({
        content: {
            text:   "<b>Dogma Systems</b> is one of the world's leading providers of Car Rental Software. </br> \n\
                    Founded as a project in 2004, <b>MyRent</b> applications have been downloaded over \n\
                    5000 times and currently serve over 1000 users in 3 languages. <br />\n\
                    Over 300 customers have chosen MyRent, and globally MyRent manages 1.000 \n\
                    locations and 15.000 vehicles around the world."
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });

    // Tips sui pulsantoni smistatori a sx
    jQuery('.learn_more').qtip({
        content: {
            text:   "Get more information about how to increase your productivity with <b>MyRent.</b>"
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });
    jQuery('.view_demo').qtip({
        content: {
            text:   "Discover MyRent, feature by feature."
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });
    jQuery('.get_info').qtip({
        content: {
            text:   "Contact us!!"
        },
        position: {
            corner: {
                tooltip: 'leftBottom',
                target: 'topRight'
            }
        },
        style: {
            color: '#444444',
            textAlign: 'left',
            tip: 'leftBottom',
            name: 'cream',
            'font-family': 'Arial, Helvetica, sans-serif',
            'font-size' : '12px'
        },
        show: {
            effect: {
                type: 'fade'
            }
        }
    });

});

