$(document).ready(function() {
// Hide Loading and Output Elements
	$("#loader").hide();
	$("#filter").hide();		
	
	/* $('#dropdown').superfish( {
    delay:1000,
    animation: {opacity:'show'},
    speed: 'fast',
    autoArrows: false,
    dropShadows: false
  }); */
		
	// Setup Form Submit Options
	var options = {
		beforeSubmit: function() {
		$('#loader').fadeIn(50);
		},
		dataType: 'json',
		success: processJson
		}
	
	
	// Form Submit Function
	function processJson(data) {
		var status = data.status;
		$('#loader').fadeOut(300);		
				
		// If Fields are Empty
		if(status == 1) {$('#output').hide().empty().fadeIn(150).append("<p>You must fill in all required fields.</p>");}
		
		// If Name is Wrong
		if(status == 2) {$('#output').hide().empty().fadeIn(150).append("<p>Your name must be between 3 and 30 characters.</p>");}								
		
		// If Spam Bot
		if(status == 3) {$('#output').hide().empty().fadeIn(150).append("<p>Leave the spam field blank please.</p>");}
		
		// If Fields are Empty
		if(status == 4) {$('#output').hide().empty().fadeIn(150).append("<p>Your email address was not valid.</p>");}
		
		// If Probems
		if(status == 6) {$('#output').hide().empty().fadeIn(150).append("<p>There was a problem sending the form.</p>");}
		
		// If Message Sent
		if(status == 5) {
						
			$('#content #sidebar-comments #output').hide(50);								
			$('#content #sidebar-comments form').slideUp(600);	
			$('#content #sidebar-comments #thankyou').hide().append("<h2>Thank You.</h2><p>Your message has been sent.</p>").slideDown(600);														
			$('#loader').fadeOut(500);
			return false;						
		
		}// End of Status 5
						
	} 
	// End of processJson
	

	$('#content #sidebar-comments form').ajaxForm(options);
});
sfHover = function() {
	var sfEls = document.getElementById("nav").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);