$.validator.setDefaults({
	//submitHandler: function() { alert("submitted!"); }
});

$().ready(function() {
	// validate the comment form when it is submitted
	$("#commentForm").validate();
	
	// validate signup form on keyup and submit
	$("#signupForm").validate({
		rules: {
			firstname: "required",
			lastname: "required",
			email: {
				required: true,
				email: true
			},
			topic: {
				required: "#newsletter:checked",
				minlength: 2
			},
			agree: "required"
		},
		messages: {
			firstname: "Please enter your firstname",
			lastname: "Please enter your lastname",
			username: {
				required: "Please enter a username",
				minlength: "Your username must consist of at least 2 characters"
			},
			email: "Please enter a valid email address",
			agree: "Please accept our policy"
		}
	});
	

});


function openNewWindow(theURL, width, height) { //v2.0
	var winl = (screen.width - width) / 2; //center screen horizontal
	var wint = (screen.height - height) / 2; //center screen vertical
window.open(theURL,'','width='+width+',height='+height+',top=' + wint + ',left=' + winl+',resizable=0,scrollbars=0');
}

$(document).ready(function($){
(function($){
	$(function(){
		$('input.button').each(function(){$(this).replaceWith('<button id="'+ this.id +'" name="'+ this.name +'" type="'+ this.type +'"><span><span>'+ $(this).attr('value') +'</span></span>');});
		$('#nav li:has(ul)').hover(function(){$(this).addClass('sfhover');}, function(){$(this).removeClass('sfhover');});		  
		$('ul.nav li:has(ul)').hover(function(){$(this).addClass('sfhover');}, function(){$(this).removeClass('sfhover');});		  
	});
})
});
