// JavaScript Document
function quitarEspacios(caja)
{
	caja.value = trim(caja.value);
}

function trim(cadena) {
	if(cadena != ""){
		var sinesp = cadena;
		var re = /\s/g;
		if(cadena.search(re) != -1){
			sinesp = cadena.replace(re,"");
		}
		return sinesp;
	}
}

function enblanco(caja)
{
	caja.value = "";
}
function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
		obj.value=obj.value.substring(0,mlength)
}

var objetoLanguage = false;

function crearObjetoLanguage()
{
	try { objetoLanguage = new ActiveXObject("Msxml2.XMLHTTP");  }
	catch (e) {
		try { objetoLanguage = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch (E) {
			objetoLanguage = false; }
	}
	if (!objetoLanguage && typeof XMLHttpRequest!='undefined'){
		objetoLanguage = new XMLHttpRequest();
	}
}

function cargarLanguage(ln){
	crearObjetoLanguage();
	if (objetoLanguage.readyState != 0) {
		alert('Error al crear el objeto XML. El Navegador no soporta AJAX');
	} else {
		objetoLanguage.onreadystatechange = procesaLanguage;
		objetoLanguage.open("GET", "ajax.php?tool=changeLanguage&no_cache=true&ln=" + ln, true);
		objetoLanguage.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		objetoLanguage.send(null);
	}
}

function procesaLanguage() 
{
	if (objetoLanguage.readyState == 1){
	}

	if (objetoLanguage.readyState == 4){
		if(objetoLanguage.responseText!=""){
			document.location.reload();
		}
	}
}
	
function aparece(numero, direccion){
	var nav = navigator.appName;
	
	switch(nav.toLowerCase()){
		case "netscape":
				opacity = 1;
				if(direccion==1){
					opacity = 0;
				}
				document.getElementById('pluma' + numero).style.backgroundColor = "#FFF";
				document.getElementById('pluma' + numero).tween('opacity',opacity);
				document.getElementById('pluma' + numero).style.backgroundColor = "none";
				break;
		case "microsoft internet explorer":
				/*opacity = 1;
				if(direccion==1){
					opacity = 0;
				}
				document.getElementById('pluma' + numero).style.backgroundColor = "#FFF";
				document.getElementById('pluma' + numero).tween('opacity',opacity);
				document.getElementById('pluma' + numero).style.backgroundColor = "none";
				*/
				if(direccion==0){
					document.getElementById('pluma' + numero).set('opacity',1);
				}else{
					document.getElementById('pluma' + numero).set('opacity',0);
				}
				break;
		default:
				opacity = 1;
				if(direccion==1){
					opacity = 0;
				}
				document.getElementById('pluma' + numero).tween('opacity',opacity);
				break;
	}
}

$(document).ready(function(){
  // This is required for the PNG fix to work.
  if( $.fn.pngfix != null )
    $("img[@src$=png]").pngfix();

  // This is some javascript to stop IE from displaying the img alt attributes
  // when you mouse over imagess.  If you would like IE to display the alt attributes,
  // just comment out the following 4 lines.  Don't worry, if you leave this in 
  // place, your ALT attributes are still readable by the search engines.
  var tmpalt;
  $("img").hover( 
    function(){ tmpalt = $(this).attr( "alt" ); $(this).attr( "alt", "" ); },
    function(){ $(this).attr( "alt", tmpalt ); });
  
  $$('div.opacity').set('opacity',0);
});
