// Basic EnjoyBanking Javascript

jQuery(document).ready(function(){
  	
	/* Clock Module */
	
	var height = jQuery("#othertimes").css('height');
	height = height.substring(0, (height.length-2));
	$('#othertimes').css('opacity', 0);
	
	jQuery(".bigtime").hover(function(){		
		$("#othertimes").stop().fadeTo('slow', 1);
	}, 
	function() {
		$("#othertimes").stop().fadeTo('slow', 0);
	});
		
	/*
	var sbhtml = $("social_bookmark");
	$('#sbpostwindow').html(sbhtml);
	$('.social_bookmark').remove();
	*/
	
	/* Coming Soon Fade ins */
	$('#ebtvcomingsoon').css('opacity', 0);
	$('#ltdcomingsoon').css('opacity', 0);
	$('#ltdcomingsoonleft').css('opacity', 0);
	
	$('#ebtvlink').hover(function() {$('#ebtvcomingsoon').stop().fadeTo('def', 1)}, function() {$('#ebtvcomingsoon').stop().fadeTo('def', 0)});
	
	$('#ltdlink').hover(function() {$('#ltdcomingsoon').stop().fadeTo('def', 1)}, function() {$('#ltdcomingsoon').stop().fadeTo('def', 0)});
	
	$('#ltdlinkleft').hover(function() {$('#ltdcomingsoonleft').stop().fadeTo('def', 1)}, function() {$('#ltdcomingsoonleft').stop().fadeTo('def', 0)});
	
	$("#signup_name").click(function() {
		
		if(this.value == "Enter Your E-Mail") {
			this.value = "";
		}
		
	});
	
	
	/* EB Mailing List Sign Up */
	$("#signup_name").blur(function() {
		
		if(this.value == "") {
			this.value = "Enter Your E-Mail";
		}
	});
	
	$("#signup_button").click(function() {
		
		$("#signup_div").fadeTo('slow', 0, function() {
		   email = $("#signup_name").val();
		   $.ajax({
			  type: "POST",
			  url: "/enjoybanking/ajax/submit_email.php",
			  data: "email=" + email,
		  	  success: function(html){
		      		  $("#signup_div").html("<h3>You've signed up with EnjoyBanking</h3>");
					  $("#signup_div").fadeTo('slow', 1);
		   	  }
		   });
		});			
		
	});
	
	/* Tell a Friend Modules */
	$("#opentellafriendleft").click(function() {
		
		if($("#sbpostwindowleft").css('display') == 'block') {
			$("#sbpostwindowleft").css('display', 'none');
		}
		else {
			$("#sbpostwindowleft").css('display', 'block');	
		}
	});
	
});