//Hides Child Uls
$(document).ready(function() {
  $('ul#nav > li').hover(function() {
    $('ul:first', this).show();
  },
  function() {
    $('ul:first', this).hide();
  });

  $('ul#nav li li').hover(function() {
    $('ul:first', this).each(function() {
      $(this).css('top', $(this).parent().position().top );
      $(this).css('left', $(this).parent().position().left + $(this).parent().width() );
      $(this).show();
    });
  },
  function() {
    $('ul:first', this).hide();
  });
});


//http://jonraasch.com/blog/a-simple-jquery-slideshow
function slideSwitch() {
    var $active = $('#banner IMG.active');
    if ( $active.length == 0 ) $active = $('#banner IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#banner IMG:first');
    // uncomment the 3 lines below to pull the images in random order
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 5000 );
});


//Carousel Bottom
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel();
});

//Lightbox
jQuery(document).ready(function() {
	jQuery("#preview_box a.img").fancybox({'titlePosition' : 'inside'});
});

/*
jQuery(".pdf").click(function() {
	jQuery.fancybox({
	'width': '70%', // or whatever
	'height': '90%',
	'autoDimensions': false,
	'content': '<embed src="'+this.href+'#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="100%" width="100%" />',
	'onClosed': function() {
	jQuery("#fancybox-inner").empty();
	}
	});
	return false;
});
*/
