/**
* Funciones para sombras en el header
*
* @category	   javscript
* @package     scripts.js
* @author      Pedro Damian Meza Herrera <pmeza@rednaranja.com>
* @copyright   2007 Pedro Damian Meza Herrera
* @version     scripts.js,v 1 2007/Junio
* @license     Uso autorizado para sitio web  graylineloscabos de Paulino Estevez
* @link        http://rednaranja.com
*/



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])
		}
	}
}

function DS_process(e) {
	// 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 + 2) + "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;
  }
}


/* This simple JavaScript rewrites the hovers as mouseover events,
and works for all versions of IE/Win 5x and 6x. Much thanks to Patrick Griffiths
and Dan Webb, whose “Suckerfish Dropdowns” got me started with CSS-based menu systems.
Their snippet of JavaScript looks like this:
 */

startList = function() {
//function startList() {
	if (document.all && document.getElementById) { //only IE and if getElementById is available
		navRoot = document.getElementById("menuul");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
					}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
					}
				}

			}
	}
	initDropShadow();
}

addEvent(window,"load",initDropShadow);
addEvent(window,"load",startList);

//window.onload=startList;