//
// Funciones varias
// (c) 2001-2002
//     Fernando Sengáriz Martínez de Gońi
//


// funciones

function abrirVentana (pag,tam_x,tam_y,vent,scroll,resize) {
 var pos_x, pos_y;
 scroll = (scroll==null) ? false : scroll;
 scroll = (scroll) ? "yes" : "no";
 resize = (resize==null) ? false : resize;
 resize = (resize) ? "yes" : "no";
 tam_x = (tam_x==null) ? 640 : tam_x;
 tam_y = (tam_y==null) ? 415 : tam_y;

 var alto = window.screen.height;
 var ancho = window.screen.width;
 pos_x = (ancho-tam_x)/2;
 pos_y = (alto-tam_y)/2-20;

 return(window.open(pag, vent, "toolbar=no,directories=no,menubar=0,scrollbars="+scroll+",location=no,status=no,resizable="+resize+",width="+tam_x+",height="+tam_y+",left="+pos_x+",top="+pos_y));
}

function abrirPopup (pag,tam_x,tam_y,vent,scroll,resize) {
 var pos_x, pos_y;
 scroll = (scroll==null) ? false : scroll;
 scroll = (scroll) ? "yes" : "no";
 resize = (resize==null) ? false : resize;
 resize = (resize) ? "yes" : "no";
 tam_x = (tam_x==null) ? 640 : tam_x;
 tam_y = (tam_y==null) ? 300 : tam_y;

 var alto = window.screen.height;
 var ancho = window.screen.width;
 pos_x = (ancho-tam_x)/2;
 pos_y = (alto-tam_y)/2-20;

 window.open(pag, vent, "toolbar=no,directories=no,menubar=0,scrollbars="+scroll+",location=no,status=no,resizable="+resize+",width="+tam_x+",height="+tam_y+",left="+pos_x+",top="+pos_y);
}

function cargarPagina (seccion,pagina,titulo1,titulo2) {
 location.href = "PTpagina.asp?seccion=" + seccion + "&pagina=" + pagina + "&titulo1=" + titulo1 + "&titulo2=" + titulo2;
}

function cargarProducto (imagen,texto) {
 setTimeout("carga_foto ('"+imagen+"')",100);
 carga_texto(texto);
}
function cargarFoto (imagen) {
 document.images['foto_detalle'].src = "recursos/archivos/"+imagen;
}
function cargarTexto (texto) {
 document.all.foto_texto.innerHTML = texto;
}

function colocarFondo () {
 var fondoWidth = 1024;
 var fondoHeight = 795;
 var contWidth = 800;
 var contHeight = 600;
 var pantWidth = document.body.clientWidth;
 var pantHeight = document.body.clientHeight;
 
 document.all.cFondoTabla.style.backgroundPositionX = (pantWidth-fondoWidth)/2;
 document.all.cFondoTabla.style.backgroundPositionY = (pantHeight-fondoHeight)/2;
}

function activarCapa (laCapa, estado) {
 estado = (estado) ? "visible" : "hidden";
 eval("document.all."+laCapa+".style").visibility = estado;
}


// funciones del menu

function on ( cual ) {
 document.images[cual].src = "imagenes/menuOpcion1.gif";
}
function off ( cual ) {
 document.images[cual].src = "imagenes/menuOpcion2.gif";
}
