// JavaScript Document
	//////////////////////////////////////////////
	var inicial = 0.1; // transparencia inicial
	var avanzar = 0.1; // progreso en transparencia
	var tiempo = 10; // tiempo en ms que tarda en repetirse el bucle
	var lFinal = 0.7; // transparencia final (1 = 100%)
	var activo = true; // debe estar activo por defecto 
	//////////////////////////////////////////////

			function toggleTab(secondTab){
			// SecondTab = Segunda pestana cliqueada.
				if(secondTab)
				{
					// Contenedor 1 invisible, pestana 1 reducida (como el pene de Bline).
					document.getElementById("cont1").className = "contoff";
					document.getElementById("pes1").className = "p1inactivo";
					
					// Contenedor 2 visible, pestana 2 grandota (como el mío :3).
					document.getElementById("cont2").className = "conton";
					document.getElementById("pes2").className = "p2activo";
					
				}else{
					// Contenedor 1 visible, pestana 1 grandota.
					document.getElementById("cont1").className = "conton";
					document.getElementById("pes1").className = "p1activo";
					
					// Contenedor 2 invisible, pestana 2 reducida.
					document.getElementById("cont2").className = "contoff";
					document.getElementById("pes2").className = "p2inactivo";
				}
			}

	function abrirMenu(){
	
	document.body.style.overflow = "hidden";
	
	var aMenu = document.getElementById("fullscreen");

	
		aMenu.style.height = 100+"%"
		aMenu.style.width = 100+"%";
		  
		 if(activo){
			 inicial += avanzar;
			 aMenu.style.opacity = inicial;
			 
         if(inicial <= lFinal){
			aMenu.style.display = "block";
            setTimeout("abrirMenu()",10);
         }else{
            activo = false;
         } 
		
		}
	
	}
	
	
	
function code(codeObj){
	var 
	codeArea = codeObj.nextSibling;

	if (codeArea.nodeType == 3) codeArea = codeArea.nextSibling;
	
	if (codeArea.style.overflow == "auto"){
		codeArea.style.overflow = "scroll";
		codeArea.style.height = "auto";
		codeObj.innerHTML = "<img src=\"../../../../leafw/template/cleaf/images/icons/contraer.gif\" alt=\"[-]\" /> Contraer ";
	
	}else{
		codeArea.style.overflow = "auto";
		codeArea.style.height = 50+"px";
		codeObj.innerHTML = "<img src=\"../../../../leafw/template/cleaf/images/icons/expandir.gif\" alt=\"[+]\" /> Expandir ";
	}
}

function tamano(opc,element){
	var
		contenido = document.getElementById(element).style;
		size = parseInt(contenido.fontSize);
		
		if(opc == '+'){
			if(size < 20){
				contenido.fontSize = size+2+"px";
			}
		}else{
			if(size > 10){
				contenido.fontSize = size-2+"px";
			}
		}
}

function color(col,element){
	var
		contenido = document.getElementById(element).style;
		contenido.backgroundColor = col;
}

function creaxmlhttp(){
  var objetoxmlhttp=false;
  try {

   objetoxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {

     objetoxmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     } 
     catch (E) {
     objetoxmlhttp = false;
   }
  }

  if (!objetoxmlhttp && typeof XMLHttpRequest!="undefined") {
   objetoxmlhttp = new XMLHttpRequest();
  }
  return objetoxmlhttp;
}

function loader(zona,gif){
	obj = document.getElementById(zona);
	if(obj){
		//obj.innerHTML = '<center>Comprobando Datos<br /><img src="global/ajax/'+gif+'.gif" /></center>';
		//obj.innerHTML = '<img src="global/ajax/'+gif+'.gif" />';
		obj.innerHTML = '<img src="../../../leafw/template/cleaf/images/'+gif+'.gif" />';
	}
}

function procesar(valores,campo)
{
   var xmlhttp=creaxmlhttp();
   var url = '../../../leafw/js/ajax.php';




    xmlhttp.open ('POST', url, true);
    loader(campo,'loader');
    xmlhttp.onreadystatechange = function() {
         if (xmlhttp.readyState==1) {
			//alert('wtf');
         }
         else if (xmlhttp.readyState==4){
            if(xmlhttp.status == 200){
               document.getElementById(campo).innerHTML = xmlhttp.responseText;
            }else if(xmlhttp.status==404)
                 {
					alert('Error: El archivo de configuracion no ha sido encontrado');

                 }
             else
                 {
                  alert('Error inesperado en la ejecución del script.');
                 }
        }
    }
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlhttp.send(valores);
    return;
}


function procesad(valores,campo)
{
   var xmlhttp=creaxmlhttp();
   var url = '../../../../leafw/js/ajax.php';
   //var url = 'http://localhost/Proyectos/chiripaina/leafw/js/ajax.php';



    xmlhttp.open ('POST', url, true);
    loader(campo,'loader');
    xmlhttp.onreadystatechange = function() {
         if (xmlhttp.readyState==1) {
			//alert('wtf');
         }
         else if (xmlhttp.readyState==4){
            if(xmlhttp.status == 200){

               if(xmlhttp.responseText == '#reload'){
                  location.reload();
               }else{
                  document.getElementById(campo).innerHTML = xmlhttp.responseText;
               }
            }else if(xmlhttp.status==404)
                 {
					alert('Error: El archivo de configuracion no ha sido encontradox');

                 }
             else
                 {
                  alert('Error inesperado en la ejecución del script.');
                 }
        }
    }
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlhttp.send(valores);
    return;
}
