/**
*Funcion que coloca a la mitad un elemento dentro de la ventana 
*/
function PosicionMitad(ventana1,ventana2){
	try{
		var h = document.getElementById(ventana1).offsetHeight;
		var w = document.getElementById(ventana1).offsetWidth; 
		var hh = document.getElementById(ventana2).offsetHeight;
		var ww = document.getElementById(ventana2).offsetWidth;
		var posh = (parseInt(hh)/2) - (parseInt(h)/2); 
		var posw = (parseInt(ww)/2) - (parseInt(w)/2);
		document.getElementById(ventana1).style.marginTop=parseInt(posh)+'px';
		document.getElementById(ventana1).style.marginLeft=parseInt(posw)+'px';
	}catch(e){
		alert ("fx-PosicionMitad"+e);
	}
} 
/**
*Funcion que reduce el tamaño de la imagen en caso de ser mayor al tamaño de la ventana 
*/
function MideImagen(ventana1,ventana2){
	try{
		var h = document.getElementById(ventana1).offsetHeight;
		var w = document.getElementById(ventana1).offsetWidth;
		var hh = document.getElementById(ventana2).offsetHeight;
		var ww = document.getElementById(ventana2).offsetWidth;
		if(h>w){
			if(h>hh){
				document.getElementById(ventana1).style.height=hh+'px';  
			} 
		}else{
			if(w>ww){ 
				document.getElementById(ventana1).style.width=ww+'px';   
			}
		}
	}catch(e){
		alert ("fx-MideImagen"+e);
	}
}
/**
*Funcion que coloca los botones del home 
*/
function PosicionMitadHome(ventana1,ventana2){
	try{
		var h = document.getElementById(ventana1).offsetHeight;
		var w = document.getElementById(ventana1).offsetWidth; 
		var hh = document.getElementById(ventana2).offsetHeight;
		var ww = document.getElementById(ventana2).offsetWidth;
		var posh = (parseInt(hh)/2) - (parseInt(h)/2) ; 
		var posw = (parseInt(ww)/2) +  ((parseInt(ww)/2) / 2) / 2;
		document.getElementById(ventana1).style.marginTop=parseInt(posh)+'px';
		document.getElementById(ventana1).style.marginLeft=parseInt(posw)+'px';
	}catch(e){
		alert ("fx-PosicionMitad"+e);
	}
} 
/**
*Cambia botones menus
*/
function CambiarImagen(v1,v2,v3){
	try{
		document.getElementById('imgMP'+v1).src = 'img/'+v2+'_'+v3+'.png';
		/*Si esta en un modulo activo seleccionar ese modulo */
		var oa = document.getElementById('txtOpAct').value;
		if(oa == v1){
			document.getElementById('imgMP'+v1).src = 'img/'+v2+'_2.png'; 
		}
	}catch(e){
		alert("fx-"+e);
	}
}
/**
*Cambia botones menus izquierdo 
*/
function CambiarImagenMI(v1,v2,v3){
	try{
		document.getElementById('imgMID'+v1).src = 'img/'+v2+'_'+v3+'.png';
		/*Si esta en ujn modulo activo seleccionar ese modulo */
		var oa = document.getElementById('txtOpAct1').value;
		if(oa == v1){
			document.getElementById('imgMID'+v1).src = 'img/'+v2+'_2.png'; 
		}
	}catch(e){ 
		alert("fx-"+e);
	}
}
/**
*Cambia botones menus izquierdo 
*/
function CambiarImagenMR(v1,v2,v3){
	try{
		document.getElementById('imgMIR'+v1).src = 'img/'+v2+'_'+v3+'.png';
		/*Si esta en ujn modulo activo seleccionar ese modulo */
		var oa = document.getElementById('txtOpAct2').value;
		if(oa == v1){
			document.getElementById('imgMIR'+v1).src = 'img/'+v2+'_2.png'; 
		}
	}catch(e){ 
		alert("fx-"+e);
	}
}
/**
*Abre links 
*/ 
function Ejecutar(url,te,url1){//Url a a brir, Tipo de enlace 
	//alert (url);
	if(te==1){
		if(url1=="index2") window.location = "index2";
		else window.location = url; 
	}else if(te==2){
		var bob=window.open(url,'_blank');
		bob.location=url1;
	}else if(te==3){
		
	}
}
/**
*Buscar categoria
*/
function BuscarCategoria(buscar,pag,typ){ 
	/*buscar = base64_encode(buscar);*/  
	window.location = 'archivo.php?pag='+pag+'&typ='+typ+'&sea='+buscar;  
}
/*
*Equivalente a encode de PHP 
*/ 
function base64_encode (data) {
    // Encodes string using MIME base64 algorithm  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/base64_encode    // +   original by: Tyler Akins (http://rumkin.com) 
    // +   improved by: Bayron Guevara
    // +   improved by: Thunder.m
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Pellentesque Malesuada    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: utf8_encode
    // *     example 1: base64_encode('Kevin van Zonneveld');
    // *     returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
    // mozilla has this native    // - but breaks in 2.0.0.12!
    //if (typeof this.window['atob'] == 'function') {
    //    return atob(data);
    //} 
            var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = [];
  
    if (!data) {
        return data;    }
  
    data = this.utf8_encode(data+'');
    
    do { // pack three octets into four hexets        o1 = data.charCodeAt(i++);
        o2 = data.charCodeAt(i++);
        o3 = data.charCodeAt(i++); 
 
        bits = o1<<16 | o2<<8 | o3;  
        h1 = bits>>18 & 0x3f;
        h2 = bits>>12 & 0x3f;
        h3 = bits>>6 & 0x3f; 
        h4 = bits & 0x3f;  
        // use hexets to index into b64, and append result to encoded string
        tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
    } while (i < data.length); 
        enc = tmp_arr.join('');
    
    switch (data.length % 3) { 
        case 1:
            enc = enc.slice(0, -2) + '==';        break;
        case 2:
            enc = enc.slice(0, -1) + '=';
        break;
    }  
    return enc;
}
 
function utf8_decode ( str_data ) { 
    // Converts a UTF-8 encoded string to ISO-8859-1  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/utf8_decode    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +      input by: Aman Gupta
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Norman "zEh" Fuchs
    // +   bugfixed by: hitwork    // +   bugfixed by: Onno Marsman
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'    var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;
    
    str_data += '';
    
    while ( i < str_data.length ) {        c1 = str_data.charCodeAt(i);
        if (c1 < 128) {
            tmp_arr[ac++] = String.fromCharCode(c1);
            i++;
        } else if ((c1 > 191) && (c1 < 224)) {            
        		c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    } 
    return tmp_arr.join('');
}


function utf8_encode ( string ) {
    // Encodes an ISO-8859-1 string to UTF-8  
    // 
    // version: 1006.1915
    // discuss at: http://phpjs.org/functions/utf8_encode    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: sowberry
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman    // +   improved by: Yves Sucaet
    // +   bugfixed by: Onno Marsman
    // +   bugfixed by: Ulrich
    // *     example 1: utf8_encode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'    var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
 
    var utftext = "";
    var start = 0;
    var end = 0; 
    var stringl = 0; 
    start = 0;
    end = 0; 
    var stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);        
        var enc = null; 
        if (c1 < 128) {
            end++;
        } else if (c1 > 127 && c1 < 2048) {            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc !== null) {            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;        }
    }
 
    if (end > start) {
        utftext += string.substring(start, string.length);    }
 
    return utftext;
}
function AbreRegistro()
{
	try{
		document.getElementById('capa1').style.display='block';
		document.getElementById('todo').style.display='block';
		LimpiarRegistro();
		generaMitad('capa1','#CCCCCC','100',0); 
		generateCoverDiv('todo','#333333','80');
		document.getElementById('txtmailreg').focus(); 
	}catch(e){
    	alert("fx-AbreRegistro: "+e); 
   } 
}
/*
*
*/
function LimpiarRegistro(){
	try{
		document.getElementById('txtmailreg').value='';
		document.getElementById('txtclavereg').value='';
		document.getElementById('txtNombrereg').value='';
		document.getElementById('txtApereg').value='';
		document.getElementById('txteMailreg').value='';
		document.getElementById('txtPasreg').value=''; 
		document.getElementById('txtCPasreg').value='';
		document.getElementById('txtSexRegH').checked=false;
		document.getElementById('txtSexRegM').checked=false;
		document.getElementById('txtSelcDiaRec').options[0].selected = true;
		document.getElementById('txtSelcMesRec').options[0].selected = true;
		document.getElementById('txtSelcAxoRec').options[0].selected = true; 
		document.getElementById('txtSelcPaisRec').options[0].selected = true;
		document.getElementById('txtSelcOcupacion').options[0].selected = true;
		 
	}catch(e){
    	alert("fx-LimpiarRegistro: "+e); 
   } 
}
/*
*
*/ 
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


/*
*Genera la mitad del mensajeador del tablero 
*/
function generaMitad(id, color, opacity,tipo){
	try{
		var navegador=1;
		//alert(BrowserDetect.browser); 
   	if(navigator.userAgent.indexOf("MSIE")>=0) navegador=0;
	   /*var layer=document.createElement('div');*/
	   /*layer.id=id;*/
	   layer=document.getElementById(id); 
	   if(id=="capa11"){
	   	var W=450;
	   	var H=parseInt(layer.style.height);//380;   
	   	var W1 = W / 2; 
	   	var H1 = H / 2; 
	   }else if(id=="capa3"){  
	   	var W=350;
	   	if(BrowserDetect.browser=="Chrome") var H=600; 
	   	else var H=580;     
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
	   }else if(id=="capa1"){  
	   	var W=348;   
	   	var H=725; 
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
	    }else if(id=="capa5"){  
	   	var W=505;   
	   	var H=405;   
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
	   	
	   }else{ 
      	var W=350;
	   	var H=270;   
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		// INCREMENTO EN POSICIÓN ABIERTA SUPERIOR A LO PERMITIDO POR DIA.
		if(tipo==11){
			var W=680; 
	   	var H=370;  
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		if(id=="capaOlvido"){  
			var W=350;
	   	var H=300;   
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		if(id=="capaCambiar"){  
			var W=350;
	   	var H=370;   
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		// INCREMENTO EN POSICIÓN ABIERTA SUPERIOR A LO PERMITIDO POR DIA.
		if(tipo==5){
			var W=550;   
	   	var H=180;
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		//si es mensaje de sancion mas grande 6 en adelante 
		if(tipo==44){
			var W=680;   
	   	var H=355;
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		if(tipo==43){
			var W=680;   
	   	var H=380;
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		//Compra fondo 
		if(tipo==2){
			var W=350;
	   	var H=225;
	   	var W1 = W / 2;
	   	var H1 = H / 2;
		}
		//Compra trader 
		if(tipo==22){ 
			var W=350;
	   	var H=180;
	   	var W1 = W / 2;
	   	var H1 = H / 2;
		}
		//VENTA CORTA EN FONDO excede 250 mill 
		if(tipo==6){
			var W=550;   
	   	var H=180;
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		//VENTA CORTA EN FONDO excede 250 mill 
		if(tipo==7){
			var W=600;     
	   	var H=250;
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		//ventana de 66% 
		if(tipo==77){
			var W=600;     
	   	var H=300; 
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
		}
		//castigos 
		if(tipo==8){ 
			var W=680; 
	   	var H=290;  
	   	var W1 = W / 2; 
	   	var H1 = H / 2; 
		}
		if(tipo==9){ 
			var W=680; 
	   	var H=310;   
	   	var W1 = W / 2; 
	   	var H1 = H / 2; 
		}
		layer.style.width=W+'px';   
		layer.style.height=H+'px';
		/*layer.style.backgroundColor='#ECF0A0';*/  
     	layer.style.position='absolute';
     	
     	//alert ("posix: "+posix);
     	var posi = 0;
     	if(window.pageYOffset){
     		posi = window.pageYOffset; 
     	}else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
     		posi = document.documentElement.scrollTop;
     	}else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			posi = document.body.scrollTop;
		
     	}
      //alert ("posi: "+posi);  
      //altox=screen.height;
     	//alert (""+altox);
     	if (window.innerHeight){
			//navegadores basados en mozilla
			alto=window.innerHeight;  
		}else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			alto = document.documentElement.clientHeight;
		}else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			 alto = document.body.clientHeight; 
		}
      //alert (layer.style.height); 
     	dif = parseInt(alto)-parseInt(layer.style.height);
      //alert ("dif: "+dif);
     	nv = parseInt(dif/2) + parseInt(posi); 
     	//alert ("v12:"+nv);
     	if(nv < 0) nv = 0;
     	layer.style.top=parseInt(nv) + 'px'; 
     	//layer.style.top=parseInt((document.body.offsetHeight/2))+pos+'px';   
     	layer.style.left=parseInt((document.body.offsetWidth/2)-W1)+'px'; 
    	layer.style.zIndex=101;
    	if(navegador==0) layer.style.filter='alpha(opacity='+opacity+')';
	   else layer.style.opacity=opacity/100;
		document.body.appendChild(layer);
    }catch(e){
    	alert("fx-generaMitad: "+e);
    } 
} 
/*
*Mensjaes para el tablero 
*/
function generateCoverDiv(id, color, opacity)
{
	try{
		var navegador=1;
		if(navigator.userAgent.indexOf("MSIE")>=0) navegador=0;
		var layer=document.getElementById(id); 
		layer.style.width=document.body.offsetWidth+'px'; 
		layer.style.height=parseFloat(document.body.offsetHeight)+'px'; 
		layer.style.backgroundColor=color; 
		layer.style.position='absolute'; 
		layer.style.top=0;
		layer.style.left=0;
		layer.style.zIndex=100;
		if(navegador==0) layer.style.filter='alpha(opacity='+opacity+')';
		else layer.style.opacity=opacity/100; 
		document.body.appendChild(layer);
	}catch(e){
    	alert("fx-generateCoverDiv: "+e);
    }
}
/*
*Borra datos de registro
*/
function BorrarDatosReg(){
	try{
		document.getElementById('txtNombrereg').value='';
		document.getElementById('txtApereg').value='';
		document.getElementById('txteMailreg').value='';
		document.getElementById('txtPasreg').value='';
		document.getElementById('txtCPasreg').value='';
		document.getElementById('txtSexRegH').checked=false;
		document.getElementById('txtSexRegM').checked=false;     
		document.getElementById('txtSelcDiaRec').value='';
		document.getElementById('txtSelcMesRec').value=''; 
		document.getElementById('txtSelcAxoRec').value='';
		document.getElementById('txtSelcPaisRec').value='';
	}catch(e){
    	alert("fx-BorrarDatosReg: "+e);
   }
}
/*
*Logeo  para los usuarios
*/
function Logeo(cor,cla,exp){ 
	try{
		if(exp == "ie") AJAXLogin('LOGEO1.php','cor='+cor+'&cla='+cla,'','capaReg',exp);
		else AJAXLogin('LOGEO.php','cor='+cor+'&cla='+cla,'','capaReg',exp);
	}catch(e){
    	alert("fx-Logeo: "+e);
   }
}
/*
*Objeto para conexion sincronizacion profesor genera calculos 
*/
function AJAXLogin1(file){ 
  var xmlhttp=false;
  try{
  this.AjaxFailedAlert = "PP";
  }catch(e){} 
  this.requestFile = file;
  this.encodeURIString = true;
  this.execute = false;
  if (window.XMLHttpRequest){ 
    this.xmlhttp = new XMLHttpRequest();
    if (this.xmlhttp.overrideMimeType){
      this.xmlhttp.overrideMimeType('text/xml');
    }
  }else if (window.ActiveXObject){ // IE
    try{
      this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        this.xmlhttp = null;
      }
    }
    if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
      this.xmlhttp = new XMLHttpRequest();
      if (!this.xmlhttp){
        this.failed = true; 
      } 
    } 
  }
  return this.xmlhttp ;
}
/*
*Syncroniza Profesor 
*/
function AJAXLogin(_pagina,valorget,valorpost,capa,ex){   
     //alert ('h1');
  var ajax=AJAXLogin1(_pagina);
  if(valorpost!=""){
    ajax.open("POST", _pagina+"?"+valorpost+"&tiempo="+new Date().getTime(),true);
  }else{
    ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  }
  ajax.onreadystatechange=function(){
    if (ajax.readyState==1){
      //document.getElementById(capa).innerHTML = "";//"<img src='GIF32.gif' align='center'> Aguarde por favor...";
    } 
    if (ajax.readyState==4) {
      if(ajax.status==200){ 
      	 if(ex == "ie") SetContainerHTML1(capa, ajax.responseText, true);   
          else SetContainerHTML(capa, ajax.responseText, true);    
      }else if(ajax.status==404){
        	try{
        	//capa.innerHTML = document.getElementById('txtM42').value;
        	}catch(e){}
      }else{
        	capa.innerHTML  = ajax.status;
      }
    }
  }
if(valorpost!=""){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(valorpost);  
  } else {
    	ajax.send(null);
  }
} 
/*
*Funcion que permite ejecutar codigo javascript dentro de ajax 
*/
function SetContainerHTML(id,html,processScripts)
{
	try{
     mydiv = document.getElementById(id);
     mydiv.innerHTML = html;
     if(processScripts!=false) 
     { 
     		var ii=0;
          var elementos = mydiv.getElementsByTagName('script');
          for(ii=0;ii<elementos.length;ii++) {
               var elemento = elementos[ii];
               nuevoScript = document.createElement('script');
               nuevoScript.text = elemento.innerHTML;
               nuevoScript.type = 'text/javascript';
               if(elemento.src!=null && elemento.src.length>0)
               {
                    nuevoScript.src = elemento.src;
               }
               elemento.parentNode.replaceChild(nuevoScript,elemento);
          }
     }
	}catch(e){
		alert ("id: "+id+" E: "+e);
	}
} 

function SetContainerHTML1(id,html,processScripts)
{
	try{
     mydiv = document.getElementById(id);
     mydiv.innerHTML = html;
     if(processScripts!=false) 
     { 
     		var ii=0;
          var elementos = mydiv.getElementsByTagName('code');
          for(ii=0;ii<elementos.length;ii++) { 
               var elemento = elementos[ii];
               nuevoScript = document.createElement('script');
               nuevoScript.text = elemento.innerHTML;
               nuevoScript.type = 'text/javascript';
               if(elemento.src!=null && elemento.src.length>0)
               {
                    nuevoScript.src = elemento.src;
               }
               elemento.parentNode.replaceChild(nuevoScript,elemento);
          }
     }
	}catch(e){
		alert ("id: "+id+" E: "+e);
	}
}

/*
*Cierra REgistro
*/
function CierraReg(){ 
	try{
		try{ 
    		document.getElementById("capa1").style.display="none";
			document.getElementById("todo").style.display="none";
		}catch(e){} 
		try{
    		document.getElementById("capa3").style.display="none"; 
			document.getElementById("todoCompartir").style.display="none"; 
		}catch(e){} 
		try{
    		document.getElementById('capaOlvido').style.display='none';   
			document.getElementById('todoOlv').style.display='none';
		}catch(e){}
		try{ 
    		document.getElementById('capaCambiar').style.display='none';  
			document.getElementById('todoCamb').style.display='none';
		}catch(e){}
	}catch(e){
		alert ("fx-CierraReg"+e);
	}
}
/*
*Agregar Registro de Usuario
*/
function AgregarRegistroUsuario(n,a,c,p,pc,s,d,m,y,pa,oc,ac){
	try{
    	if(p != pc){
    		document.getElementById("txtPasreg").value="";
			document.getElementById("txtCPasreg").value=""; 
			document.getElementById("txtPasreg").focus();
    		alert("¡CLAVE INCORRECTA!");
    		return false;
    	}
    	/**
    	*Valida campos obligatorios
    	*/
    	if(n=="" || n==" "){
    		alert("Favor de escribir su Nombre");
    		document.getElementById("txtNombrereg").focus();
    		return false;
    	}
    	if(c=="" || c==" "){
    		alert("Favor de escribir su Correo");
    		document.getElementById("txteMailreg").focus();
    		return false;
    	}
    	if(s=="" || s==" "){
    		alert("Favor de escribir su Sexo"); 
    		document.getElementById("txtSexReg1").focus();
    		return false;
    	}
		if(d=="" || d==" "){
    		alert("Favor de escribir su Dia de Nacimiento"); 
    		document.getElementById("txtSelcDiaRec").focus();
    		return false;
    	}
    	if(m=="" || m==" "){
    		alert("Favor de escribir su Mes de Nacimiento"); 
    		document.getElementById("txtSelcMesRec").focus();
    		return false;
    	}
    	if(y=="" || y==" "){
    		alert("Favor de escribir su Año de Nacimiento"); 
    		document.getElementById("txtSelcAxoRec").focus();
    		return false;
    	}
		if(p=="" || pa==" "){
    		alert("Favor de escribir su País");  
    		document.getElementById("txtSelcPaisRec").focus();
    		return false;
    	}
  		AJAXAgregaUsuario('AGREGAR_USUARIO.php','nom='+n+'&ape='+a+'&cor='+c+'&pas='+p+'&sex='+s+'&dia='+d+'&mes='+m+'&axo='+y+'&pai='+pa+'&ocu='+oc+'&tty=1&act='+ac,'','capaReg');
    	return false; 
	}catch(e){
		alert ("fx-AgregarRegistroUsuario"+e);
		return false; 
	}
}
/*
*Objeto para conexion sincronizacion profesor genera calculos 
*/
function AJAXAgregaUsuario1(file){ 
  var xmlhttp=false;
  try{
  this.AjaxFailedAlert = "PP";
  }catch(e){}
  this.requestFile = file;
  this.encodeURIString = true;
  this.execute = false;
  if (window.XMLHttpRequest){ 
    this.xmlhttp = new XMLHttpRequest();
    if (this.xmlhttp.overrideMimeType){
      this.xmlhttp.overrideMimeType('text/xml');
    }
  }else if (window.ActiveXObject){ // IE
    try{
      this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        this.xmlhttp = null;
      }
    }
    if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
      this.xmlhttp = new XMLHttpRequest();
      if (!this.xmlhttp){
        this.failed = true; 
      } 
    } 
  }
  return this.xmlhttp ;
}
/*
*Syncroniza Profesor 
*/
function AJAXAgregaUsuario(_pagina,valorget,valorpost,capa){  
     //alert ('h1');
  var ajax=AJAXAgregaUsuario1(_pagina);
  if(valorpost!=""){
    ajax.open("POST", _pagina+"?"+valorpost+"&tiempo="+new Date().getTime(),true);
  }else{
    ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  }
  ajax.onreadystatechange=function(){
    if (ajax.readyState==1){
      //document.getElementById(capa).innerHTML = "";//"<img src='GIF32.gif' align='center'> Aguarde por favor...";
    }  
    if (ajax.readyState==4) {
      if(ajax.status==200){ 
          SetContainerHTML1(capa, ajax.responseText, true);    
      }else if(ajax.status==404){
        	try{
        	//capa.innerHTML = document.getElementById('txtM42').value;
        	}catch(e){}
      }else{
        	capa.innerHTML  = ajax.status;
      }
    }
  }
if(valorpost!=""){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(valorpost);  
  } else {
    	ajax.send(null);
  }
} 
/**
*agregar comentarios BLOG
*/
function AgregarComentario(tipo,com,pag,typ,cat,art){ //Tipo de comentario, comentario, pagina, typ, categoria y articulo 
	/*buscar = base64_encode(buscar);*/    
	/*alert("Agredecemos su contribución En breve sera activado su comentario");*/ 
	if(tipo == 1) window.location = 'archivo.php?pag='+pag+'&typ='+typ+'&cat='+cat+'&art='+art+'&com='+com;
	if(tipo == 2) window.location = 'archivo.php?pag='+pag+'&typ='+typ+'&nnn='+cat+'&com='+com;
	if(tipo == 3) window.location = 'archivo.php?pag='+pag+'&typ='+typ+'&fbl='+art+'&com='+com;  //Fotoblog     
}
/*
*Agregar Contacto 
*/ 
function AgregarContacto(v1,v2,v3,v4,v5){
	try{ 
		if(v1 =="" || v1 == " "){
			alert("Es necesario escribir su nombre");
			document.getElementById("txtNombre").focus();
			return false;
		}
		if(v2 =="" || v2 == " "){ 
			alert("Es necesario un correo");
			document.getElementById("txtCorreo").focus();
			return false;
		} 
		if(v3 =="" || v4 == " "){
			alert("Es su Comentario");
			document.getElementById("txtComentario").focus();
			return false;
		} 
		document.getElementById("txtNombre").value=""; 
		document.getElementById("txtCorreo").value="";
		document.getElementById("txtComentario").value="";
    	AJAXAgregaContacto('AGREGAR_CONTACTO.php','nom='+v1+'&cor='+v2+'&com='+v3+'&tty=6','','capaCon');
    	alert("Contacto Registrado");   
    	return false;  
	}catch(e){
		alert ("fx-AgregarContacto"+e);
		return false; 
	}
}


/*
*Objeto para conexion sincronizacion profesor genera calculos 
*/
function AJAXAgregaContacto1(file){ 
  var xmlhttp=false;
  try{
  this.AjaxFailedAlert = "PP";
  }catch(e){}
  this.requestFile = file;
  this.encodeURIString = true;
  this.execute = false;
  if (window.XMLHttpRequest){ 
    this.xmlhttp = new XMLHttpRequest();
    if (this.xmlhttp.overrideMimeType){
      this.xmlhttp.overrideMimeType('text/xml');
    }
  }else if (window.ActiveXObject){ // IE
    try{
      this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        this.xmlhttp = null;
      }
    }
    if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
      this.xmlhttp = new XMLHttpRequest();
      if (!this.xmlhttp){
        this.failed = true; 
      } 
    } 
  }
  return this.xmlhttp ;
}
/*
*Syncroniza Profesor 
*/
function AJAXAgregaContacto(_pagina,valorget,valorpost,capa){  
     //alert ('h1');
  var ajax=AJAXAgregaContacto1(_pagina);
  if(valorpost!=""){
    ajax.open("POST", _pagina+"?"+valorpost+"&tiempo="+new Date().getTime(),true);
  }else{
    ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  }
  ajax.onreadystatechange=function(){
    if (ajax.readyState==1){
      //document.getElementById(capa).innerHTML = "";//"<img src='GIF32.gif' align='center'> Aguarde por favor...";
    }  
    if (ajax.readyState==4) {
      if(ajax.status==200){ 
          SetContainerHTML1(capa, ajax.responseText, true);    
      }else if(ajax.status==404){
        	try{
        	//capa.innerHTML = document.getElementById('txtM42').value;
        	}catch(e){}
      }else{
        	capa.innerHTML  = ajax.status;
      }
    }
  }
if(valorpost!=""){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(valorpost);  
  } else {
    	ajax.send(null);
  }
} 
/*
*Abre visor de fotos
*/ 
var arrstr = new Array();
var NR = 0;
var file = "";
var EntradaImagen ="";
function AbreFotosYoSoy(v1,v2,v3){
	try{ 
	
		var str=new String(v2);
		arrstr = str.split("|"); 
		NR = arrstr.length - 1; 
		//document.getElementById("capa11").style.backgroundColor = "#FF00FF"; 
		var nimafg = "";
		try{
		for(i=0;i<NR;i++){ 
			document.getElementById("IFot"+arrstr[i]).style.display = "none";
			//alert ("v: "+i+'=>'+arrstr[i]);
			//file = "Admon/imagenes/img"+v3+"/"+v1+".jpg";
			if(arrstr[i]==v1){ 
				pos = i;
			}
		}
		}catch(e){
			alert(e);
		}
/*
		for(i=0;i<NR;i++){
			if(arrstr[i]==v1){ 
				pos = i;
				file = "Admon/imagenes/img"+v3+"/"+v1+".jpg";
				document.getElementById('ImgFotYoSoy').src = file; 
			}
		} 
		ImageInfo.loadInfo(file, mycallback);  
*/ 
		document.getElementById("txtListaImgYoSoy").value = v2;
		/*ImageInfo.loadInfo(file, mycallback);*/
		EntradaImagen = v1;
		mycallbackx(v1);  
		document.getElementById("txtPosicionYoSoy").value=pos;	
		document.getElementById('IFot'+v1).style.display = "block";
		
	}catch(e){ 
		alert ("fx-AbreFotosYoSoy"+e);
	}
} 
function mycallbackx(xx){  
	try{
	/*
		a = ImageInfo.getAllFields(file).toSource();
		var obj1 = eval( a ); //ok! 
		var anc = obj1.exif.PixelXDimension;
		var alt = obj1.exif.PixelYDimension;
		//alert( obj1.exif.PixelXDimension);
		//alert( obj1.exif.PixelYDimension);	
		var por = (480*100)/anc;
		var alt = (por*alt)/100;
		//alert (alt);
		PosicionarImagen(alt);
		*/
		 
		//a = ImageInfo.getAllFields(file).toSource();
		document.getElementById("cssCapaPTodo").style.display = "block"; 
		document.getElementById("capa11").style.display="block";		
		document.getElementById("IFot"+xx).style.display = "block"; 
		anc = document.getElementById("IFot"+xx).clientWidth; 
		alt = document.getElementById("IFot"+xx).clientHeight;
/*
		var obj1 = eval( a ); //ok!
		var anc = 0;
		var alt = 0;
		if(obj1.exif.PixelXDimension == undefined){
			anc = obj1.width; 
			alt = obj1.height;
		}else{
			anc = obj1.exif.PixelXDimension;
			alt = obj1.exif.PixelYDimension;
		} 
		*/ 
		var por = (480*100)/anc;
		if(por<100) alt = (por*alt)/100; 
		PosicionarImagen1(alt); 	 
	}catch(e){ 
		alert("fx-mycallbackx"+e); 
	}	
}
/*
*posiciona la imagen al centro 
*/
function  PosicionarImagen(aa){
	try{ 
		document.getElementById("cssCapaPTodo").style.display="block";
		document.getElementById("capa11").style.display="block";	
		document.getElementById("Content1").style.backgroundColor = "#E5E5E5";  
		document.getElementById("Content1").style.width = "550px";

		var AltoCapa = aa;/*document.getElementById('ImgFotYoSoy').height;*/  
		AltoCapa = parseFloat(AltoCapa);
		var AltoCapa1 = parseFloat(AltoCapa) + 30;
		var AltoCapa2 = parseFloat(AltoCapa) + 60;
		document.getElementById("Content1").style.height = AltoCapa + "px";
		document.getElementById("Content1").style.position = "absolute";
		document.getElementById("Content1").style.left = "0px";
		document.getElementById("Content1").style.top = "0px";
		document.getElementById("Content1").style.textAlign = "center";
	 	document.getElementById("Content1").style.paddingTop = "20px";
	
	 	/*document.getElementById("Content2").style.backgroundColor = "#E5E5E5";*/  
		document.getElementById("Content2").style.width = "21px";
		document.getElementById("Content2").style.height = "24px";
		document.getElementById("Content2").style.position = "absolute";
		document.getElementById("Content2").style.left = "0px";
		
		document.getElementById("Content3").style.width = "21px";
		document.getElementById("Content3").style.height = "24px";
		document.getElementById("Content3").style.position = "absolute";
		document.getElementById("Content3").style.left = "40px";
		
		document.getElementById("Content4").style.width = "25px";
		document.getElementById("Content4").style.height = "25px";
		document.getElementById("Content4").style.position = "absolute";
		document.getElementById("Content4").style.left = "425px"; 

		
		document.getElementById("capa11").style.height = AltoCapa2+"px"; 
		generaMitad('capa11','#C8D3D9','100',0);   
		generateCoverDiv('cssCapaPTodo','#222222','80');
		
	}catch(e){ 
		//alert(e);
	}
}
/*
*posiciona la imagen al centro 
*/
function  PosicionarImagen1(aa){ 
	try{ 
		
		document.getElementById("cssCapaPTodo").style.display="block";
		document.getElementById("capa11").style.display="block";	
		/*document.getElementById("Content1").style.backgroundColor = "#E5E5E5";*/  
		document.getElementById("Content1").style.width = "480px";

		var AltoCapa = aa;/*document.getElementById('ImgFotYoSoy').height;*/ 
		AltoCapa = parseFloat(AltoCapa) ; 
		var AltoCapa1 = parseFloat(AltoCapa) + 10;
		var AltoCapa2 = parseFloat(AltoCapa) + 10; 
		document.getElementById("Content1").style.height = AltoCapa + "px";
		document.getElementById("Content1").style.position = "absolute";
		document.getElementById("Content1").style.left = "0px";
		document.getElementById("Content1").style.top = "0px";
		document.getElementById("Content1").style.textAlign = "center";
	 	/*document.getElementById("Content1").style.paddingTop = "20px";*/
	
	 	/*document.getElementById("Content2").style.backgroundColor = "#E5E5E5";*/  
		document.getElementById("Content2").style.width = "21px";
		document.getElementById("Content2").style.height = "24px";
		document.getElementById("Content2").style.position = "absolute";
		document.getElementById("Content2").style.left = "0px";
		document.getElementById("Content2").style.top = AltoCapa1+"px"; 
		
		document.getElementById("Content3").style.width = "21px";
		document.getElementById("Content3").style.height = "24px";
		document.getElementById("Content3").style.position = "absolute";
		document.getElementById("Content3").style.left = "40px";
		document.getElementById("Content3").style.top = AltoCapa1+"px"; 
		
		document.getElementById("Content4").style.width = "25px";
		document.getElementById("Content4").style.height = "25px";
		document.getElementById("Content4").style.position = "absolute";
		if(navigator.userAgent.indexOf("MSIE")>=0) document.getElementById("Content4").style.left = "425px";
		else document.getElementById("Content4").style.left = "455px";
		
		document.getElementById("Content4").style.top = AltoCapa1+"px";  
		
		document.getElementById("capa11").style.height = AltoCapa2+"px";
		generaMitad('capa11','#C8D3D9','100',0);   
		generateCoverDiv('cssCapaPTodo','#222222','80'); 
		document.getElementById("IFot"+EntradaImagen).style.display = "block";  
		
		
	}catch(e){ 
		alert("fx-PosicionarImagen1: "+e);
	}
}
/*
*cerrar fotos yo soy
*/
function CerrarFotosYoSoy(){
	document.getElementById("cssCapaPTodo").style.display="none";
	document.getElementById("capa11").style.display="none";		
	NR = 0;
 	file = "";
	EntradaImagen ="";
}
/*
*atras fotos soy yo 
*/
function AtrasFotosYoSoy(){
	try{
		var v2 = document.getElementById("txtListaImgYoSoy").value;
		var str=new String(v2);
		arrstr = str.split("|"); 
		NR = arrstr.length - 1; 

		//document.getElementById("capa11").style.display="none";
		var posA = document.getElementById("txtPosicionYoSoy").value;//sacar posicion actual
		/*Si posicion actul es > 0 entonces resta 1*/ 
		if(posA>0) posA = parseFloat(posA) - 1;
		var nimafg = "";
		for(i=0;i<NR;i++){
			document.getElementById("IFot"+arrstr[i]).style.display = "none";
			if(posA == i){ 
				EntradaImagen = arrstr[i];
				//file = "Admon/imagenes/img"+v1+"/"+arrstr[i]+".jpg"; 
			}
		}
		//ImageInfo.loadInfo(file, mycallback);
		mycallbackx(EntradaImagen);    
		document.getElementById("txtPosicionYoSoy").value=posA;	
		
	}catch(e){ 
		alert ("fx-AtrasFotosYoSoy"+e);
	}	
}
/*
*next fotos soy yo 
*/
function NextFotosYoSoy(){
	try{
		var v2 = document.getElementById("txtListaImgYoSoy").value; 
		var str=new String(v2);
		arrstr = str.split("|"); 
		NR = arrstr.length - 1; 
		//document.getElementById("capa11").style.display="none";
		var posA = document.getElementById("txtPosicionYoSoy").value;//sacar posicion actual
		/*Si posicion actul es > 0 entonces resta 1*/ 
		var posA1 = parseFloat(posA)+1; 
		if(posA1 < NR) posA = parseFloat(posA) + 1;  
		var nimafg = ""; 
		for(i=0;i<NR;i++){
			document.getElementById("IFot"+arrstr[i]).style.display = "none";
			if(posA == i){ 
				EntradaImagen = arrstr[i]; 
				//file = "Admon/imagenes/img"+v1+"/"+arrstr[i]+".jpg";
			}
		}
		//ImageInfo.loadInfo(file, mycallback);
		//alert (EntradaImagen);
		mycallbackx(EntradaImagen);  
		document.getElementById("txtPosicionYoSoy").value=posA;	
	}catch(e){ 
		alert ("fx-NextFotosYoSoy"+e);
	}	
}
/*
*si es cadena 
*/
function isString() {if (typeof arguments[0] == 'string') return true;if 

(typeof arguments[0] == 'object') {  var criterion =   

    arguments[0].constructor.toString().match(/string/i); 
 return (criterion != null);  }return false;}

/*
*Abre ventana de compartir 
*/
function AbreCompartir(typ,valu,tul,lug){
	try{
		document.getElementById('capa3').style.display='block';
		document.getElementById('todoCompartir').style.display='block';
		document.getElementById('txtTipoMov').value=typ;
		document.getElementById('txtValorCompartir').value=valu;
		document.getElementById('txtTipoCompartir').value=tul;  
		document.getElementById('txtLugarCompartir').value=lug;  
		//alert (lug);
		//alert (tit);
		var tit = ""; 
		/*if(isString(tul))tit = tul;*/ 
		do {
    		/*lug = lug.replace('|','&amp;');*/ 
    		lug = lug.replace('|','&');   
		} while(lug.indexOf('|') >= 0);
		/*var t = "http://example.com/blog/24";*/   
		addthis.button('#LinkRS', {}, {url: lug, title: tit});

	
		generaMitad('capa3','#CCCCCC','100',0); 
		generateCoverDiv('todoCompartir','#333333','80');
	}catch(e){
    	alert("fx-AbreCompartir: "+e); 
   } 
}
/*
*Agregar Contacto 
*/
function AgregarCompartir(v1,v2,v3,v4,v5,v6,v7){    
	try{	
		//alert(v7); 
		if(v1 =="" || v1 == " "){ 
			alert("Es necesario un correo"); 
			document.getElementById("txtmailCom").focus();
			return false;
		} 
		document.getElementById("txtmailCom").value=""; 
		document.getElementById("txtContent").value=""; 
		document.getElementById("txtTipoMov").value=""; 
		document.getElementById("txtNombreCom").value="";   
		document.getElementById("txtValorCompartir").value="";
		document.getElementById("txtTipoCompartir").value="";  
		document.getElementById("txtLugarCompartir").value="";   
    	AJAXAgregaCompatir('AGREGAR_COMPARTIR.php','cor='+v1+'&men='+v2+'&tty='+v3+'&valor='+v4+'&nom='+v5+'&tyl='+v6+'&lug='+v7,'','capaCompartir');  
    	CierraReg(); 
    	return false;  
	}catch(e){
		alert ("fx-AgregarContacto"+e);
		return false; 
	}
}


/*
*Objeto para conexion sincronizacion profesor genera calculos 
*/
function AJAXAgregaCompatir1(file){ 
  var xmlhttp=false;
  try{
  this.AjaxFailedAlert = "PP";
  }catch(e){}
  this.requestFile = file;
  this.encodeURIString = true;
  this.execute = false;
  if (window.XMLHttpRequest){ 
    this.xmlhttp = new XMLHttpRequest();
    if (this.xmlhttp.overrideMimeType){
      this.xmlhttp.overrideMimeType('text/xml');
    }
  }else if (window.ActiveXObject){ // IE
    try{
      this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        this.xmlhttp = null;
      }
    }
    if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
      this.xmlhttp = new XMLHttpRequest();
      if (!this.xmlhttp){
        this.failed = true; 
      } 
    } 
  }
  return this.xmlhttp ;
}
/*
*Syncroniza Profesor 
*/
function AJAXAgregaCompatir(_pagina,valorget,valorpost,capa){  
     //alert ('h1');
  var ajax=AJAXAgregaCompatir1(_pagina);
  if(valorpost!=""){
    ajax.open("POST", _pagina+"?"+valorpost+"&tiempo="+new Date().getTime(),true);
  }else{
    ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  }
  ajax.onreadystatechange=function(){
    if (ajax.readyState==1){
      //document.getElementById(capa).innerHTML = "";//"<img src='GIF32.gif' align='center'> Aguarde por favor...";
    }  
    if (ajax.readyState==4) {
      if(ajax.status==200){ 
          SetContainerHTML1(capa, ajax.responseText, true);    
      }else if(ajax.status==404){
        	try{
        	//capa.innerHTML = document.getElementById('txtM42').value;
        	}catch(e){}
      }else{
        	capa.innerHTML  = ajax.status;
      }
    }
  }
if(valorpost!=""){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(valorpost);  
  } else {
    	ajax.send(null);
  }
} 
/*
*Abre olvidar contraseña 
*/
function OlvidarContrasexa(){
	try{
		document.getElementById('capa1').style.display='none'; 
		document.getElementById('todo').style.display='none'; 
		document.getElementById('todoFlashVideo').style.display='none';  
		document.getElementById('capa5').style.display='none'; 
		document.getElementById('capaOlvido').style.display='block'; 
		document.getElementById('todoOlv').style.display='block';
		document.getElementById('txtmailOlv').value="";   
		generaMitad('capaOlvido','#CCCCCC','101',0); 
		generateCoverDiv('todoOlv','#333333','80');
	}catch(e){
		alert(e); 
	}
}
/**
*Olvido contaseña
*/
function OlvidoContra(v1){
	try{
		if(v1 == ""){ 
			alert("Es necesario un correo"); 
			document.getElementById("txtmailreg").focus();
			return false;
		} 
		document.getElementById("txtmailreg").value=""; 
    	AJAXAgregaCompatir('OLVIDAR_CONTRA.php','cor='+v1+'&tty=7','','capaOlvidoE');  
	}catch(e){
		alert(e); 
	}
}
/*
*Abre olvidar contraseña 
*/
function CambiarContrasexa(){ 
	try{
		document.getElementById('capa1').style.display='none'; 
		document.getElementById('todo').style.display='none'; 
		document.getElementById('todoFlashVideo').style.display='none';  
		document.getElementById('capa5').style.display='none'; 
		document.getElementById('capaCambiar').style.display='block'; 
		document.getElementById('todoCamb').style.display='block';
		document.getElementById('txtmailCam').value=""; 
		document.getElementById('txtClaveCam').value="";  
		document.getElementById('txtClaveCam1').value=""; 
		document.getElementById('txtClaveCam2').value="";   
		generaMitad('capaCambiar','#CCCCCC','102',0); 
		generateCoverDiv('todoCamb','#333333','80');
	}catch(e){
		alert(e);  
	} 
}
/**
*Olvido contaseña
*/
function CambiaContra(v1,v2,v3,v4){ 
	try{
		if(v1 == ""){ 
			alert("Es necesario un correo");  
			document.getElementById("txtmailCam").focus();
			return false;
		} 
		if(v2 == ""){  
			alert("Es necesario la clave actual");  
			document.getElementById("txtClaveCam").focus();
			return false;
		} 
		if(v3 == ""){  
			alert("Es necesario la nueva clave");  
			document.getElementById("txtClaveCam1").focus();
			return false;
		} 
		if(v4 == ""){  
			alert("Es necesario una clave de confirmación");  
			document.getElementById("txtClaveCam2").focus();
			return false;
		} 
		if(v3 != v4){
    		document.getElementById("txtClaveCam").value="";
			document.getElementById("txtClaveCam1").value=""; 
			document.getElementById("txtClaveCam2").focus(); 
    		alert("¡CLAVE NUEVA INCORRECTA!")
    		return false;
    	}
		document.getElementById("txtmailCam").value="";
		document.getElementById("txtClaveCam").value="";
		document.getElementById("txtClaveCam1").value="";   
		document.getElementById("txtClaveCam2").value="";      
    	AJAXAgregaCompatir('CAMBIAR_CONTRA.php','cor='+v1+'&cla='+v2+'&clan='+v3+'&tty=7','','capaOlvidoE');  
	}catch(e){
		alert(e); 
	}
}
/*
*Abre los vidoes de foram oscura
*/
function AbrirVideoGrande(v,t,c){
	try{
		document.getElementById('capa1').style.display='none'; 
		document.getElementById('todo').style.display='none'; 
		document.getElementById('capaCambiar').style.display='none'; 
		document.getElementById('todoCamb').style.display='none'; 
		document.getElementById('todoFlashVideo').style.display='block';  
		document.getElementById('capa5').style.display='block';  
		generaMitad('capa5','#CCCCCC','103');   
		generateCoverDiv('todoFlashVideo','#333333','80',0);
		AJAXAabreFlash('ABRE_FLASH.php','video='+v+'&tab='+t+'&cam='+c,'','capa55');  
		document.getElementById("Content6").style.width = "25px"; 
		document.getElementById("Content6").style.height = "25px";
		document.getElementById("Content6").style.position = "absolute";
		document.getElementById("Content6").style.left = "455px";
		document.getElementById("Content6").style.top = "410px";
	}catch(e){ 
		alert("fx-AbrirVideoGrande: "+e);
	}
}

/*
*Objeto para conexion sincronizacion profesor genera calculos 
*/
function AJAXAabreFlash1(file){ 
  var xmlhttp=false;
  try{
  this.AjaxFailedAlert = "PP";
  }catch(e){}
  this.requestFile = file;
  this.encodeURIString = true;
  this.execute = false;
  if (window.XMLHttpRequest){ 
    this.xmlhttp = new XMLHttpRequest();
    if (this.xmlhttp.overrideMimeType){
      this.xmlhttp.overrideMimeType('text/xml');
    }
  }else if (window.ActiveXObject){ // IE
    try{
      this.xmlhttp  = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
        this.xmlhttp = null;
      }
    }
    if (!this.xmlhttp  && typeof XMLHttpRequest!='undefined') {
      this.xmlhttp = new XMLHttpRequest();
      if (!this.xmlhttp){
        this.failed = true; 
      } 
    } 
  }
  return this.xmlhttp ;
}
/*
*Syncroniza Profesor 
*/
function AJAXAabreFlash(_pagina,valorget,valorpost,capa){  
     //alert ('h1');
  var ajax=AJAXAabreFlash1(_pagina);
  if(valorpost!=""){
    ajax.open("POST", _pagina+"?"+valorpost+"&tiempo="+new Date().getTime(),true);
  }else{
    ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
  }
  ajax.onreadystatechange=function(){
    if (ajax.readyState==1){
      //document.getElementById(capa).innerHTML = "";//"<img src='GIF32.gif' align='center'> Aguarde por favor...";
    }  
    if (ajax.readyState==4) {
      if(ajax.status==200){ 
          SetContainerHTML1(capa, ajax.responseText, true);    
      }else if(ajax.status==404){
        	try{
        	//capa.innerHTML = document.getElementById('txtM42').value;
        	}catch(e){}
      }else{
        	capa.innerHTML  = ajax.status;
      }
    }
  }
if(valorpost!=""){
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.send(valorpost);  
  } else {
    	ajax.send(null);
  }
} 
/*
*cerrar videos flash
*/
function CerrarVideosFlash(){
	document.getElementById("todoFlashVideo").style.display="none"; 
	document.getElementById("capa5").style.display="none";	 	
}
