﻿function mycarousel_initCallback(carousel) {
    carousel.buttonNext.bind('click', function () {
        carousel.startAuto(0);
    });
    carousel.buttonPrev.bind('click', function () {
        carousel.startAuto(0);
    });
    carousel.clip.hover(function () {
        carousel.stopAuto();
    }, function () {
        carousel.startAuto();
    });
};
$(function () {
    $('.swap').hover(function () {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('hover'));
        $(this).attr('hover', currentImg);
    }, function () {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('hover'));
        $(this).attr('hover', currentImg);
    });
});

$(document).ready(function () {
    $("#recentProjects").hoverIntent(over, out);
    $('#slidePumps ul li').css({ visibility: "visible" });
    $("#coreNav li a").hover(function () {
        $(this).stop().animate({ backgroundPosition: "(0 -17px)" }, {duration: 0});
    }, function () {
        $(this).stop().animate({ backgroundPosition: "(0 0)" }, { duration: 0 });
    })
    $('#coreMenu li a')
    .css({ backgroundPosition: "0 34px" })
    .mouseover(function () {
        $(this).stop().animate({ backgroundPosition: "(0 0)" }, { duration: 200 })
    })
	.mouseout(function () {
	    $(this).stop().animate({ backgroundPosition: "(0 34px)" }, { duration: 200 })
	});
    $('#pumpCategory a')
    .css({ backgroundPosition: "0 -23px" })
    .mouseover(function () {
        $(this).stop().animate({ backgroundPosition: "(-489px 22px)" }, { duration: 300 })
    })
	.mouseout(function () {
	    $(this).stop().animate({ backgroundPosition: "(0 -23px)" }, { duration: 300 })
	});
    $('.slidePumps').jcarousel({
        auto: 3,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    $('.slidePumps li')
    .mouseover(function () {
        $(this).stop().fadeTo('200', 0.25)
    })
    .mouseout(function () {
        $(this).stop().fadeTo('200', 1.0)
    });
    $(".modalVideo").colorbox({ width: "495px", height: "435px", iframe: true });
    $(".pumpDetails").colorbox({ width: "668px", height: "73%", iframe: true });
});

function over() { $(this).animate({ marginTop: "103px" }, 500); }
function out() { $(this).animate({ marginTop: 0 }, 500); }
