
function openCatalogo(url) {
    var winl = (screen.width) / 2;
    var wint = (screen.height) / 2;
    props = 'height=580,width=800,top=' + (wint - 290) + ',left=' + (winl - 400)+ ',resizable=yes,toolbar=no,scrollbars=yes';
    var win = window.open(url, "ctwin", props);
} 

  function openPopup(url, popW, popH) {
      var w = 1024, h = 800;
      if (document.all || document.layers) {
         w = screen.availWidth;
         h = screen.availHeight;
      }
      var leftPos = (w-popW)/2, topPos = (h-popH)/2;
      var pinfo = window.open(url,'pinfo','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + 
              ",resizable=yes,toolbar=no,scrollbars=yes");
      pinfo.focus();
  }

    function resizePopUp()	{
        var y = getAnchorPosition("bottom");                        
        if (document.all) {
            resizeTo(750, Math.min(500, y + 40));
        } else {
            resizeTo(750, Math.min(500, y + 100));
        }
    }

// ############################### Login #######################################

var loginDragWindow = null;

function login() {
    var div = mybox.getElement("login");
    var divError = mybox.getElement("loginError");
    div.style.display = 'block';
    div.style.display = 'block';
    mybox.centerInWindow(div);
    if (loginDragWindow == null)
        loginDragWindow = new mybox.DragElement('login');        
}

function cerrarLogin() {
    var div = mybox.getElement("login");
    div.style.display = 'none';
}

// ############################ Aviso Legal ####################################

function mostrarAvisoLegal() {
    var iframe = mybox.getElement('avisoLegalIframe');
    iframe.src = path + '/faces/jsf/avisoLegal.jsp';
    var div = mybox.getElement('avisoLegal');
    div.style.display = 'block';
    mybox.centerInWindow(div);        
}

function cerrarAvisoLegal() {
    var div = mybox.getElement('avisoLegal');
    div.style.display = 'none';
}

// ############################ Buscadores #####################################

function clickBuscar(e, buttonName) {
    try {
        var keycode;
        if (window.event) 
            keycode = window.event.keyCode;
        else if (e) 
            keycode = e.which;
        else 
            return true;

        if (keycode == 13) {
            var el = mybox.getElement(buttonName);
            if (el.click != undefined)
                el.click();
            else
                el.onclick();
            return false;
        } else
            return true;
   } catch (err) {
        alert(err);
   }
}

function cancelIntro(e) {
    var keycode;
    try {
        if (window.event) 
            keycode = window.event.keyCode;
        else if (e) 
            keycode = e.which;
        else 
            return true;

        if (keycode == 13) {
            if (e.stopPropagation)
                e.stopPropagation();
            else
                e.cancelBubble = true;

            if (e.preventDefault)
                e.preventDefault();
            else
                e.returnValue = false;
        }
    } catch (err) {
        alert(err);
    } 
}
