// JavaScript Document 

var UTILITES = {};

$(function(){
	
	jQuery.UTILITIES.sendToFriend(".sendToFriend", "#sendToFriendBoxProducts", "#friendEmailAddress", ".send", "#cancel", "I thought you might be interested in this product I found on holtsauto.com. Here's a link:");		   
	jQuery.UTILITIES.sendToFriend(".sendToFriend", "#sendToFriendBoxArticles", "#friendEmailAddress", ".send", "#cancel", "I thought you might be interested in this article I found on holtsauto.com. Here's a link:");		   
	
});

jQuery.UTILITIES = {

	sendToFriend : function(typeOfFriend, typeOfBox, friendEmailAddress, send, cancel, bodyContent) {
	
		$(typeOfFriend).click(function() {
			$(typeOfBox).slideDown("def");
			return false;
		});
	
		// disable the return key to not effect other forms on the page
	
		$(typeOfBox).find("input[@type=text]").bind("keypress", function(e) {
			if (e.keyCode == 13)  {
				return false;
			}
		});
		
		$(typeOfBox).find("a"+send).click(function(){
			var friendAddress = $(friendEmailAddress).val();
			var subject = $('title').text();
			var href = $(typeOfFriend).attr('href');
			$(this).attr("href", "mailto:"+friendAddress+"?subject="+subject+"&body="+bodyContent+" "+href);
			$(typeOfBox).fadeOut("def");
			$(typeOfBox).find("input[@type=text]").val("");
		});
	
		$(cancel).click(function() {
			$(typeOfBox).slideUp("def");
		});
	
	}

/* I AM THE END */	
}
