$(function () {

    // hubicorn slider
	
	var $tabs = $(".slider").tabs({
        fx: {
            opacity: 'toggle'
        }
    }).tabs("rotate", 13000, true);

    $(".ui-tabs-panel").each(function (i) {

        var totalSize = $(".ui-tabs-panel").size() - 1;

        if (i != totalSize) {
            next = i + 2;
            $(this).append("<div class='next'><a href='#' class='next-tab mover' rel='" + next + "'>Next</a></div>");
        }

        if (i != 0) {
            prev = i;
            $(this).append("<div class='back'><a href='#' class='prev-tab mover' rel='" + prev + "'>Prev</a></div>");
        }

    });

    $('.next-tab, .prev-tab').click(function () {
        $tabs.tabs('select', $(this).attr("rel"));
        return false;
    });

    // the lightbox setup
	
	$(".various").fancybox({
        maxWidth: 800,
        maxHeight: 600,
        fitToView: false,
        width: '70%',
        height: '70%',
        autoSize: false,
        closeClick: false,
        openEffect: 'none',
        closeEffect: 'none'
    });
	
	$(".bpa").fancybox({
        maxWidth: 800,
        maxHeight: 280,
        fitToView: false,
        width: '70%',
        height: '70%',
        autoSize: false,
		scrolling: 'no',
        closeClick: false,
        openEffect: 'none',
        closeEffect: 'none'
    });

    $(".login").fancybox({
        maxWidth: 300,
        maxHeight: 267,
        fitToView: false,
        width: '70%',
        height: '70%',
        autoSize: false,
		scrolling: 'no',
        closeClick: false,
        openEffect: 'none',
        closeEffect: 'none'
    });


    $(".contact").fancybox({
        maxWidth: 700,
        maxHeight: 600,
        fitToView: false,
        width: '70%',
        height: '70%',
        autoSize: false,
        closeClick: false,
        openEffect: 'none',
        closeEffect: 'none'
		
    });
	
	$(".invalidlogin").fancybox({
		maxWidth: 300,
        maxHeight: 276,
        fitToView: false,
        width: '70%',
        height: '70%',
        autoSize: false,
		scrolling: 'no',
        closeClick: false,
        openEffect: 'none',
        closeEffect: 'none'
    });

});

// contact form thank you message
match_re = /#thankyou/; 
if ((location.href.match(match_re))) { alert('Thank you for your interest! Someone will contact you shortly.'); }

// invalid login message
match_re = /#invalid/; 
if ((location.href.match(match_re))) 
{ 
	$(".invalidlogin").fancybox().trigger('click'); 
	//alert('The username or password you entered is incorrect.\nPlease try your login again.'); 
}
