$(document).ready(function(){
	$(".ep_showmore").click(function(){
		$(".ep_showmore").hide();
		$(".ep_readmore").show();
	});
	$(".ep_showless").click(function(){
		$(".ep_showmore").show();
		$(".ep_readmore").hide();
	});
	$("a.nofollow").click(function(){
		return false;
	})
});

function openWinResize(linkHere) {
	win = window.open(linkHere,"Info","resizable=yes,toolbars=no,width=600,height=450,scrollbars=yes");
	win.focus();
}

/** Validates the sales form **/
function validateSalesForm() {
	var stopForm = 0;
	$(".validate").each(function() {
		if ($(this).val() == ""){
			stopForm = 1;
		}		
	});
	if (stopForm) {
		alert('Please make certain you have completed all of the required fields');
		return false;
	}
}

/** Validates the contact form **/
function validateContactForm() {
	var errorMessage = "";
	$(".validate").each(function() {
		if ( $(this).val() == "" ){
			$(this).addClass('highlight');
			errorMessage = "Please make certain you have completed all of the required fields.\n\nThey are marked with a star and highlighted in red.\n\n";
		}
		else {
			$(this).removeClass('highlight');
		}
	});
	$(".validateEmail").each(function() {
		if ( errorMessage=="" && $(this).val() != "" ){
			var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})+$/;
			if ( $(this).val().match(emailRegEx) == null ){			
				errorMessage = "Your email address is not valid.  Please try again.";
				$(this).addClass('highlight');
			}
		}
	});
	if (errorMessage != "") {
		alert(errorMessage);
		return false;
	}
}

