
(function($) {
 $.fn.borders = function(){
	 return this.each(function() { 
		 $(this).replaceWith('<div class=\"ds-outer\"><div class=\"ds-tl\"><\/div><div class=\"ds-tr\"><\/div><div class=\"ds-mm\"><div class=\"ds-tm\"><\/div><div class=\"ds-ml\"><div class=\"ds-mr\"><ul>'+$(this).html()+'<\/ul><\/div><\/div><div class=\"ds-bm\"><\/div><\/div><div class=\"ds-bl\"><\/div><div class=\"ds-br\"><\/div><\/div>');
		 });
	 };
})(jQuery);

// jquery plugin function to preload images (used for dropshadows)	
jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}
		
		
//preload and draw borders		
$(document).ready(function(){
	$.preloadImages(
		siteroot + "images/menu-shadows/b.png",
		siteroot + "images/menu-shadows/bl.png",
		siteroot + "images/menu-shadows/br.png",
		siteroot + "images/menu-shadows/t.png",
		siteroot + "images/menu-shadows/tl.png",
		siteroot + "images/menu-shadows/tr.png",
		siteroot + "images/menu-shadows/l.png",
		siteroot + "images/menu-shadows/r.png",
		siteroot + "images/menu-shadows/b.gif",
		siteroot + "images/menu-shadows/bl.gif",
		siteroot + "images/menu-shadows/br.gif",
		siteroot + "images/menu-shadows/t.gif",
		siteroot + "images/menu-shadows/tl.gif",
		siteroot + "images/menu-shadows/tr.gif",
		siteroot + "images/menu-shadows/l.gif",
		siteroot + "images/menu-shadows/r.gif");
	$("#headerNav ul ul li ul").not("#headerNav ul ul ul li ul").borders();
});
	

// menu rollovers
$(document).ready(function(){
$("#headerNav ul ul li").not("#headerNav ul ul ul li").hover( 
	function(){
		$(this).children('div').show();
		$(this).addClass('expander');
	},
	function (){
		$(this).children('div').hide();
		$(this).removeClass('expander');
	});	
});
	
$(document).ready(function() {
	$("div.scrollable").scrollable({
		size: 3,
		items: '#panes',  
		hoverClass: 'hover'
  }); 
});
