sfHover = function() {
	var sfEls = document.getElementById("topnav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


$(document).ready(function(){


	$("#submitform").click(function(){
		var valid = '';
		var mail = $("#newsEmail").val();

		if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,6}$)/i)) {
			valid += 'Please enter a valid e-mail address';
		}

		if (valid!='') {
			$("#response").addClass('error');
			$("#response").fadeIn("slow");
			$("#response").html(valid);
		} else {
			// var datastr ='fullName=' + name + '&mail=' + mail + '&subject=' + subject + '&text=' + text;
			var datastr = "email="+ mail;
			//alert(datastr);
			$("#response").css("display", "block");
			$("#response").removeClass('error');
			$("#response").html("Sending message .... ");
			$("#response").fadeIn("slow");
			$("#emailForm").fadeOut("fast");
			setTimeout( function() {
				$.ajax({
					type: "POST",
					url: "/js/newsletter.php",
					data: datastr,
					cache: false,
					success: function(html){
						$("#response").fadeIn("slow");
						$("#response").html(html);
						/* setTimeout('$("#response").fadeOut("slow")',2000); */
					}
				});
            }, 2000 );
		}
		return false;
	});
	
	
});

