function resizeImage(img_id, img_src, dimx, dimy, line) {

	var pic = new Image();
	pic.src = img_src;

	if(!pic.complete) {
		setTimeout("resizeImage('"+img_id+"', '"+img_src+"', "+dimx+", "+dimy+", "+line+");", 150);
		return;
	}


	var img = document.getElementById(img_id);	

	
	var width, height;
	width = dimx;
	height = dimy;
			
	var ratio;	
	if(pic.width > width || pic.height > height) {
		ratio = width/pic.width;
		
		if(ratio * pic.height > height)
			ratio = height/pic.height;

		img.src = img_src;
		img.width = Math.floor(ratio * pic.width);
		img.height = Math.floor(ratio * pic.height);
		if(line == true)
			img.style.border = "1px solid red";		
	} else {
		img.src = img_src;
		img.height = pic.height;
		img.width = pic.width;
		img.style.border = "0px";
	}
	
	if(parseInt(line) == 25) {
		centerVertically(img_id, img_src, dimy);
		
	}
}


			
function centerVertically(img_id, img_src, height) {
	var pic = new Image();
	pic.src = img_src;

	if(!pic.complete || document.getElementById(img_id).src.indexOf('blank.gif') > 0) {
		setTimeout("centerVertically('"+img_id+"', '"+img_src+"', "+height+");", 250);
		return;
	}
	
	var img = document.getElementById(img_id);
	img.style.marginTop = parseInt((height-img.height)/2) + 'px';
	
	setTimeout("checkCenter('"+img_id+"', '"+img_src+"', "+height+");", 250);
}

function checkCenter(img_id, img_src, height) {
	var img = document.getElementById(img_id);
	img.style.marginTop = parseInt((height-img.height)/2) + 'px';	
}


function fade(id, color) {
	document.getElementById(id).style.color = "rgb(" + color + "," + color + "," + color + ")";
	
	if(color < 255) 
		setTimeout("fade('" + id + "', " + (color + 5) + ");", 75);
	else
		document.getElementById(id).innerHTML = "";


}