// JavaScript Document
function confirmOp(form){
	if (confirm('żEsta seguro?')) {
		form.submit();
	}
}

function RefreshParentAndClose() {
	window.opener.location.reload();
	close();
}

function browseRecord(tabla,accion,registro){
	//tabla=Paginas&accion=INSERT&id_mapa=$mapa'
	pag = 'form.php?tabla='+tabla+'&accion=' + accion + '&id=' + registro;
	ok = openWindow(pag,640,500,1,1);
}

function openWindow(pag,w,h,sc,resiz){
	l = (screen.width) ? (screen.width-w)/2 : 0;
	t = (screen.height) ? (screen.height-h)/2 : 0;
	hwnd = window.open(pag,'_self','list','scrollbars='+sc+',resizable='+resiz+',width='+w+',height='+h+',top='+t+',left='+l+',status=true')
}

function VolverPaginas(){
	window.location = "paginas.php";
}

function VolverTablas(tabla){
	window.location = "list.php?tabla=" + tabla; 
}

function OpenFoto(imageName) {

	imageWidth = calcular_ancho(imageName);
	imageHeight = calcular_alto(imageName);
	
	LeftPosition = (screen.width) ? (screen.width-imageWidth)/2 : 10;
	TopPosition = (screen.height) ? (screen.height-imageHeight)/2 : 10;
	opt = "width=" + imageWidth + ",height=" + imageHeight + ",left=" + LeftPosition + ",top=" + TopPosition + ",maxbutton=0,scrollbar=0";
	alt = "Pulse sobre la foto para cerrar esta ventana";

 	newWindow = window.open("","newWindow",opt);
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<a href="javascript:window.close()"><img src='+imageName +' alt="'+alt+'" border="0"></a>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function calcular_ancho(src_foto){
	img=new Image();
	img.src=src_foto;
	img.width; //Ancho;
	
	return img.width;
}
function calcular_alto(src_foto){
	img=new Image();
	img.src=src_foto;
	img.height; //Alto;
	
	return img.height;
}

