// JavaScript Document

(function($){
	
    $(document).ready(function() {		
		$('#drop-nav:first').children().hover(
    		function(){
				$(this).addClass('hover').find('ul').hide();
				$('ul', this).slideDown();
				
				$('ul:first', this).children().hover(
					function(){
						$(this).addClass('hover');
						$('ul', this).slideDown();
						console.log('yay');
					},
					function(){
						if($(this).has('ul').length)
						{
							$('ul', this).slideUp('fast', function(){
								$(this).parent('li').removeClass('hover');
							});
						}
						else {
							$(this).removeClass('hover');
						}
						
					}
				);
    		},
    		function(){
        		if($(this).has('ul').length)
				{
					$('ul', this).slideUp('fast', function(){
						$(this).parent('li').removeClass('hover');
					});
				}
				else {
					$(this).removeClass('hover');
				}
				
    		}
    	);
		
		
		
		$('input').example(function() {
			return $(this).attr('title');
		});
		$('input, textarea')
			.bind('focus', function() {
					$(this).addClass('focus');
			}).bind('blur', function() {
					$(this).removeClass('focus');
		});
			
		if($('#carousel'))
		{
			$('#carousel ul').empty();
			$('#carousel #slides').cycle({
				fx: 'fade',
				speed: 'slow',
				timeout: 10000,
				containerResize: 0,
				cleartype: true,
				cleartypeNoBg: true,
				pager: '#carousel ul',
				pagerAnchorBuilder: function(idx, slide) {
						   return '<li><a href="#"></a></li>';
				}
			});
		}
    });
})(jQuery);
