﻿$(document).ready(function() { scrollMore(); PEPS.rollover.init(); t = setTimeout("rotateNext()", 15000); });  PEPS = {}; PEPS.rollover = { init: function()
{ this.preload(); $(".ro").hover(function() { $(this).attr('src', PEPS.rollover.newimage($(this).attr('src'))); }, function() { $(this).attr('src', PEPS.rollover.oldimage($(this).attr('src'))); }); }, preload: function()
{ $(window).bind('load', function() { $('.ro').each(function(key, elm) { $('<img>').attr('src', PEPS.rollover.newimage($(this).attr('src'))); }); }); }, newimage: function(src)
{ return src.substring(0, src.search(/(\.[a-z]+)$/)) + '_o' + src.match(/(\.[a-z]+)$/)[0]; }, oldimage: function(src)
{ return src.replace(/_o\./, '.'); } 
}; $(document).ready(function() { $("#txtName").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Name" }).removeClass("watermarkOn").val(""); }); $("#txtName").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Name"); }); $("#txtEmail").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Email" }).removeClass("watermarkOn").val(""); }); $("#txtEmail").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Email"); }); $("#txtPhone").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Phone" }).removeClass("watermarkOn").val(""); }); $("#txtPhone").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Phone"); }); $("#txtQuestions").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Questions or comments..." }).removeClass("watermarkOn").val(""); }); $("#txtQuestions").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Questions or comments..."); }); $("#Address").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Enter your address" }).removeClass("watermarkOn").val(""); }); $("#Address").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Enter your address"); }); $("#Search").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Search" }).removeClass("watermarkOn").val(""); }); $("#Search").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Search"); }); $("#txtMLEmail").focus(function() { $(this).filter(function() { return $(this).val() == "" || $(this).val() == "Email Address" }).removeClass("watermarkOn").val(""); }); $("#txtMLEmail").blur(function() { $(this).filter(function() { return $(this).val() == "" }).addClass("watermarkOn").val("Email Address"); }); }); var current = '#rotate1'; var c = current; var nextFrame = this.hash; function rotate() {
    $(current + " .background").animate({ opacity: 0, marginRight: "-150%" }, 1500, function() { $(c + " .background").css('marginLeft', '-150%').css('marginRight', ''); var nav = $(nextFrame + " img").attr('src').replace('images/rotator/bg', ''); $('#nav .current').attr('style', 'background:url(images/rotator/navBG' + nav + ');'); }); current = nextFrame; $(nextFrame + " .background").animate({ opacity: 1, marginLeft: "-50%" }, 1500); clearTimeout(t)
    t = setTimeout("rotateNext()", 15000);
}
$(".rotatorNav a").click(function() { c = current; nextFrame = this.hash; rotate(); $(".rotatorNav a").removeClass('active'); $(this).addClass('active'); return false; }); $(".arrowRight").click(function() { rotateNext(); return false; }); function rotateNext() {
    c = current; nextFrame = '#rotate' + (parseInt(current.replace('#rotate', '')) + 1); if (!$(nextFrame).length) { nextFrame = '#rotate1'; }
    rotate(); $(".rotatorNav a").removeClass('active'); $(".rotatorNav a[href='" + current + "']").addClass('active');
}; $(".arrowLeft").click(function() {
    c = current; nextFrame = '#rotate' + (parseInt(current.replace('#rotate', '')) - 1); if (!$(nextFrame).length) { nextFrame = '#rotate' + $('.bgWrapper').size(); }
    rotate(); $(".rotatorNav a").removeClass('active'); $(".rotatorNav a[href='" + current + "']").addClass('active'); return false;
});

function scrollMore() {
    jQuery("body").prepend('<span id="scrollMore"></span>');

    if (jQuery('#scrollMore').css('position') == 'absolute') {
        jQuery('#scrollMore').hide();
    }
    else {
        jQuery(window).scroll(function() {
            var opacity = 1.3 - (jQuery(window).scrollTop() / 1000);
            if (opacity > 1) opacity = 1;
            if (opacity < 0) opacity = 0;
            jQuery('#scrollMore').fadeTo(75, opacity);
        });

        jQuery('#scrollMore').click(function() {
            jQuery('html,body').animate({ scrollTop: jQuery(window).scrollTop() + 400 + 'px' }, 300);
        }).hover(function() {
            jQuery(this).fadeTo(200, 1);
        });
    }
}
