$(document).ready(function() {

	$("ul.latest li").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom	'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
});



   $(document).ready(function() {
  
        $('div.services> div').hide();  
  
        $('div.services> h3').click(function() {
  
          var $nextDiv = $(this).next();
        var $visibleSiblings = $nextDiv.siblings('div:visible');
  
  
          if ($visibleSiblings.length ) {
 
            $visibleSiblings.slideUp('fast', function() {
   
              $nextDiv.slideToggle('fast');
              });
 
          } else {
 
             $nextDiv.slideToggle('fast');

         }
 
        });

      });
      
      
      
      $(document).ready(function() 
{
   // By suppling no content attribute, the library uses each elements title attribute by default
   
   
   
  
$('input[title],textarea[title] ').qtip({

 style: { 
 
 		tip: true , 
 		
 		textAlign: 'center', 
 		background: '#f5f5f5', 
 		
 		color:'#999',
 		padding:10,
		border: {
             radius: 5,
    	     color: '#999'
      			},
 }  ,
 
 hide: { effect: 'fade' },
 show: { effect: { length: 430 } },
 position: {
      corner: {
         target: 'rightMiddle',
         tooltip: 'leftMiddle'
      }
   }

 


 })
$('a[title]').qtip({

 style: { 
 
 		tip: true , 
 		width:120,
 		textAlign: 'center', 
 		background: '#f57d20', 
 		
 		color:'#E7E1DE',
 		padding:10,
		border: {
             radius: 5,
    	     color: '#ddd'
      			},
 }  ,
 
 hide: { effect: 'fade' },
 show: { effect: { length: 430 } },
 position: {
      corner: {
         target: 'topMiddle',
         tooltip: 'bottomMiddle'
      }
   }

 })
});


$(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready (a little sooner that page load)
  $('#slickbox').hide();
  
 // shows and hides and toggles the slickbox on click  
  $('#slick-show').click(function() {
    $('#slickbox').show('slow');
    return false;
  });
  $('#slick-hide').click(function() {
    $('#slickbox').hide('fast');
    return false;
  });
  $('#slick-toggle').click(function() {
    $('#slickbox').toggle(400);
    return false;
  });

 // slides down, up, and toggle the slickbox on click    
  $('#slick-down').click(function() {
    $('#slickbox').slideDown('slow');
    return false;
  });
  $('#slick-up').click(function() {
    $('#slickbox').slideUp('fast');
    return false;
  });
  $('#slick-slidetoggle').click(function() {
    $('#slickbox').slideToggle(400);
    return false;
     });
  
});



jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
       scroll:2,
       animation: "slow"
    });
    
});



jQuery(document).ready(function() {

    $('#mycarousel a:has(img)').fancybox();


   });
 
 $(function() {

  $('.error').hide();

  $(".css3button").click(function() {
    // validate and process form here

    $('.error').hide();
    var name = $("input#name").val();
    if (name == "") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
    var subject = $("input#subject").val();
    if (subject == "") {
      $("label#subject_error").show();
      $("input#subject").focus();
      return false;
    }
    var message = $("textarea#message").val();
    if (message == "") {
      $("label#message_error").show();
      $("textarea#message").focus();
      return false;
    }
    var email = $("input#email").val();
    if (email == "") {
      $("label#email_error").show();
      $("input#email").focus();
      return false;
    }

    $('div#indicator').show("500");
    var dataString =  $('#contact_form form').serialize()
    
    $.ajax({
      type: "POST",
      url: "includes/process.php",
      data: dataString,
      dataType: "text",
      success: function(response) {
        $('#response').html(response);
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<img id='checkmark' src='resources/images/ok.png' /><h3>Your message was sent!</h3>")
        .hide()
        .fadeIn(1500, function() {
          $('#message');
        });
      }
    });
    $('div#indicator').hide();
    return false;

  });
});



    
