$(function() {
	
	// setup overlay actions to buttons
	$("div.featured-video a[rel]").overlay({

		// use the Apple effect for overlay
		effect: 'apple',		
		expose: '#000',				
		
		onLoad: function(content) {
			// find the player contained inside this overlay and load it
			this.getOverlay().find("a.player").flowplayer(0).load();
		},
		
		onClose: function(content) {
			$f().unload();
		}
	});				

	
    $("#hslider").tabs("#hslider div.slide", {
        tabs: 'div.tab', 
    	effect: 'horizontal',
        rotate: true
    }).slideshow(
        {
            autoplay: true,
			clickable: false,
            interval: 5000
        }
        );
        
  $(".blog-ticker").scrollable({circular: true, vertical: true, easing: 'linear' }).navigator().autoscroll({
    interval: 5000		
  });
        
        
    $(".testimonial-slidetabs").tabs(".panes > div", {

    	effect: 'fade',
    	fadeOutSpeed: 'slow',
    	rotate: true
    	}).slideshow(
    		{
    			autoplay: true,
				clickable: false,
    			interval: 4000
    		}
    	);
    	
    	$("#contact-main").validator({ 
  			position: 'top left', 
  			offset: [-5, 0],
  			message: '<div></div>' // em element is the arrow
  		});
    	
    	//Hides the slickbox as soon as the DOM is ready
      			//(a little sooner than page load)
      			$('.slickbox').hide();

      			//Shows the slickbox on clicking the noted link  
      			$('a.slick-down').click(function() 
      			{
      				$('.slickbox').slideDown('slow');
      				return false;
      			});

      			//Hides the slickbox on clicking the noted link  
      			$('a.slick-up').click(function() {
      				$('.slickbox').slideUp('slow');
      				return false;
      			});
      			
      

      // fix placeholder field with jquery https://gist.github.com/379601 http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html
      $('[placeholder]').focus(function() {
        var input = $(this);
        if (input.val() == input.attr('placeholder')) {
          input.val('');
          input.removeClass('placeholder');
        }
      }).blur(function() {
        var input = $(this);
        if (input.val() == '' || input.val() == input.attr('placeholder')) {
          input.addClass('placeholder');
          input.val(input.attr('placeholder'));
        }
      }).blur().parents('form').submit(function() {
        $(this).find('[placeholder]').each(function() {
          var input = $(this);
          if (input.val() == input.attr('placeholder')) {
            input.val('');
          }
        })
      });
});
