// JavaScript Document

function enConstruccion()
{	alert ("Apartado en construccion. Disculpe las molestias.")
}

function openWindow(URL, ancho, alto) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, 'ventana', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + ancho + ",height=" + alto + "');");
	eval("page" + id + ".focus();");
}
/*function openWindow(url, nombreVentana, caracteristicas) { //v2.0
	window.open(url, nombreVentana, caracteristicas);
	window.focus();
}
*/

function submitForm() { 														//v2.0
	window.document.form.submit();
}
function submitFormWithRedirection(url) { 		//v2.0
	window.document.form.cUrlRedir.value=url;
	window.document.form.submit();
}

function popup(url, nombreventana, parameters)
{	//if (!window.focus) return true;
	if (!window.focus) window.focus;
	var href;
	if (typeof(url) == 'string')
		href=url;
	else
		href=url.href;
	window.open(href, nombreventana, 'toolbar=no, status=no, scrollbars=no, location=yes, menubar=no, directories=no, ' + parameters);
}

function resizeImage(idImg) { 
	var maxwidth = 300; 
	var maxheight = 300; 
	var imagen = document.getElementById(idImg);
	//alert(imagen.id + " - " + imagen.width + " - " + imagen.height);
	if (imagen.width > maxwidth || imagen.height > maxheight) { 
		var scale = Math.min((maxwidth/imagen.width),(maxheight/imagen.height), 1); 
		var new_width = Math.floor(scale*imagen.width); 
		var new_height = Math.floor(scale*imagen.height); 
		imagen.width = new_width;
		imagen.height = new_height; 
	} 
}
