function translate(id, source, $from, $to){
	Sexy = new SexyAlertBox();
	var text = document.getElementById("record[1]["+source+"]").value;
	google.language.translate(text,$from,$to, function(result) 
			   {
	     if (!result.error) 
	     {
	     
	    	 document.getElementById("record["+id+"]["+source+"]").value = result.translation;  
	     }
	     else Sexy.error("<h1>ERROR</h1>Google reportó un error inesperado");
	   }
	 );
}

function translatefck(id, source, $from, $to){
	Sexy = new SexyAlertBox();
	var text;
	var myf = document.getElementById("record[1]["+source+"]"+"___Frame");
	myf = myf.contentWindow.document || myf.contentDocument;
	var myf2=myf.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentWindow.document || myf.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentDocument;
	text = myf2.body.innerHTML;
	google.language.translate(text,$from,$to, function(result) 
			   {
	     if (!result.error) 
	     {
	    	 var yen = document.getElementById("record["+id+"]["+source+"]"+"___Frame");
	    	 yen = yen.contentWindow.document || yen.contentDocument;
    		 var yen2=yen.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentWindow.document || yen.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentDocument;
    		 yen2.body.innerHTML = result.translation;  
	     }
	     else Sexy.error("<h1>ERROR</h1>Google reportó un error inesperado");
	   }
	 );
	/*
	var myf = document.getElementById("record["+idiomas[i]+"]["+elementos[j]+"]"+"___Frame");
	myf = myf.contentWindow.document || myf.contentDocument;
	var myf2=myf.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentWindow.document || myf.getElementById('xEditingArea').getElementsByTagName('iframe')[0].contentDocument;
	valores=valores+myf2.body.innerHTML+"||";
	*/
}


function validarEntero(campo){ 
    //intento convertir a entero. 
   //si era un entero no le afecta, si no lo era lo intenta convertir
     
    valor = parseInt(document.getElementById(campo).value); 

    //Compruebo si es un valor numérico 
    if (isNaN(valor)) { 
          //entonces (no es numero) devuelvo el valor cadena vacia 
          //return false
    	document.getElementById(campo).value="";
    }else{ 
        //En caso contrario (Si era un número) devuelvo el valor 
        //return true
    	document.getElementById(campo).value=valor;
    }
} 
/*Funcion que generará una nueva imagen para el Captcha */
function new_captcha(){
	if(document.getElementById){
		// extract image name from image source (i.e. cut off ?randomness)
		thesrc = document.getElementById("captcha").src;

		// add ?(random) to prevent browser/isp caching
		document.getElementById("captcha").src = thesrc+"&"+Math.round(Math.random()*100000);
	}//fin if
}//fin function



