﻿$(document).ready(function () {
    setBarColor();
    $('.texthint').each(function () {
        this.value = $(this).attr('title');
        $(this).addClass('text-label');
        $(this).focus(function () {
            if (this.value == $(this).attr('title')) {
                this.value = '';
                $(this).removeClass('text-label');
            }
        });
        $(this).blur(function () {
            if (this.value == '') {
                this.value = $(this).attr('title');
                $(this).addClass('text-label');
            }
        });
    });
});

function setBarColor() {
    $("div.inner ul li").hover(
  function () {
      $("#nav").addClass($(this).attr("class") + "barhover");
  }, function () {
      $("#nav").removeClass($(this).attr("class") + "barhover");
  });
}

function setEmail() {
    if ($("#sbemail").val.length > 0) {
        $(".email").fadeOut('slow', function () {
            $(".emailloader").fadeIn('slow', function () {
                
                $.ajax({
                    type: "POST",
                    url: "/Handlers/EmailSignup.ashx?list=SharkDirect&email=" + escape($("#sbemail").val()),
                    success: function (JSONP) {

                        $(".emailloader").fadeOut('slow', function () {
                            $(".emailthankyou").fadeIn('slow');
                 
                            var pageTracker;
                            pageTracker = window["_gat"]["_getTracker"]('UA-11512050-1');


                            pageTracker._trackPageview('/success/emailsignup');

        
                        });

                    }
                   , error: function (request, status, error) {

                   }
                });
            });
        });                
    }
}
function setEnterKeyPressed() {
    $("#sbemail").keypress(function (event) {
        if (event.which == '13') {
            setEmail();
            return false;
        }

    });
}
$(document).ready(function () {
    setEnterKeyPressed();
    $("#btnEmail").click(function () {
        setEmail();
        return false;
    });
});

