$j(document).ready(function(){
	//jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	jQuery("ul.tabs").tabs("> .tab_content");
	});
// when the DOM is ready
$j(function () {
  var img = new Image();
  
  // wrap our new image in jQuery, then:
  $j(img)
    // once the image has loaded, execute this code
    .load(function () {
      // set the image hidden by default    
      $j(this).hide();
    
      // with the holding div #loader, apply:
      $j('loading')
        // remove the loading class (so no background spinner), 
        .removeClass('loading')
        // then insert our image
        .append(this);
    
      // fade our image in to create a nice effect
      $j(this).fadeIn();
    })
    
    // if there was an error loading the image, react accordingly
    .error(function () {
      // notify the user that the image could not be loaded
    })
    
    // *finally*, set the src attribute of the new image to our image
    .attr('src', '');
});

$j(document).ready(function(){
	$j("a[rel^='prettyPhoto']").each(function() {	
		var $jimage = $j(this).contents("img");
			$jhoverclass = 'hover_video';

	if($j(this).attr('href').match(/(jpg|gif|jpeg|png|tif)/)) 
	$jhoverclass = 'hover_image';
		
	if ($jimage.length > 0)
	{	
		var $jhoverbg = $j("<span class='"+$jhoverclass+"'></span>").appendTo($j(this));
		
			$j(this).bind('mouseenter', function(){
			$jheight = $jimage.height();
			$jwidth = $jimage.width();
			$jpos =  $jimage.position();		
			$jhoverbg.css({height:$jheight, width:$jwidth, top:$jpos.top, left:$jpos.left});
		});
	}

});	

$j("a[rel^='prettyPhoto']").contents("img").hover(function() {
		$j(this).stop().animate({"opacity": "0.3"}, 200);
		$j("span[class^=hover]").stop().animate({"opacity": "1"});
		},function() {
		$j(this).stop().animate({"opacity": "1"},200);
		$j("span[class^=hover]").stop().animate({"opacity": "0"});
	});
});



function sys_toggle() {
	jQuery(".toggle_content").hide(); 

	jQuery("h4.toggle").toggle(function(){
		jQuery(this).addClass("active");
		}, function () {
		jQuery(this).removeClass("active");
	});

	jQuery("h4.toggle").click(function(){
		jQuery(this).next(".toggle_content").slideToggle();
	});
}

jQuery(function(){
	k_menu();
	sys_toggle();
	$j('ul.sf-menu ul li span').css({display:'none'});
	$j('.sub_nav li span, .footer-menu li span, .footer-menu ul li ul').css({display:'none'});
	$j('.sitemap li span').css({display:'none'});
});

function k_menu()
{
	// k_menu controlls the dropdown menus and improves them with javascript
	
	//jQuery(".nav a").removeAttr('title');
	//jQuery(" .nav ul ").css({display: "none"}); // Opera Fix

	
	//smooth drop downs
	jQuery(".nav li").each(function()
	{	
		
		var $jsublist = jQuery(this).find('ul:first');
		
		jQuery(this).hover(function()
		{	
			$jsublist.stop().css({overflow:"hidden", height:"auto", display:"none", paddingTop:30}).slideDown(400, function()
			{
				jQuery(this).css({overflow:"visible", height:"auto"});
			});	
		},
		function()
		{	
			$jsublist.stop().slideUp(400, function()
			{	
				jQuery(this).css({overflow:"hidden", display:"none"});
			});
		});	
	});
}

/*jQuery(document).ready(function() {

		jQuery('#slideshow').css("display", "block");		
		jQuery('.slideshow').cycle({
			fx: 'fade',
			timeout: 6000,
			pager: '#nav',
			speed: 600,
			pagerEvent: 'click',

			cleartypeNoBg: true,
			pause: 1 });
		jQuery('.slideshow').css("display", "block");
		jQuery('#nav').css("display", "block");
				jQuery('.slideshow').cycle('pause');

  })*/
;
