// JavaScript Document

(function($){
	
    $(document).ready(function() {		
		$('#drop-nav:first').children().hover(
    		function(){
				$(this).addClass('hover').find('ul').hide();;
				$('ul', this).slideDown();
    		},
    		function(){
        		if($(this).has('ul').length)
				{
					$('ul', this).slideUp('fast', function(){
						$(this).parent('li').removeClass('hover');
					});
				}
				else {
					$(this).removeClass('hover');
				}
				
    		}
    	);
		var width = 0;
		$('#drop-nav:first').children().each(function() {
			width += $(this).outerWidth( true );
		});
		var padding = (940-width)/2;
		
		$('#drop-nav').width(width).css({'padding-left': padding, 'padding-right': padding});
		
		
		
		$('#searchTerm').sdExample();
	//	$('select').sdSelectMenu({newMenuClass: 'selectMenu'});
		$('.frmSelect').submit(function(){
			if($('select', this).val() != "")
			{
				window.location.href = $('select', this).val();
			}
			return false;
			
		});
		
		$('a.inline').fancybox({
			hideOnContentClick: false,
			autoDimensions: false,
			height: 500,
			width: 500,
			padding: 0
		});
		$('.fancy').fancybox();
		
		
		$('.youtube').click(function() {
			$.fancybox({
					'padding'		: 0,
					'autoScale'		: false,
					'transitionIn'	: 'none',
					'transitionOut'	: 'none',
					'title'			: this.title,
					'width'		: 680,
					'height'		: 495,
					'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
					'type'			: 'swf',
					'swf'			: {
						 'wmode'		: 'transparent',
						'allowfullscreen'	: 'true'
					}
				});
		
			return false;
		});
    });
})(jQuery);
