// JavaScript Document
replaceImageBorders = function () {
	imgEls = $$('.imgborder');
	for (i = 0; i < imgEls.length;i++) {
		try {
			imgEl = imgEls[i];
			imgWidth = imgEl.offsetWidth;
			imgHeight = imgEl.offsetHeight;
			imgAlign = imgEl.getAttribute('align');
			divEl = document.createElement('DIV');
			Element.extend(divEl);
			divEl.setStyle({
				position: 'relative',
				height : imgHeight + 'px',
				width : imgWidth + 'px',
				cssFloat : imgAlign,
				display: 'inline-block'
			});
			divEl.toggleClassName('borderRed');
			imgEl.parentNode.replaceChild(divEl, imgEl);

			/** border-top **/
			divBorderTop = document.createElement('DIV');
			Element.extend(divBorderTop);
			divBorderTop.toggleClassName('border-top')
			divTopLeft = document.createElement('DIV');
			Element.extend(divTopLeft);
			divTopLeft.toggleClassName('top-left')
			divTopRight = document.createElement('DIV');
			Element.extend(divTopRight);
			divTopRight.toggleClassName('top-right')

			/** border-bottom **/
			divBorderBottom = document.createElement('DIV');
			Element.extend(divBorderBottom);
			divBorderBottom.toggleClassName('border-bottom')
			divBottomLeft = document.createElement('DIV');
			Element.extend(divBottomLeft);
			divBottomLeft.toggleClassName('bottom-left')
			divBottomRight = document.createElement('DIV');
			Element.extend(divBottomRight);
			divBottomRight.toggleClassName('bottom-right')

			/** border-inner the image **/
			divBorderInner = document.createElement('DIV');
			Element.extend(divBorderInner);
			divBorderInner.toggleClassName('border-inner');
			divBorderInner.appendChild(imgEl);
			divBorderInner.setStyle({
				height : imgHeight + 'px',
				width : imgWidth + 'px'
			});
			/** adding de divs **/
			divBorderTop.appendChild(divTopLeft);
			divBorderTop.appendChild(divTopRight);
			divBorderBottom.appendChild(divBottomLeft);
			divBorderBottom.appendChild(divBottomRight);
			divEl.appendChild(divBorderTop);
			divEl.appendChild(divBorderInner);
			divEl.appendChild(divBorderBottom);
			divEl.style.float = 'right';
		} catch (err) {};
		
	}
}

startList = function() {
        var sfEls = document.getElementById("left_menu").getElementsByTagName("LI");
        for (i=0; i<sfEls.length; i++) {
            node = sfEls[i];
            if (node.nodeName=="LI") {
                node.onmouseover=function() {
                    Element.extend(this);
                    if (!this.hasClassName('inline')) {
                    	this.addClassName('sfhover');
                    }
                }
                node.onmouseout=function() {
                    Element.extend(this);
                	if (!this.hasClassName('inline')) {
                		this.removeClassName ('sfhover');
                	}
                }
            }
        }
    /*if (document.all&&document.getElementById) {
        var sfEls = document.getElementById("left_menu").getElementsByTagName("LI");
        for (i=0; i<sfEls.length; i++) {
            liNode = sfEls[i];
			aNode = liNode.firstChild;
			liNode.style.height=aNode.offsetHeight + 'px';
        }
    }*/
}
document.observe("dom:loaded", function() {
		startList();
	});



