jQuery(document).ready(function() {
	$("#searchform input[type=text]").focus(function() {
		$(this).closest("form").addClass("active");
	});
	$("#searchform input[type=text]").blur(function() {
			$(this).closest("form").removeClass("active");
	});
	
	$("#geekmailSignup input[type=text]").focus(function(){
		$t = $(this);
		if ($t.val() == "Your email address") {
			$t.val("");
		}
	});
	$("#geekmailSignup input[type=text]").blur(function(){
		if ($t.val() == "") {
			$t.val("Your email address");
		}
	});
	
	$("#heroAboutNav li").hover(function(){
		$(this).addClass("hovered");
	}, function(){
		$(this).removeClass("hovered");		
	});
    
	$("#clientNav li").hover(function(){
		$(this).addClass("hovered");
	}, function(){
		$(this).removeClass("hovered");		
	});

    $('#sidebar_geekmail_form').submit(function(){
        var emailAdd = $('.sidebar_geekmail_email').val();
        if(emailAdd != undefined && emailAdd != '')
        {
            //$('.sidebar_geekmail_email').val('Subscribing...');
            $.ajax({
                type: 'post',
                url: '/wp-content/themes/lowe/rego/subscribeAjax.php',
                data: {'email': emailAdd},
                success: function(response,status){
                    if(response == 'success')
                    {
                        $('#sidebar_geekmail').hide();
                        $('#sidebar_geekmail_success').show();
                    }
                    else
                    {
                        $('.sidebar_geekmail_email').val(response);
                    }
                },
                error: function(){
                    $('.sidebar_geekmail_email').val('Error! Please try again');
                }
            });
        }
        return false;
    });
	
	// Check if we've loaded the Javascript and run the alpha/bg PNG fix.
	if (window.DD_belatedPNG) {
		DD_belatedPNG.fix('.pngbg');
	}
});

