$.metadata.setType("attr", "validate");

$(document).ready(function(){

/*Convert spam-safe email addresses*/
	$('a.antispam').each(function(){
		if(this.rel.length >1) {
			e = this.rel.replace('/','@');
		this.href = 'mailto:' + e;
		$(this).text(e);
		$(this).attr('title','Email '+e);
		} 
	})


		if ($('ul.sf-menu').length>0) {
        $("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish().find('ul').bgIframe({opacity:false});  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason.
	}
	
	//Form validation
	// validate the comment form when it is submitted
	$("#contact_form").validate({
			errorElement: "div"
		});
	
});
