function mostrardiv() {
	document.write("<div id=\"flotante\"><a href=\"javascript:cerrardiv();\">Cerrar</a></div>");
}

function cerrardiv() {
	div = document.getElementById('flotante');
	div.style.display="none";
}
function posicionar(nombreElemento){
		var obj = document.getElementById(nombreElemento);
		var Tamanyo=[0,0];
		
	    if (typeof window.innerWidth != 'undefined'){
			Tamanyo = [window.innerWidth,window.innerHeight];
	  		var Temp=Tamanyo[0];
			Tamanyo[0]=(Temp/2)-150;
			
		}
		else {
			Tamanyo = [
        		document.getElementsByTagName('body')[0].clientWidth,
        		document.getElementsByTagName('body')[0].clientHeight
    		];
			var Temp=Tamanyo[0];
			Tamanyo[0]=(Temp/2)-150;
		}
	    obj.style.left=Tamanyo[0]+"px";/*"200px";*/
}


function obtenerObjetos()
{
	document.InnerNTML 
}
function Mueve()
{
	if (Abajo){
		Seccion.top='5m';
	}
	else {
		Seccion.top='2m';
	}
	Abajo=!Abajo;
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
 	var arVersion = navigator.appVersion.split("MSIE")
 	var version = parseFloat(arVersion[1])
 	if ((version >= 5.5) && (document.body.filters))
 	{
 		for(var i=0; i<document.images.length; i++)
 		{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				 var imgID = (img.id) ? "id='" + img.id + "' " : ""
				 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				 var imgStyle = "display:inline-block;" + img.style.cssText
				 if (img.align == "left") imgStyle = "float:left;" + imgStyle
				 if (img.align == "right") imgStyle = "float:right;" + imgStyle
				 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				 var strNewHTML = "<span " + imgID + imgClass + imgTitle
					+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
					+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
					+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
				img.outerHTML = strNewHTML
				i = i-1
 			}
 		}
 	}
}

startList = function() {	// Propiedad li:over IE6
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("lista-menu");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() { this.className+=" over"; }
				node.onfocus=function() { this.className+=" over"; }
			  	node.onmouseout=function() { this.className=this.className.replace(" over", ""); }
			  	node.onblur=function() { this.className=this.className.replace(" over", ""); }
			}
	  	}
	}
}


function openTargetBlank(e){	// target=_blank
   var className = 'externo';
   if (!e) var e = window.event;
   var clickedObj = e.target ? e.target : e.srcElement;
   if(clickedObj.nodeName == 'IMG' )  { clickedObj=clickedObj.parentNode; }	 // Imagenes con enlace
   if(clickedObj.nodeName == 'A' ) {
      r=new RegExp("(^| )"+className+"($| )");
      if(r.test(clickedObj.className)){ window.open(clickedObj.href); return false; }
    }
}

															// Funciones para formalarios
function limpia_error_form(objeto){ objeto.style.color='#000'; document.getElementById('resultado_formulario').innerHTML=''; }
function desactiva_elemento(elemento){ elemento.style.visibility='hidden'; elemento.disabled='disabled'; }


function valida_campos(tipo, cadena) {
	var expresion;
	switch(tipo){
		case 'telefono': expresion = /^([0-9\s\+\-]{4,12}$)/; break;			
		case 'correo': expresion = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/;	break;			
		case 'asignatura': expresion = /^([0-9]{2,12}$)/; break;
		case 'codigoAsignatura': expresion = /^([0-9]{4,12}$)/; break;
		default: if (cadena.length>0) { return true; } else { return false; }
	}
	if (expresion.test(cadena))  { return true; } else { return false; }
}
				

/*window.onload=inicializa_web;*/
document.onclick = openTargetBlank;
window.onscroll =function (evt) { inicializa_menu_flotante() };
