// **************************************************
// Desarrollado por Manuel Guerrero [Manoloweb]
// Email de contacto: mg@ideasfreelance.com
// TODOS LOS DERECHOS De los niños del mundo
// son mas importantes que pretender proteger
// mis lineas de código. Usalas a tu antojo!!
// **************************************************
// NOTAS DE IMPLEMENTACION:
// Probado en IE5, 5.5 y 6
// Firefox, Mozilla y Opera
// ***************************************************


function porId (ele) {
	resultado = new Array();
	if (elemento = document.getElementById(ele)) {
		resultado[0] = elemento;
	}
	return resultado;
}

function porTag(tag,clase,contenedor) {
	tag = tag || "*";
	cont = document.getElementById(contenedor) || document;

	temp = cont.getElementsByTagName(tag);
	if (clase=="") {
		return temp;
	}
	resultado = new Array();
	total = temp.length;
	contador = 0;
	for (i=0;i<total;i++) {
		if (temp[i].className.indexOf(clase)!=-1) {
			resultado[contador] = temp[i];
			contador++;
		}
	}
	return resultado;
}

function estilo(elems,propiedades) {
	tempProp = propiedades.split(";");
	cuantasProp = tempProp.length;
	props = new Array();
	vals = new Array();
	for (i=0;i<cuantasProp;i++) {
		separa = tempProp[i].split(":");
		props[i] = separa[0];
		vals[i] = separa[1];
	}
	cuantosElem = elems.length;
	for (j=0;j<cuantosElem;j++) {
		for (i=0;i<cuantasProp;i++) {
			cambia(elems[j],props[i],vals[i]);
		}
	}
}

function cambia(ele,prop,valor) {
	switch (prop) {
		case "color":
		ele.style.color = valor;
		break;
		case "background-color":
		ele.style.backgroundColor = valor;
		break;
		case "background-image":
		ele.style.backgroundImage = valor;
		break;
		case "background-position":
		ele.style.backgroundPosition = valor;
		break;
		case "background-repeat":
		ele.style.backgroundRepeat = valor;
		break;
		case "border":
		ele.style.border = valor;
		break;
		case "border-bottom":
		ele.style.borderBottom = valor;
		break;
		case "border-top":
		ele.style.borderTop = valor;
		break;
		case "border-left":
		ele.style.borderLeft = valor;
		break;
		case "border-right":
		ele.style.borderRight = valor;
		break;
		case "margin":
		ele.style.margin = valor;
		break;
		case "padding":
		ele.style.padding = valor;
		break;
		case "font-weight":
		ele.style.fontWeight = valor;
		break;
		case "font-size":
		ele.style.fontSize = valor;
		break;
		case "font-family":
		ele.style.fontFamily = valor;
		break;
		case "text-align":
		ele.style.textAlign = valor;
		break;
		case "text-decoration":
		ele.style.textDecoration = valor;
		break;
		case "position":
		ele.style.position = valor;
		break;
		case "top":
		ele.style.top = valor;
		break;
		case "left":
		ele.style.left = valor;
		break;
		case "display":
		ele.style.display = valor;
		break;
		case "visibility":
		ele.style.visibility = valor;
		break;
		case "z-index":
		ele.style.zIndex = valor;
		break;
		case "width":
		ele.style.width = valor;
		break;
		case "height":
		ele.style.height = valor;
		break;
		case "overflow":
		ele.style.overflow = valor;
		break;
		case "href":
		ele.href = valor;
		break;
	}
	return;
}

function estiloId(elemid,propiedades) {
	elems = porId(elemid);
	estilo(elems,propiedades);
}

function estiloTag(tag,clase,contenedor,propiedades) {
	elems = porTag(tag,clase,contenedor);
	estilo(elems,propiedades);
}

function mw(Sec) {
	Seccion = new String(Sec);
	Liga = "m_" + Seccion;
	estiloTag('a','m_share','menu','background-position:top left;href:#top;color:#444444;font-weight:normal');
	estiloId(Liga,'background-position:right top;color:#ffffff;font-weight:bold');
	estiloTag('div','share','contenido','display:none');
	estiloId(Seccion,'display:block');
}

window.onload = function() {
	mw("todo");

}

function openW(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
