function validateUni(val, min, err_uni, err_min) {
    if (!parseInt(val)) {
        window.alert(err_uni);
        return false;
    }
    if (min > 1 && 0 < (val % min)) {
        window.alert(err_min);
        return false;
    }
    document.forms[1].submit();
    return true;
}

function changeDisp(img, color) {
    if (img.src.indexOf('_ok_') > 0) {
        img.src = 'images/sem_'+color+'.gif';
        document.forms[0].elements('view_dis_'+color).value = 'N';
    } else {
        img.src = 'images/sem_ok_'+color+'.gif';
        document.forms[0].elements('view_dis_'+color).value = 'S';
    }
    document.forms[0].submit();
}

function loadDisp(img, color) {
    if (document.forms[0].elements('view_dis_'+color).value != 'N')
        img.src = 'images/sem_ok_'+color+'.gif';
    else
        img.src = 'images/sem_'+color+'.gif';
}

function loadPage(param, urlPromo, popup) {
    if (param != 'extra') {
        loadDisp(document.images['dispVerde'], 'verde');
        loadDisp(document.images['dispAmarillo'], 'amarillo');
        loadDisp(document.images['dispNaranja'], 'naranja');
        loadDisp(document.images['dispRojo'], 'rojo');
    }
    if (urlPromo != 'null') {
        var centerWidth = (window.screen.width - 500) / 2;
        var centerHeight = (window.screen.height - 620) / 2;
        promoWindow = window.open(urlPromo, 'PROMO', 'width=500,height=620,scrollbars=1,menubar=0,left='+centerWidth+',top='+centerHeight);
        promoWindow.focus();
    }
    if (popup != 'null') {
        var centerWidth = (window.screen.width - 454) / 2;
        var centerHeight = (window.screen.height - 454) / 2;
        popupWindow = window.open(popup, 'POPUP', 'width=454,height=454,scrollbars=0,menubar=0,left='+centerWidth+',top='+centerHeight);
        popupWindow.focus();
    }
}
