// JavaScript Document

$(document).ready(function() {
   		

	
	$("#menubar_other_co").click(function(event) {
										 
		 $("#dd_wrapper").toggle("fast");
		 event.preventDefault();

	});
	
	$("#menubar_search").click(function(event) {
										 
		 $("#dd_search").toggle("fast");
		 event.preventDefault();

	});
	
	$(document).click(function(){
							   
		var dd = $("#dd_wrapper");
		var dd_auctions = $("#dd_auctions");
		var dd_search = $("#dd_search");
		
		if(dd_auctions.css("display") == "block") {
			dd_auctions.css("display" , "none");	
		} 
		
		if(dd.css("display") == "block") {
			dd.css("display" , "none");
		}
		
		if(dd_search.css("display") == "block") {
			dd_search.css("display" , "none");	
		}
				
	});
	
//	$("#menubar_current_auctions").click(function(event){
//										  
//		event.stopPropagation();
//		
//	});
//	
//	$("#menubar_other_co").click(function(event){
//										  
//		event.stopPropagation();
//		
//	});

	$("#dd_search").click(function(event){
										  
		event.stopPropagation();
		
	});
	
	$("#dd_auctions").click(function(event){
										  
		event.stopPropagation();
		
	});
	
	$(".auch_sched").click(function(event){
										  
		event.stopPropagation();
		
	});
	
	$(".auch_lots").click(function(event){
										  
		event.stopPropagation();
		
	});
	
	$('div.networkDropDown> h1').click(function() {
		var $nextDiv = $(this).next();
		var $visibleSiblings = $nextDiv.siblings('div:visible');
		
		if ($visibleSiblings.length ) {
		  $visibleSiblings.slideUp('fast', function() {
			$nextDiv.slideToggle('fast');
		});
		  
		} else {
		   $nextDiv.slideToggle('fast');
		}
		
	});
	
	$('div.networkDropDown> a').click(function() {
		var $nextDiv = $(this).next();
		var $visibleSiblings = $nextDiv.siblings('div:visible');
		
		if ($visibleSiblings.length ) {
		  $visibleSiblings.slideUp('fast', function() {
			$nextDiv.slideToggle('fast');
		});
		  
		} else {
		   $nextDiv.slideToggle('fast');
		}
		
	});

});
