//Jquery OnHover
//A simple script with basic hover intelligence that drops down ul menus of the same class as the parent id.
//Written by Katie Sexton http://katiesexton.com
//For Sanborn Media Factory http://sanbornmediafactory.com

$(document).ready( function() {
	var LI_HOVERS = $('li.hover');

		LI_HOVERS.each(function() {
	            //register click handler for each
		var local = this;
                var dropClassName = local.id;
		var vara = 0;
		if ( dropClassName ) {
			
			$(local).hover( 
				function() {  //show
					//always kill the queue
					var tq = $('ul.'+dropClassName).queue('fx');
					if ( tq && tq.length ) {
						$(tq).each(function(){   $(this).dequeue(); });
						vara = 0;
					}
					vara++
					if ( $(local).is('.selected') ) { //keep it shown
							$(local).children('ul.'+dropClassName).slideDown(300).animate({opacity:1.0}, 300, null, function() { vara--; });  
					} else { 
							$(local).addClass('selected').children('ul.'+dropClassName).slideDown(300,function() { vara--; });  
					}
					//cleanup if there's no menu animation to callback from ( just a tab )
					if ( ! $(local).addClass('selected').children('ul.'+dropClassName).length )
						$(local).animate({opacity: 1.0}, 500, null, function(){ vara--; } );
				},
				function() {  //hide
					// delay on close (maybe you change your mind)
					if ( $('ul.'+dropClassName).length ) {
						if ( $('ul.'+dropClassName).is(':visible') ) {							
							$('ul.'+dropClassName).animate({opacity: 1.0}, 200, 
														null,
														function(){ 
															if ( vara <= 0 )
																$(local).removeClass('selected').children('ul.'+dropClassName).fadeOut(300, function() {} ) ;
														} ); 						}
					} else {
						$(local).animate({opacity: 1.0}, 200, null, function() { 
							if ( vara <= 0 )  $(local).removeClass('selected'); 	
						});
					}
				}				
			);
		}
	});


});

$(document).ready(function() { 
	$('.tooltip1').tooltip({
		showURL:false,
		showBody: '-',
		track: true, 
		delay: 0, 
		fade: 250 
	});		
	$('.tooltip2').tooltip({
		showURL:false,
		showBody: '-',
		track: true, 
		delay: 0, 
		fade: 250 
	});
});

// $(document).ready(function() {
// 	$('a.expandable').click(function() {
// 		$(this).next().toggle(400);
// 		return false;	
// 	})
// });




