
function openUrl(url) {
    var target = "_self";
    if(url.indexOf("http://") != -1) {
        target = "_blank";
    }
    var wnd = window.open(url, target);
    wnd.focus();
}

function openPopup(url, windowName, width, height, resizable, scrollbars) {
    var posx = (screen.width/2)-(width/2);
    var posy = (screen.height/2)-(height/2);
    var resizableStr = resizable? '1': '0';
	var scrollStr = scrollbars? '1': '0';
    features="directories=0,status=0,location=0,menubar=0,toolbar=0,scrollbars=" + scrollStr + ",resizable=" + resizableStr + ",width=" + width + ",height=" + height + ",top=" + posy + ",left=" + posx;
    window.open(url, windowName, features);
}

function getKey(e) {
    if (window.event) return window.event.keyCode;
    else if (e) return e.which;
    else return null;
}

function abreApresentacao(nome) {
    features="directories=0,status=0,location=0,menubar=0,toolbar=0,scrollbars=0,resizable=-0,width=570,height=470,top=20,left=50";
    window.open('/site/jsps/apresentacao.jsp?nome=' + nome, 'apresentacao', features);
}

function apresentaAdm() {
    abreApresentacao('adm');
}
function apresentaLO() {
    abreApresentacao('lo');
}
function apresentaECommerce() {
    abreApresentacao('ecommerce');
}

function openContratar() {
	window.open('https://www.lojistaonline.com.br/site/jsps/contratar_form.jsp', '_top');
}

function openPopupBoleto(url) {
    window.open(url, 'boleto', 'width=700,height=600,left=0,top=0,menubar=1,toolbar=1,scrollbars=1,resizable=1');
}

function validaPreenchimento(ctl, nome) {
    if(ctl.value == '') {
        alert(nome + ': deve ser preenchido');
        ctl.focus();
        return false;
    }
    return true;
}

