var ancho_max = 600 //ancho máximo
var alto_max = 800 //alto máximo
function resize_ie(idimg)
		{ 	
		var imagen = document.getElementById(idimg); 
		if (imagen.width>ancho_max || imagen.height>alto_max) 
			{ 						
			porc_ancho = parseInt(ancho_max/imagen.width*100)
			imagen.width = ancho_max
			imagen.height = porc_ancho*imagen.height/100				
			} 
		}

function resize(ancho,alto,id)
	{
	document.img_up.src = id;

	if(ancho > alto)
		{
		if(ancho > ancho_max)
			{
			porc_ancho = parseInt(ancho_max/ancho*100)
			document.img_up.width = ancho_max
			document.img_up.height = porc_ancho*alto/100
			}
		}
	else
		{
		if (alto > alto_max)
			{
			porc_alto = alto_max/alto*100
			document.img_up.height = alto_max
			document.img_up.width = porc_alto*ancho/100
			}
		}
	}
function pinta()
	{
	document.write('<div style="position:absolute; width:1px; height:1px; z-index:1; overflow: hidden; visibility: hidden;"><img src="' + document.img_up.src + '" onload="resize(this.width,this.height,this.src)"></div>')
	}