$(document).ready(function(){

    $(".mailForm").validate({
        rules: {
            email: {
                email: true
            }
        }
    });
    
    $('.refVideo').click(function(e){
    
        e.preventDefault();
        
        var params = $(this).attr('rel');
        
        $.fn.colorbox({
            transition: "elastic",
            speed: 400,
            width: "750",
            height: "555",
            iframe: true,
            open: true,
            resize: true,
            href: params
        });
        
    })
    
    slideSwitch();
    
    setInterval("slideSwitch()", 5000);
    
});

function slideSwitch(){
    var $active = $("#pHead .pHeadCont .items div.active");
    if ($active.length == 0) 
        $active = $("#pHead .pHeadCont .items div:last");
    var $next = $active.next().length ? $active.next() : $("#pHead .pHeadCont .items div:first");
    $active.addClass("last-active").animate({
        opacity: 0.0
    }, 1000);
    $next.css({
        opacity: 0.0
    }).addClass("active").animate({
        opacity: 1.0
    }, 1000, function(){
        $active.removeClass("active last-active");
    });
}

