if (document.images)
{
  pic1_off= new Image(16,15); 
  pic1_off.src="/images/pagination/1_off.gif"; 
  pic1_on= new Image(16,15); 
  pic1_on.src="/images/pagination/1_on.gif";
  pic1_selected= new Image(16,15); 
  pic1_selected.src="/images/pagination/1_selected.gif"; 

  pic2_off= new Image(16,15); 
  pic2_off.src="/images/pagination/2_off.gif"; 
  pic2_on= new Image(16,15); 
  pic2_on.src="/images/pagination/2_on.gif";
  pic2_selected= new Image(16,15); 
  pic2_selected.src="/images/pagination/2_selected.gif";   

  pic3_off= new Image(16,15); 
  pic3_off.src="/images/pagination/3_off.gif"; 
  pic3_on= new Image(16,15); 
  pic3_on.src="/images/pagination/3_on.gif";
  pic3_selected= new Image(16,15); 
  pic3_selected.src="/images/pagination/3_selected.gif";

  pic4_off= new Image(16,15); 
  pic4_off.src="/images/pagination/4_off.gif"; 
  pic4_on= new Image(16,15); 
  pic4_on.src="/images/pagination/4_on.gif";
  pic4_selected= new Image(16,15); 
  pic4_selected.src="/images/pagination/4_selected.gif";  

  pic5_off= new Image(16,15); 
  pic5_off.src="/images/pagination/5_off.gif"; 
  pic5_on= new Image(16,15); 
  pic5_on.src="/images/pagination/5_on.gif";
  pic5_selected= new Image(16,15); 
  pic5_selected.src="/images/pagination/5_selected.gif";
}
var o = {
submitSubscription: function() 
{		
	// Grab form action
		formAction = $("form#subForm").attr("action");

		emailId = "mtyjru";
		emailId = emailId.replace("/", "");
		emailId = emailId + "-" + emailId;

		// Validate email address with regex
		if (!o.checkEmail(emailId)) 
		{
			alert("Please enter a valid email address");
			return;
		}

		// Serialize form values to be submitted with POST
		var str = $("form#subForm").serialize();

		// Add form action to end of serialized data
		// CDATA is used to avoid validation errors
		//<![CDATA[
		var serialized = str + "&action=" + formAction;
		// ]]>

		$.ajax({
			url: "/mailing_proxy.php",
			type: "POST",
			data: serialized,
			success: function(html) {
				$("#subscribe-form").hide(); // If successfully submitted hides the form
				$("#subscribe-thanks").fadeIn("slow");  // Shows "Thanks for subscribing" div
			}
		});
},
checkEmail: function( email )
{
	var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var emailVal = $("#" + email).val();
	return pattern.test(emailVal);		
}
};

$(document).ready(function(){
  var defaultVal = "";
  $('.clearme').focus(function() {
  	defaultVal = $(this).val();
    $(this).val("");
  });
$('.clearme').blur(function() {
	if( $(this).val() == "" ) {
    	$(this).val(defaultVal);
    }
  });  
});  
