/**
*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 ujn 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(url1,'_blank');
		bob.location=url1;
	}else if(te==3){
		
	}
}
/**
*Buscar categoria
*/
function BuscarCategoria(buscar,pag,typ){ 
	/*buscar = base64_encode(buscar);*/  
	window.location = 'archivo?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';
		generaMitad('capa1','#CCCCCC','100'); 
		generateCoverDiv('todo','#333333','50');
	}catch(e){
    	alert("fx-AbreRegistro: "+e); 
   } 
}

/*
*Genera la mitad del mensajeador del tablero 
*/
function generaMitad(id, color, opacity,tipo) 
{
	try{
		var navegador=1;
	   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=layer.style.height;//380;   
	   	var W1 = W / 2; 
	   	var H1 = H / 2; 
	   }else if(id=="capa3"){  
	   	var W=350;
	   	var H=580;     
	   	var W1 = W / 2;
	   	var H1 = H / 2; 
	   }else if(id=="capa1"){  
	   	var W=348;   
	   	var H=695; 
	   	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; 
		}
		// 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';  
     	 
      var posi = document.documentElement.scrollTop;  
     	alto=screen.height;    
     	dif = parseInt(alto)-parseInt(layer.style.height);
     	nv = parseInt(dif/2) + parseInt(posi)
     	//alert (nv); 
     	layer.style.top =  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('txtSexReg').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){
	try{
		alert(cor);
		alert(cla);
		AJAXLogin('LOGEO.php','cor='+cor+'&cla='+cla,'','capaReg');
	}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){  
     //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){ 
          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);
	}
}
/*
*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){}
	}catch(e){
		alert ("fx-CierraReg"+e);
	}
}
/*
*Agregar Registro de Usuario
*/
function AgregarRegistroUsuario(n,a,c,p,pc,s,d,m,y,pa,oc){
	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,'','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){ 
          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);
  }
} 
/**
*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?pag='+pag+'&typ='+typ+'&cat='+cat+'&art='+art+'&com='+com;
	if(tipo == 2) window.location = 'archivo?pag='+pag+'&typ='+typ+'&nnn='+cat+'&com='+com;    
}

/*
*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=100','','capaCon'); 
    	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){ 
          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);
  }
} 
/*
*Abre visor de fotos
*/ 
var arrstr = new Array();
var NR = 0;
function AbreFotosYoSoy(v1,v2,v3){
	try{
		var str=new String(v2);
		arrstr = str.split("|"); 
		NR = arrstr.length - 1; 
		document.getElementById("cssCapaPTodo").style.display="block";
		document.getElementById("capa11").style.display="block";	
		//document.getElementById("capa11").style.backgroundColor = "#FF00FF";  
		for(i=0;i<NR;i++){
			if(arrstr[i]==v1){
				pos = i;
				document.getElementById('ImgFotYoSoy').src = "Admon/imagenes/img"+v3+"/"+v1+".jpg";
			}
		}
		document.getElementById("txtPosicionYoSoy").value=pos;	
		
		PosicionarImagen();
		
		
	}catch(e){ 
		alert ("fx-AbreFotosYoSoy"+e);
	}
}
/*
*posiciona la imagen al centro 
*/
function  PosicionarImagen(){
	document.getElementById("Content1").style.backgroundColor = "#E5E5E5";  
	document.getElementById("Content1").style.width = "550px";
	var AltoCapa = document.getElementById('ImgFotYoSoy').height;
	AltoCapa = parseFloat(AltoCapa) + 30;
	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("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";
	document.getElementById("Content4").style.left = "525px";
	document.getElementById("Content4").style.top = AltoCapa1+"px"; 
	
	
	document.getElementById("capa11").style.height = AltoCapa2+"px"; 
	generaMitad('capa11','#C8D3D9','100');  
	generateCoverDiv('cssCapaPTodo','#222222','80');
}
/*
*cerrar fotos yo soy
*/
function CerrarFotosYoSoy(){
	document.getElementById("cssCapaPTodo").style.display="none";
	document.getElementById("capa11").style.display="none";		
}
/*
*atras fotos soy yo 
*/
function AtrasFotosYoSoy(v1){
	try{
		var posA = document.getElementById("txtPosicionYoSoy").value;//sacar posicion actual
		/*Si posicion actul es > 0 entonces resta 1*/ 
		if(posA>0) posA = posA - 1;
		/*en caso contrario deja en cero*/ 
		/*Mandar la imagen*/
		document.getElementById('ImgFotYoSoy').src = "Admon/imagenes/img"+v1+"/"+arrstr[posA]+".jpg"; 
		document.getElementById("txtPosicionYoSoy").value=posA;	
		PosicionarImagen();
	}catch(e){ 
		alert ("fx-AtrasFotosYoSoy"+e);
	}	
}
/*
*next fotos soy yo 
*/
function NextFotosYoSoy(v1){
	try{
		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; 
		/*en caso contrario deja en cero*/  
		/*Mandar la imagen*/ 
		document.getElementById('ImgFotYoSoy').src = "Admon/imagenes/img"+v1+"/"+arrstr[posA]+".jpg"; 
		document.getElementById("txtPosicionYoSoy").value=posA;	
		PosicionarImagen();
	}catch(e){ 
		alert ("fx-NextFotosYoSoy"+e);
	}	
}
/*
*Abre ventana de compartir 
*/
function AbreCompartir(typ,valu,tul,lug){
	try{
		//alert(lug);
		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;  
		   
		generaMitad('capa3','#CCCCCC','100'); 
		generateCoverDiv('todoCompartir','#333333','50');
	}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'); 
    	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){ 
          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);
  }
} 
