$(document).ready(function() {
			
			//superfish menu init
			jQuery('ul.sf-menu').superfish();
			if ($("#s4").length) {
					$(function() {
					// run the code in the markup!
					$('#s4')
						.cycle({ 
						fx:     'scrollHorz', 
						speed:  1000, 
						timeout: 5000, 
						next:   '#next2', 
						prev:   '#prev2' 
					});
					});
				};
				
function ajaxContact(theForm) {
		var $ = jQuery;
	
        $('#loader').fadeIn();

        var formData = $(theForm).serialize(),
			note = $('#Note');
	
        $.ajax({
            type: "POST",
            url: "send.php",
            data: formData,
            success: function(response) {
				if ( note.height() ) {			
					note.fadeIn('fast', function() { $(this).hide(); });
				} else {
					note.hide();
				}

				$('#LoadingGraphic').fadeOut('fast', function() {
					//$(this).remove();
					if (response === 'success') {
						$('.field').animate({opacity: 0},'fast');
						$('.button_contact').animate({opacity: 0},'fast');
					}

					// Message Sent? Show the 'Thank You' message and hide the form
					result = '';
					c = '';
					if (response === 'success') { 
						result = 'Your message has been sent. Thank you!';
						c = 'success';
					}

					note.removeClass('success').removeClass('error').text('');
					var i = setInterval(function() {
						if ( !note.is(':visible') ) {
							note.html(result).addClass(c).slideDown('fast');
							clearInterval(i);
						}
					}, 40);    
				});
            }
        });

        return false;
    }
	if ($("#contactform").length) {
	jQuery("#contactform").validate({
			submitHandler: function(form) {				
				ajaxContact(form);
				return false;
			},
			 messages: {
    		 formname: "Please specify your name.",
			 formcomments: "Please enter your message.",
    		 formemail: {
      			 required: "We need your email address to contact you.",
      			 email: "Your email address must be in the format of name@domain.com"
    		 }
  		 }
		});
		 }
		 
		 
		 if ($(".overflow").length) {
			$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
			};	
		 
			$(".overflow").append("<span></span>")
			$(".overflow	").hover(function(){
						$(this).find("img").stop().animate({opacity:0.5}, "normal")
					}, function(){
						$(this).find("img").stop().animate({opacity:1}, "normal")
					});
					
		});	

