//addEvent(window,"load",initDropShadow);


var clone_i = 0;
var sub_open = '';

function initDropShadow() {
    /*
	if (!document.createElement) return;
    
    // Sigh, IE doesn't do getElementsByTagName("*")
    if (document.all) {
        var els = document.all;
    } else {
        var els = document.getElementsByTagName("*");
    }
    for (i=0;i<els.length;i++) {
        if ((' '+els[i].className+' ').indexOf(' dropshadow ') != -1) {
            DS_process(els[i])
        }
    }
	
		
				$("div#panel").animate({ height: "400px" }); $("div.panel_button").toggle();
				
				$("div#panel").animate({height: "0px"});
				
	*/

	jQuery('.menubar .mainmenu li a').each(
		
		function() { 
		
			clone_i++;
			el = jQuery(this);
			el_id = el.attr('id');
			has_sub = jQuery('#sub_'+el_id).length;
			print_f = '';				
			el_li = jQuery(el.parent());
			el.clone().attr('id', 'ds_' + el_id).removeClass("dropshadow").addClass("shadowed").prependTo(el_li);
			jQuery('#ds_' + el_id).click(function() { 		
				v = jQuery(this).next('a').attr('id');
				if(sub_open && sub_open != '#sub_'+v) jQuery(sub_open).hide();
				jQuery('#sub_'+v).toggle();
				//alert(jQuery('#s_background').height());
				//if(jQuery('#s_background').height() != 23) jQuery('#s_background').slideToggle("250,"); 
				sub_open = '#sub_'+v;
			});
			jQuery('#ds_' + el_id).css( { "left": (this.offsetLeft - 2) + "px", "top":'0px' } );
		}		
		//function(){jQuery(this).DS_process(this)}
	);
	//jQuery('.menubar .mainmenu li').DS_process(this);
	//alert(jQuery('.menubar .mainmenu li').length);
}

function DS_process(e) {
	//alert('dd');
    // Make a duplicate of this element, with all its subelements
    var nel = e.cloneNode(1);
    // Set its class to shadowed
    nel.className = "shadowed";
    nel.className += e.className.replace('dropshadow','');
    // Set floating text colour
    textColour = e.getAttribute("textColour");
    if (textColour) nel.style.color = textColour;
    textColor = e.getAttribute("textColor");
    if (textColor) nel.style.color = textColor;
    // Add it to the document
    e.parentNode.insertBefore(nel,e);
   i++;
    nel.style.top = (e.offsetTop - 1) + "px";
    nel.style.left = (e.offsetLeft - 2) + "px";
}
/*
function addEvent(obj, evType, fn) {
  // adds an eventListener for browsers which support it
  //  Written by Scott Andrew: nice one, Scott 
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, false);
    return true;
  } else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
	return false;
  }
}

*/