//<![CDATA[

var Garaperizie = {

    // Utilizzare una variabile per fare riferimento al file SWF incorporato.

    DOMready: function() {
        if ($('#referenze').length > 0) { Garaperizie.news(); };
        if ($('.popup').length > 0) { Garaperizie.popup(".popup", 800, 600) };
        if ($('.boxed').length > 0) { Garaperizie.popup(".boxed", 600, 400) };
        if ($('.quik-links').length > 0) { Garaperizie.randomImg() };

    }, // fine DOMReady

    // metodo usato per ottenere il percorso giusto in base alla posizione
    returnPath: function() {
        var path = location.pathname;
        var li = path.length;
        var lf = path.replace(/\//g, '').length;
        // Windows var n = li-lf-2;
        var n = li - lf - 1;
        var resultPath = "";

        for (var i = 0; i < n; i++) {
            resultPath += "./";
        }

        return resultPath
    }, // fine returnPath

    flashInclude: function(obj, swfFile) {
        $(obj).flash(
		{
		    // test.swf is the flash document 
		    swf: swfFile,
		    id: "movie",
		    name: "movie",
		    width: 800,
		    height: 450,
		    wmode: 'transparent',
		    expressInstaller: 'swf/expressInstall.swf', // optional and temporary	
		    flashvars:
				{
				// VARS
}
		})

    }, // fine flashInclude

    popup: function(id, w, h) {
        $(id).fancybox({
            'width': w,
            'height': h,
            'titleShow': false,
            'type': 'iframe'
        });
    }, // fine popup

    news: function() {
        $('#referenze').list_ticker({
            speed: 7000,
            effect: 'fade'
        })
    },  // Chiusura news

    randomImg: function() {
        $('.random1').randomImage({ path: 'img/random/incendio/', myImages: ['1.jpg', '2.jpg', '3.jpg', '4.jpg'] });
        $('.random2').randomImage({ path: 'img/random/allagamento/', myImages: ['1.jpg', '2.jpg', '3.jpg'] });
        $('.random3').randomImage({ path: 'img/random/terremoto/', myImages: ['1.jpg', '2.jpg', '3.jpg'] });
        $('.random4').randomImage({ path: 'img/random/sinistri/', myImages: ['1.jpg', '2.jpg', '3.jpg'] });
    }

} // chiusura classe Garaperizie

    ///////////////////////////////////////////////////////

    $(document).ready(function() { Garaperizie.DOMready() });
    //]]>
