// duneland sidebox  
// modified from http://www.learningjquery.com/2008/02/simple-effects-plugins

jQuery.fn.blindToggle = function(speed, easing, callback) {
  var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom'));
  return this.animate({marginTop: parseInt(this.css('marginTop')) <0 ? 0 : -h}, speed, easing, callback);
};

/*
var hide_weatherbox = document.getElementById("weatherbox");
hide_weatherbox.style.display = "none";

var hide_trafficbox = document.getElementById("trafficbox");
hide_trafficbox.style.display = "none";

var hide_beachbox = document.getElementById("beachbox");
hide_beachbox.style.display = "none";

var hide_roadbox = document.getElementById("roadbox");
hide_roadbox.style.display = "none";
*/

$(document).ready(function() {

/*


	$('#roadbox-outer').css("display","inline");

*/

  var $weatherbox = $('#weatherbox')
 .wrap('<div id="weatherbox-outer"></div>');
  $('#weatherbox-outer').addClass("hidden").hide('fast');
 
  var $trafficbox = $('#trafficbox')
 .wrap('<div id="trafficbox-outer"></div>'); 
  $('#trafficbox-outer').addClass("hidden").hide('fast'); 
  
  var $beachbox = $('#beachbox')
 .wrap('<div id="beachbox-outer"></div>'); 
  $('#beachbox-outer').addClass("hidden").hide('fast');  
  
  var $roadbox = $('#roadbox')
 .wrap('<div id="roadbox-outer"></div>'); 
  $('#roadbox-outer').addClass("hidden").hide('fast');     
 
 
  $('#weather').click(function() {

  	$('#trafficbox-outer').addClass("hidden").hide('fast');
	$('#beachboxbox-outer').addClass("hidden").hide('fast');	
	$('#roadbox-outer').addClass("hidden").hide('fast');	  
	

	
	 $weatherbox.blindToggle('slow');
	  $('#weatherbox-outer').slideToggle("slow").toggleClass("hidden");
  });
  
  $('#traffic').click(function() {
  
    $('#weatherbox-outer').addClass("hidden").hide('fast');
	$('#beachbox-outer').addClass("hidden").hide('fast');
	$('#roadbox-outer').addClass("hidden").hide('fast');	
	
	
	 $trafficbox.blindToggle('slow');
  	$('#trafficbox-outer').slideToggle("slow").toggleClass("hidden");
  }); 
  
  
  $('#beach').click(function() {
  
    $('#weatherbox-outer').addClass("hidden").hide('fast');
	$('#trafficbox-outer').addClass("hidden").hide('fast');
	$('#roadbox-outer').addClass("hidden").hide('fast');	
	
	 $beachbox.blindToggle('slow');
  	$('#beachbox-outer').slideToggle("slow").toggleClass("hidden");
  });   
     
  
  $('#road').click(function() {
  
    $('#weatherbox-outer').addClass("hidden").hide('fast');
	$('#trafficbox-outer').addClass("hidden").hide('fast');
	$('#beachbox-outer').addClass("hidden").hide('fast');	
	
	 $roadbox.blindToggle('slow');
  	$('#roadbox-outer').slideToggle("slow").toggleClass("hidden");
  }); 
  
});
