﻿// JScript File
var Cambio = true;
function AlineaVentana(Objeto,Div,VarX,VarY){
    var ObjetoAlinea = document.getElementById(Objeto);
    var DivAlinea = document.getElementById(Div);
    var location = Sys.UI.DomElement.getLocation(ObjetoAlinea);
    var Y = location.y;
    var X = location.x;
    Y = Y + VarY;
    X = X + VarX;
    DivAlinea.style.position = 'absolute';
    DivAlinea.style.top = Y + 'px';
    DivAlinea.style.left = X + 'px';
}
function CalcularP3(ObjM3,ObjP3,ObjFactor,ObjKg,ObjLb){
    if(ObjM3.value!=''){
        if(confirm('Calcular Automaticamente los Pies Cubicos')){
            ObjP3.value = Math.round(ObjM3.value * 35.3145 * 100) / 100
            if(confirm('Calcular Automaticamente los Kilos y Libras')){
                ObjKg.value = Math.round(ObjM3.value * 100 * 100) / 100
                ObjLb.value = Math.round(ObjKg.value * 2.2 * 100) / 100
                ObjFactor.value = 100
            }
        }
    }
}
function CalcularM3(ObjM3,ObjP3,ObjFactor,ObjKg,ObjLb){
    if((isNaN(ObjM3.value))||(isNaN(ObjP3.value))||(isNaN(ObjKg.value))||(isNaN(ObjLb.value))){
            alert('Compruebe uno de los valores\nNo es numerico')
            return
        }
    if(ObjP3.value!=''){
        if(confirm('Calcular Automaticamente los Metros Cubicos')){
            ObjM3.value = Math.round(ObjP3.value / 35.3145 * 100) / 100
            if(confirm('Calcular Automaticamente los Kilos y Libras')){
                ObjKg.value = Math.round(ObjM3.value * 100 * 100) / 100
                ObjLb.value = Math.round(ObjKg.value * 2.2 * 100) / 100
                ObjFactor.value = 100
            }
        }
    }
}
function CalcularLb(ObjM3,ObjP3,ObjFactor,ObjKg,ObjLb){
    if(ObjLb.value!=''){
        ObjLb.value = Math.round(ObjKg.value * 2.2 * 100) / 100
        ObjFactor.value = Math.round(ObjKg.value / ObjM3.value * 100) / 100
    }
}
function CalcularKg(ObjM3,ObjP3,ObjFactor,ObjKg,ObjLb){
    if(ObjKg.value!=''){
        ObjKg.value = Math.round(ObjLb.value / 2.2 * 100) / 100
        ObjFactor.value = Math.round(ObjKg.value / ObjM3.value * 100) / 100
    }
}
function CambiaFactor(){

}