// when the DOM is ready...
function coda() {
    var $panels = $('#slider .scrollContainer > div');
	var $panels2 = $('#slider2 .scrollContainer2 > div');
    var $container = $('#slider .scrollContainer');
    var $container2 = $('#slider2 .scrollContainer2');

    // if false, we'll float all the panels left and fix the width 
    // of the container
    var horizontal = true;

	
	if (horizontal) {
		
        $panels.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
        $panels2.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
        // calculate a new width for the container (so it holds all panels)
        $container.css('width', $panels[0].offsetWidth * $panels.length);
        $container2.css('width', $panels2[0].offsetWidth * $panels2.length);
    }
	
	

    // collect the scroll object, at the same time apply the hidden overflow
    // to remove the default scrollbars that will appear
    var $scroll = $('#slider .scroll').css('overflow', 'hidden');
    var $scroll2 = $('#slider2 .scroll2').css('overflow', 'hidden');

    // apply our left + right buttons
    $scroll
        .before('<img class="scrollButtons left" src="/imgsrc/pointer_sx.png" title="Prev" name="left" id="left" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons right" src="/imgsrc/pointer_dx.png" title="Next" name="right" id="right" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');
		
    $scroll2
        .before('<img class="scrollButtons2 left" src="/imgsrc/pointer_sx.png" title="Precedente Offerta" name="left2" id="left2" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left2\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons2 right" src="/imgsrc/pointer_dx.png" title="Prossima Offerta" name="right2" id="right2" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right2\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');

    // handle nav selection
    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }
	
    function selectNav2() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }

    $('#slider .navigation').find('a').click(selectNav);
	
    $('#slider2 .navigation2').find('a').click(selectNav2);

    // go find the navigation link that has this target and select the nav
    function trigger(data) {
        var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el);
    }
	
    function trigger2(data2) {
        var el2 = $('#slider2 .navigation2').find('a[href$="' + data2.id2 + '"]').get(0);
        selectNav2.call(el2);
    }	

    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
        trigger2({ id2 : window.location.hash.substr(1) });
    } else {
        $('ul.navigation a:first').click();
        $('ul.navigation2 a:first').click();
    }

    // offset is used to move to *exactly* the right place, since I'm using
    // padding on my example, I need to subtract the amount of padding to
    // the offset.  Try removing this to get a good idea of the effect
    var offset = parseInt((horizontal ? 
        $container.css('paddingTop') : 
        $container.css('paddingLeft')) 
        || 0) * -1;
	
    var offset2 = parseInt((horizontal ? 
        $container2.css('paddingTop') : 
        $container2.css('paddingLeft')) 
        || 0) * -1;


    var scrollOptions = {
        target: $scroll,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
        items: $panels,

        navigation: '.navigation a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger,  // our final callback

        offset: offset,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };
	
	var scrollOptions2 = {
        target: $scroll2,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
		items: $panels2,


        navigation: '.navigation2 a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger2,  // our final callback


		offset: offset2,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };

    // apply serialScroll to the slider - we chose this plugin because it 
    // supports// the indexed next and previous scroll along with hooking 
    // in to our navigation.
    $('#slider').serialScroll(scrollOptions);
    $('#slider2').serialScroll(scrollOptions2);

    // now apply localScroll to hook any other arbitrary links to trigger 
    // the effect

    $.localScroll(scrollOptions);

    // finally, if the URL has a hash, move the slider in to position, 
    // setting the duration to 1 because I don't want it to scroll in the
    // very first page load.  We don't always need this, but it ensures
    // the positioning is absolutely spot on when the pages loads.
    scrollOptions.duration = 1;
    $.localScroll.hash(scrollOptions);

}



function coda2() {
    var $panels = $('#slider .scrollContainer > div');
    var $container = $('#slider .scrollContainer');

    // if false, we'll float all the panels left and fix the width 
    // of the container	
    var horizontal = true;

	
	if (horizontal) {
		
        $panels.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
		
        // calculate a new width for the container (so it holds all panels)
        $container.css('width', $panels[0].offsetWidth * $panels.length);
    }
	
	

    // collect the scroll object, at the same time apply the hidden overflow
    // to remove the default scrollbars that will appear
    var $scroll = $('#slider .scroll').css('overflow', 'hidden');

    // apply our left + right buttons
    $scroll
        .before('<img class="scrollButtons left" src="/imgsrc/pointer_sx.png" title="Prev" name="left" id="left" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons right" src="/imgsrc/pointer_dx.png" title="Next" name="right" id="right" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');
		

    // handle nav selection
    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }
	

    $('#slider .navigation').find('a').click(selectNav);
	

    // go find the navigation link that has this target and select the nav
    function trigger(data) {
        var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el);
    }
	

    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
    } else {
        $('ul.navigation a:first').click();
    }

    // offset is used to move to *exactly* the right place, since I'm using
    // padding on my example, I need to subtract the amount of padding to
    // the offset.  Try removing this to get a good idea of the effect
    var offset = parseInt((horizontal ? 
        $container.css('paddingTop') : 
        $container.css('paddingLeft')) 
        || 0) * -1;
	

    var scrollOptions = {
        target: $scroll,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
        items: $panels,

        navigation: '.navigation a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger,  // our final callback

        offset: offset,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };
	

    // apply serialScroll to the slider - we chose this plugin because it 
    // supports// the indexed next and previous scroll along with hooking 
    // in to our navigation.
    $('#slider').serialScroll(scrollOptions);

    // now apply localScroll to hook any other arbitrary links to trigger 
    // the effect

    $.localScroll(scrollOptions);

    // finally, if the URL has a hash, move the slider in to position, 
    // setting the duration to 1 because I don't want it to scroll in the
    // very first page load.  We don't always need this, but it ensures
    // the positioning is absolutely spot on when the pages loads.
    scrollOptions.duration = 1;
    $.localScroll.hash(scrollOptions);

}




function coda3() {
	var $panels2 = $('#slider2 .scrollContainer2 > div');
    var $container2 = $('#slider2 .scrollContainer2');

    // if false, we'll float all the panels left and fix the width 
    // of the container
    var horizontal = true;

	
	if (horizontal) {
		
		
        $panels2.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
        // calculate a new width for the container (so it holds all panels)
        $container2.css('width', $panels2[0].offsetWidth * $panels2.length);
    }
	
	

    // collect the scroll object, at the same time apply the hidden overflow
    // to remove the default scrollbars that will appear
    var $scroll2 = $('#slider2 .scroll2').css('overflow', 'hidden');

    // apply our left + right buttons
		
    $scroll2
        .before('<img class="scrollButtons2 left" src="/imgsrc/pointer_sx.png" title="Precedente Offerta" name="left2" id="left2" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left2\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons2 right" src="/imgsrc/pointer_dx.png" title="Prossima Offerta" name="right2" id="right2" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right2\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');

    // handle nav selection
	
    function selectNav2() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }

	
    $('#slider2 .navigation2').find('a').click(selectNav2);

    // go find the navigation link that has this target and select the nav
	
    function trigger2(data2) {
        var el2 = $('#slider2 .navigation2').find('a[href$="' + data2.id2 + '"]').get(0);
        selectNav2.call(el2);
    }	

    if (window.location.hash) {
        trigger2({ id2 : window.location.hash.substr(1) });
    } else {
        $('ul.navigation2 a:first').click();
    }

    // offset is used to move to *exactly* the right place, since I'm using
    // padding on my example, I need to subtract the amount of padding to
    // the offset.  Try removing this to get a good idea of the effect
	
    var offset2 = parseInt((horizontal ? 
        $container2.css('paddingTop') : 
        $container2.css('paddingLeft')) 
        || 0) * -1;


	
	var scrollOptions2 = {
        target: $scroll2,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
		items: $panels2,


        navigation: '.navigation2 a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger2,  // our final callback


		offset: offset2,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };

    // apply serialScroll to the slider - we chose this plugin because it 
    // supports// the indexed next and previous scroll along with hooking 
    // in to our navigation.
    $('#slider2').serialScroll(scrollOptions2);

    // now apply localScroll to hook any other arbitrary links to trigger 
    // the effect

    $.localScroll(scrollOptions2);

    // finally, if the URL has a hash, move the slider in to position, 
    // setting the duration to 1 because I don't want it to scroll in the
    // very first page load.  We don't always need this, but it ensures
    // the positioning is absolutely spot on when the pages loads.
    scrollOptions2.duration = 1;
    $.localScroll.hash(scrollOptions2);

}

function coda4() {
    var $panels3 = $('#slider3 .scrollContainer3 > div');
	var $panels2 = $('#slider2 .scrollContainer2 > div');
    var $container3 = $('#slider3 .scrollContainer3');
    var $container2 = $('#slider2 .scrollContainer2');

    // if false, we'll float all the panels left and fix the width 
    // of the container
    var horizontal = true;

	
	if (horizontal) {
		
        $panels3.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
        $panels2.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });
		
        // calculate a new width for the container (so it holds all panels)
        $container3.css('width', $panels3[0].offsetWidth * $panels3.length);
        $container2.css('width', $panels2[0].offsetWidth * $panels2.length);
    }
	
	

    // collect the scroll object, at the same time apply the hidden overflow
    // to remove the default scrollbars that will appear
    var $scroll3 = $('#slider3 .scroll3').css('overflow', 'hidden');
    var $scroll2 = $('#slider2 .scroll2').css('overflow', 'hidden');

    // apply our left + right buttons
    $scroll3
        .before('<img class="scrollButtons3 left" src="/imgsrc/pointer_sx.png" title="Prev" name="left" id="left" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons3 right" src="/imgsrc/pointer_dx.png" title="Next" name="right" id="right" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');
		
    $scroll2
        .before('<img class="scrollButtons2 left" src="/imgsrc/pointer_sx.png" title="Precedente Offerta" name="left2" id="left2" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left2\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons2 right" src="/imgsrc/pointer_dx.png" title="Prossima Offerta" name="right2" id="right2" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right2\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');

    // handle nav selection
    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }
	
    function selectNav2() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }

    $('#slider3 .navigation3').find('a').click(selectNav);
	
    $('#slider2 .navigation2').find('a').click(selectNav2);

    // go find the navigation link that has this target and select the nav
    function trigger(data) {
        var el3 = $('#slider3 .navigation3').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el3);
    }
	
    function trigger2(data2) {
        var el2 = $('#slider2 .navigation2').find('a[href$="' + data2.id2 + '"]').get(0);
        selectNav2.call(el2);
    }	

    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
        trigger2({ id2 : window.location.hash.substr(1) });
    } else {
        $('ul.navigation3 a:first').click();
        $('ul.navigation2 a:first').click();
    }

    // offset is used to move to *exactly* the right place, since I'm using
    // padding on my example, I need to subtract the amount of padding to
    // the offset.  Try removing this to get a good idea of the effect
    var offset = parseInt((horizontal ? 
        $container3.css('paddingTop') : 
        $container3.css('paddingLeft')) 
        || 0) * -1;
	
    var offset2 = parseInt((horizontal ? 
        $container2.css('paddingTop') : 
        $container2.css('paddingLeft')) 
        || 0) * -1;


    var scrollOptions3 = {
        target: $scroll3,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
        items: $panels3,

        navigation: '.navigation3 a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger,  // our final callback

        offset: offset,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };
	
	var scrollOptions2 = {
        target: $scroll2,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
		items: $panels2,


        navigation: '.navigation2 a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger2,  // our final callback


		offset: offset2,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };

    // apply serialScroll to the slider - we chose this plugin because it 
    // supports// the indexed next and previous scroll along with hooking 
    // in to our navigation.
    $('#slider3').serialScroll(scrollOptions3);
    $('#slider2').serialScroll(scrollOptions2);

    // now apply localScroll to hook any other arbitrary links to trigger 
    // the effect

    $.localScroll(scrollOptions3);

    // finally, if the URL has a hash, move the slider in to position, 
    // setting the duration to 1 because I don't want it to scroll in the
    // very first page load.  We don't always need this, but it ensures
    // the positioning is absolutely spot on when the pages loads.
    scrollOptions3.duration = 1;
    $.localScroll.hash(scrollOptions3);

}

function coda5() {
    var $panels4 = $('#slider4 .scrollContainer4 > div');
    var $container4 = $('#slider4 .scrollContainer4');

    // if false, we'll float all the panels left and fix the width 
    // of the container
    var horizontal = true;

	
	if (horizontal) {
		
        $panels4.css({
            'float' : 'left',
            'position' : 'relative' // IE fix to ensure overflow is hidden
        });

// calculate a new width for the container (so it holds all panels)
        $container4.css('width', $panels4[0].offsetWidth * $panels4.length);
    }
	
	

    // collect the scroll object, at the same time apply the hidden overflow
    // to remove the default scrollbars that will appear
    var $scroll4 = $('#slider4 .scroll4').css('overflow', 'hidden');

    // apply our left + right buttons
    $scroll4
        .before('<img class="scrollButtons4 left" src="/imgsrc/pointer_sx.png" title="Prev" name="left" id="left" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'left\',\'\',\'/imgsrc/pointer_sx_on.png\',1)" />')
        .after('<img class="scrollButtons4 right" src="/imgsrc/pointer_dx.png" title="Next" name="right" id="right" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'right\',\'\',\'/imgsrc/pointer_dx_on.png\',1)" />');
		

    // handle nav selection
    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('selected')
                .end()
            .end()
            .addClass('selected');
    }
	

    $('#slider4 .navigation4').find('a').click(selectNav);

    // go find the navigation link that has this target and select the nav
    function trigger(data) {
        var el4 = $('#slider4 .navigation4').find('a[href$="' + data.id + '"]').get(0);
        selectNav.call(el4);
    }

    if (window.location.hash) {
        trigger({ id : window.location.hash.substr(1) });
    } else {
        $('ul.navigation4 a:first').click();
    }

    // offset is used to move to *exactly* the right place, since I'm using
    // padding on my example, I need to subtract the amount of padding to
    // the offset.  Try removing this to get a good idea of the effect
    var offset = parseInt((horizontal ? 
        $container4.css('paddingTop') : 
        $container4.css('paddingLeft')) 
        || 0) * -1;
	


    var scrollOptions = {
        target: $scroll4,
		  // the element that has the overflow

        // can be a selector which will be relative to the target
        items: $panels4,

        navigation: '.navigation4 a',

        // selectors are NOT relative to document, i.e. make sure they're unique
        prev: 'img.left', 
        next: 'img.right',
		

        // allow the scroll effect to run both directions
        axis: 'xy',

        onAfter: trigger,  // our final callback

        offset: offset,

        // duration of the sliding effect
        duration: 500,

        // easing - can be used with the easing plugin: 
        // http://gsgd.co.uk/sandbox/jquery/easing/
        easing: 'swing'
    };
	

    // apply serialScroll to the slider - we chose this plugin because it 
    // supports// the indexed next and previous scroll along with hooking 
    // in to our navigation.
    $('#slider4').serialScroll(scrollOptions);

    // now apply localScroll to hook any other arbitrary links to trigger 
    // the effect

    $.localScroll(scrollOptions);

    // finally, if the URL has a hash, move the slider in to position, 
    // setting the duration to 1 because I don't want it to scroll in the
    // very first page load.  We don't always need this, but it ensures
    // the positioning is absolutely spot on when the pages loads.
    scrollOptions.duration = 1;
    $.localScroll.hash(scrollOptions);

}