sfHover = function() {
	var sfEls = document.getElementById("mainNav").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);


jQuery(document).ready(function(){
								
  $("tr:even").addClass("even");
  $("tr:odd").addClass("odd");
  
  $('#banner').innerfade({
            speed: 'slow', 
            timeout: 8000, 
            type: 'random', 
            containerheight: '241' 
         }); 
  
																								
	$("#contactForm").validate()
		

	$('#contactForm').submit(function(){
 
		var action = $(this).attr('action');
 
		$('#submit').attr('disabled','disabled');
					 
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			message: $('#message').val()
		},
		
			function(data){
				$('#contactForm #submit').attr('disabled','');
				$('.response').remove();
				$('#contactForm').before('<p class="response"><strong>OOPS!</strong> Sorry but you cannot send this form quite yet, there seem to be some mistakes. Please check the marked fields below.</p>');
				$('.response').slideDown();
				$('#contactForm img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='Message sent!') {
					$('#contactForm').slideUp();
					$('.response').remove();
					$('#contactForm').before('<p class="response" id="sent"><strong>Thank you!</strong> One of our team will be back in touch with you shortly. We hope you have found our website informative and useful.</p>');
				}
			}
		);
 
		return false;
 
	});
	 
});
