
jQuery(document).ready(function($) {
		jQuery('.scroll-pane').jScrollPane();

});

/* Functins CallBack  -----------------------------------------------------------*/

jQuery(window).load(function() {	
		sys_toggle();
		sys_imagehover();
		jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_square'});
		jQuery('ul.social li a').tipsy({gravity: 's'});
});

/* Image Preloader  -----------------------------------------------------------*/

$(function () {
  var img = new Image();
  
  $(img)
    .load(function () {
      $(this).hide();
       $('loading')
        .removeClass('loading')
        .append(this);
   
      $(this).fadeIn();
    })
    
    .error(function () {
    })
    
    .attr('src', '');
});

/* Image Hover Classes  -----------------------------------------------------------*/

function sys_imagehover() {
$("a[rel^='prettyPhoto']").each(function() {	
		var $image = $(this).contents("img");
			$hoverclass = 'hover_video';

	if($(this).attr('href').match(/(jpg|gif|jpeg|png|tif)/)) 
	$hoverclass = 'hover_image';
		
	if ($image.length > 0)
	{	
		var $hoverbg = $("<span class='"+$hoverclass+"'></span>").appendTo($(this));
		
			$(this).bind('mouseenter', function(){
			$height = $image.height();
			$width = $image.width();
			$pos =  $image.position();		
			$hoverbg.css({height:$height, width:$width, top:$pos.top, left:$pos.left});
		});
	}

});	

$("a[rel^='prettyPhoto']").contents("img").hover(function() {
		$(this).stop().animate({"opacity": "0.3"}, 200);
		$("span[class^=hover]").stop().animate({"opacity": "1"});
		},function() {
		$(this).stop().animate({"opacity": "1"},200);
		$("span[class^=hover]").stop().animate({"opacity": "0"});
	});

}



/* jQuery Toggle   -----------------------------------------------------------*/

function sys_toggle() {
jQuery(".toggle_content").hide();
jQuery("h5.toggle").toggle(function(){
jQuery(this).addClass("active");
		}, function () {
jQuery(this).removeClass("active");
	});

jQuery("h5.toggle").click(function(){
jQuery(this).next(".toggle_content").slideToggle();
	});
}

/* jQuery Cufon Fonts -----------------------------------------------------------*/

Cufon.replace('h1, h2, h3, h4, h5, h6, .simple, .nivo-caption', { hover:true });

