showHide = function(tableId)
{
	var table = document.getElementById('tableMain_' + tableId);
	var image = document.getElementById("image_" + tableId);
	
	if(table.style.display == 'none')
	{
		table.style.display = 'inline';
		image.src = "Images/RollUp.gif"
	}
	else
	{
		table.style.display = 'none';
		image.src = "Images/DrillDown.gif";
	}
}

enableButton = function(checkboxId, buttonId)
{
	var checkbox = document.getElementById(checkboxId);
	var button = document.getElementById(buttonId);
	
	button.disabled = !checkbox.checked;
}

// Questa variabile dovrà avere un nome univoco
// per ogni imagesControl inserito in una pagina
// FORSE DEVE ESSERE TRASFORMATA IN UN CAMPO HIDDEN
// LO SCRIPT VA SPOSTATO IN D:\INETPUB\WWWROOT\ASPNET_CLIENT\VERSIONE DEL FRAMEWORK\
var insertMode = false;

insertImage = function(ID)
{
	insertMode = true;
	
	var table = document.getElementById(ID).childNodes[0];
	
	table.rows[1].style.display = 'none';
	table.rows[2].style.display = 'inline';
}

cancelInsert = function(ID)
{
	insertMode = false;
	
	var table = document.getElementById(ID).childNodes[0];
	table.rows[2].style.display = 'none';
}

showButtons = function(ID)
{

	if(!insertMode){
		var table = document.getElementById(ID).childNodes[0];
		table.rows[1].style.display = 'inline';
	}
}

hideButtons = function(ID)
{
	var table = document.getElementById(ID).childNodes[0];
	table.rows[1].style.display = 'none';
}

showZoom = function(ID, windowTitle)
{	
	var table = document.getElementById(ID);
	var imageElement = table.rows[0].cells[0].childNodes[0];

	image = imageElement.src;

	if(image){
		x3421=window.open('','','height=100 width=100');
		
		if(windowTitle)
			x3421.document.write('<title>' + windowTitle + '</title>');
		else
			x3421.document.write('<title>Image viewer</title>');
			
		x3421.document.write('<body leftmargin="0" topmargin="0"></body>');

		src="<img name='picture' src="+image+">";
		x3421.document.write(src);

		while (x3421.document.images[0].complete != true){}
		
		x3421.resizeTo(x3421.document.picture.width,(x3421.document.picture.height+30));
	}
	else
		alert('Inserire una immagine prima di tentare il preview.');
}
