function ShowError(){
return true;
}
window.onerror=ShowError;

function abrirventana(pagina,titulo){
w=660;
h=530;
t=(screen.width-w)/2;
l=(screen.height-h)/2-33;
win=window.open(pagina,'','width='+w+',height='+h+',scrollbars=yes,resizable=yes');
win.moveTo(t,l);
win.focus();
}

var cn_imgSrc='';
var cn_n=0;
var win='';

var cn_liga='';
var cn_textoliga='';

function ObtenerObjeto(n, d) {
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=ObtenerObjeto(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function EditarImagen(n,imgSrc){
cn_n=n;
cn_imgSrc=imgSrc;
w=400;
h=500;
l=(screen.width-w)/2;
t=(screen.height-h)/2;
win=window.open('SelImagen.php','SelImagen','scrollbars=yes,resizable=yes,width='+w+',height='+h+',left='+l+',top='+t);
//win.moveTo(l,t);
win.focus();
}

function SeleccionarImg(file){
if (cn_n>0){
if (win) win.close();
imgObject=ObtenerObjeto('img'+cn_n);
bObject=ObtenerObjeto('b'+cn_n);
bObject.value=file;
imgObject.src='pub/'+file;
window.focus();
}
cn_imgSrc='';
cn_n=0;
win='';
}

function EditarFondo(n,imgSrc){
cn_n=n;
cn_imgSrc=imgSrc;
w=400;
h=500;
l=(screen.width-w)/2;
t=(screen.height-h)/2;
win=window.open('SelFondo.php','SelFondo','scrollbars=yes,resizable=yes,width='+w+',height='+h+',left='+l+',top='+t);
//win.moveTo(l,t);
win.focus();
}

function SeleccionarFondo(file){
if (cn_n>0){
if (win) win.close();
imgObject=ObtenerObjeto('img'+cn_n);
bObject=ObtenerObjeto('b'+cn_n);
bObject.value=file;
imgObject.src='fondos/'+file;
window.focus();
}
cn_imgSrc='';
cn_n=0;
win='';
}

function EditarGaleria(n,imgSrc){
cn_n=n;
cn_imgSrc=imgSrc;
w=400;
h=500;
l=(screen.width-w)/2;
t=(screen.height-h)/2;
win=window.open('SelGaleria.php','SelGaleria','scrollbars=yes,resizable=yes,width='+w+',height='+h+',left='+l+',top='+t);
//win.moveTo(l,t);
win.focus();
}

function SeleccionarGaleria(file){
if (cn_n>0){
if (win) win.close();
imgObject=ObtenerObjeto('img'+cn_n);
bObject=ObtenerObjeto('b'+cn_n);
bObject.value=file;
imgObject.src='galeria/'+file;
window.focus();
}
cn_imgSrc='';
cn_n=0;
win='';
}

function EditarGaleriach(n,imgSrc){
cn_n=n;
cn_imgSrc=imgSrc;
w=400;
h=500;
l=(screen.width-w)/2;
t=(screen.height-h)/2;
win=window.open('SelGaleriach.php','SelGaleriach','scrollbars=yes,resizable=yes,width='+w+',height='+h+',left='+l+',top='+t);
//win.moveTo(l,t);
win.focus();
}

function SeleccionarGaleriach(file){
if (cn_n>0){
if (win) win.close();
imgObject=ObtenerObjeto('img'+cn_n);
bObject=ObtenerObjeto('b'+cn_n);
bObject.value=file;
imgObject.src='galeria/ch/'+file;
window.focus();
}
cn_imgSrc='';
cn_n=0;
win='';
}

function Cerrar(){
if (win) win.close();
window.focus();
cn_imgSrc='';
cn_liga='';
cn_textoliga='';
cn_n=0;
win='';
}

