var width_elem;
var height_elem;
var calc_ratio;
var calc_interval;

function hideResults()	{
	if (document.getElementById('success_results'))	{
		document.getElementById('success_results').style.display = 'none';
	}
	if (document.getElementById('error_results'))	{
		document.getElementById('error_results').style.display = 'none';
	}
	if (document.getElementById('hide_results'))	{
		document.getElementById('hide_results').style.display = 'none';
	}
	return false;
}	

function check_new_win_images()	{
	var length = document.images.length;
	for (var i=0;i<length;i++)	{
		if (document.images[i].parentNode.className.indexOf('image_new_win')>=0)	{
			document.images[i].parentNode.onclick = open_image_new_win;
		}
	}
}

function open_image_new_win()	{
	alert(this.firstChild.width);
//	var new_win = window.open(this.href,'Image_Window','');
//	new_win.focus();
	return false;
}

function init_calc_height()	{	
	width_elem = this.width_elem;
	height_elem = this.height_elem;
	calc_ratio = this.calc_ratio;
	calc_interval = window.setInterval('calc_height()',500);
}

function kill_calc_height()	{	
	window.clearInterval(calc_interval);
}

function calc_height()	{
	height_elem.value = Math.floor(width_elem.value * calc_ratio);
}


function delete_form()	{
	if (window.confirm("Are you sure you want to delete: " + this.name))	{
		this.form.submit();
		return false;
	}
	else {
		return false;
	}
}