function cargando(){}
function onbeforeload(){
	
	xmpinit();
	try{ //Seguro falla en todos los browsers que no son IE6 por comentario condicional
		iefix.onbeforeload();
	}catch(e){}
}
function xmpinit(){
	var oo= document.getElementsByTagName('xmp');
	for (var i=0; i<oo.length; i++) {
		node = oo[i];
		node.ondblclick=xmpclick
	}
}
function xmpclick(e, obj){
	if(!obj) obj = this;
	
	obj.className = obj.className || ''
	
	if(obj.className.indexOf('hover')>=0){
		obj.className = obj.className.replace(/(?:^| )hover/i, '')
	}else{
		obj.className+= ' hover'
	}
	
	if(obj.className.indexOf('docked')>=0){
		obj.className = obj.className.replace(/(?:^| )docked/i, '')
	}else{
		obj.className+= ' docked'
	}
}

function fixPNG(myImage) 
{
	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	var imgTitle = (myImage.title) ? 
				 "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	var imgStyle = "display:inline-block;" + myImage.style.cssText
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
			  + " style=\"" + "width:" + myImage.width 
			  + "px; height:" + myImage.height 
			  + "px;" + imgStyle + ";"
			  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	myImage.outerHTML = strNewHTML	  
}

var AJAXnostart = "";
var AJAXloading = '<img src="/images/ajax_loading.gif"/>';
function elegirPais(Qvalor, Qsalida){
	var Hsalida = document.getElementById(Qsalida);
	if(Qvalor && Qvalor != "" && Qvalor != "0"){
		Hsalida.innerHTML = AJAXloading
		divsalida = Qsalida;
		AJAXelegirPais(Qvalor, Qsalida);
	}else{
		Hsalida.innerHTML = AJAXnostart;
	}
	
}
function AJAXelegirPais(Qvalor, Qsalida){
	var url = "/ajax.instruccionesdeuso.aspx"
	var Qdata = {pais:Qvalor}
	var myAjax = new Ajax(url, {method: 'get', update:Qsalida, data:Qdata}).request();
	return myAjax;
}


function cargarPais(Qsalida){	
	var Hsalida = document.getElementById(Qsalida);
	Hsalida.innerHTML = AJAXloading
	divsalida = Qsalida;
	AJAXcargarPais(Qsalida);
}
function AJAXcargarPais(Qsalida){
	var url = "/ajax.cargarpais.aspx"
	var myAjax = new Ajax(url, {method: 'get', update:Qsalida}).request();
	return myAjax;
}
script={
	RedirectContent:function(Id){
		var Url = "/Content.aspx?Id=" + Id;
		return script.Redirect(Url);
	}
	,Redirect:function(Url){
		location.href=Url;
		return true;
	}
}

function ChangeFormAction(action){
	if(LoginAlternativaAction && typeof LoginAlternativaAction == 'string' && LoginAlternativaAction != ''){
		document.forms[0].action=action;
		return true;
	}
	return false;
}
function ChangeFormActionLVT(action){
	if(LoginAlternativaLVTAction && typeof LoginAlternativaLVTAction == 'string' && LoginAlternativaLVTAction != ''){
		document.forms[0].action=action;
		return true;
	}
	return false;
}

function PopupPasswordrecovery(){
	window.open('/PasswordRecovery.aspx','','width=340,height=400,resizable=yes,scrollbars=yes')
	return false
}

/*tarifas*/
function tarifas1()
{
    var salida_1_uss = getCrossElementById('salida_1_uss');
    var home = getCrossElementById('home');
    var cot_euro = getCrossElementById('cot_euro');
    if(home.value!='')
    {
        salida_1_uss.innerHTML=Math.round(home.value*1000)/1000;
       /* if(!isNaN(cot_euro.value))
        {
            salida_1_euro.innerHTML=Math.round(home.value*1000/cot_euro.value)/1000;
        }*/
    }
}

function tarifas2()
{
    var salida_2_uss = getCrossElementById('salida_2_uss');
    var origen = getCrossElementById('origen');
    var destino = getCrossElementById('destino');
    var cot_euro = getCrossElementById('cot_euro');
    if(destino.value!='' && origen.value!='')
    {
        salida_2_uss.innerHTML=Math.round((parseFloat(destino.value)+parseFloat(origen.value))*1000)/1000;
       /* if(!isNaN(cot_euro.value))
        {
            salida_2_euro.innerHTML=Math.round((parseFloat(destino.value)+parseFloat(origen.value))*1000/cot_euro.value)/1000;
        }*/
    }
 }

function tarifas3()
{
    var salida_3_uss = getCrossElementById('salida_3_uss');
    var destino = getCrossElementById('destino');
    var cot_euro = getCrossElementById('cot_euro');
    if(destino.value!='')
    {
        salida_3_uss.innerHTML=Math.round(destino.value*1000)/1000;
        if(!isNaN(cot_euro.value))
        {
            salida_3_euro.innerHTML=Math.round(destino.value*1000/cot_euro.value)/1000;
        }
    }
}
function getCrossElementById(id) {
    var elm = null;
    if (document.getElementById) {
    // browser implements part of W3C DOM HTML
    // Gecko, Internet Explorer 5+, Opera 5+
    elm = document.getElementById(id);
    } else if (document.all) {
    // Internet Explorer 4 or Opera with IE user agent
    elm = document.all[id];
    } else if (document.layers) {
    // Navigator 4
    elm = document.layers[id];
    }
return elm;
}

function insertarSWF(file,width,height)
{
    var idSwf = file.replace(".swf","");
    document.write("<div id='div"+idSwf+"' style='float:none;overflow:hidden;height:auto;'></div>");
    var fo = new SWFObject("/Gallery/" + file, "div"+idSwf, width, height, "7", "#000000", true);fo.addParam("wmode","transparent");fo.write("div"+idSwf);
}

function BtnSubmit_Click_MiPanelLVT(){
	if(ChangeFormActionLVT(LoginAlternativaLVTAction)){
		document.forms[0].submit();
	}
}

function controlCheck()
{
    var label = document.getElementById('lblError');
    var obj = document.getElementById('ckkConforme');
    
    if (obj)
    {
        if (!obj.checked)
        {
            label.style.display = 'block';
            return false;
        }
        else
            label.style.display = 'none';
    }
    return true;
}