jQuery(function($){

    $.supersized({

        // Functionality
        autoplay                :   isAutoplay,
        fit_portrait            :   1,
        slide_interval          :   5000,		// Length between transitions
        transition              :   6, 			// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed		:	1000,		// Speed of transition
        thumbnail_navigation    :   0,
        horizontal_center       :   0,
        vertical_center         :   1,

        // Components							
        slide_links				:	'blank',	// Individual links for each slide (Options: false, 'number', 'name', 'blank')
        slides                  :   mySlides,
        new_window              :   0
    });

    // create captions for thumbs
    $('ul#thumb-list li img').before( function () {
        myIndex = $(this).parent().index();
        myTitle = api.options.slides[myIndex].title;
        if ( myTitle != '') {
            return '<div class="thumb-caption">' + myTitle + '</div>';
        } else {
            // make the title div transparent
            return '<div class="thumb-caption" style="background: transparent;"></div>';
        }
    });

    // wrap thumbs in a and span
    $('ul#thumb-list li img').wrap( function() {
        myImgSrc = $(this).attr('src');
        //console.log(myImgSrc);
        // test IE fix
        //return '<a href="#" style="background-image: url(' + myImgSrc +'); ">';
        return '<a href="#" style="background-image: url(' + myImgSrc +'); "></a>';
    });

    //$('#thumb-list li img').wrap('<a href="#" style="background: url(' + $(this).attr('src') +') center bottom;">');
    $('ul#thumb-list li img').wrap('<span></span>');

    // show captions on hover
    $('#thumb-list li a').hover(function() {
        $(this).parent().find('div.thumb-caption').css({'opacity': 1 , visibility: 'visible' });
    }, function() {
        $(this).parent().find('div.thumb-caption').css({'opacity': 0 , visibility: 'hidden' }); 
    });
    
});

$(document).ready(function() {
    $(function()
    {
        $('.scroll-pane').jScrollPane( {
            showArrows: true,
            verticalDragMinHeight: 67,
            verticalDragMaxHeight: 67
        });
    });
    
    // pop-up the contact form
    $("#contact-link").colorbox({
        iframe: true, 
        innerWidth:475, 
        innerHeight:560,
        opacity: 0.3,
        onLoad: function () { $('#colorbox').show(); }
    });
});
