// JavaScript Document
/*
	about this function
	====================
	
	This function is called needs two parameters:
	1) The name of the div to show
	2) The skelleton name of all other div to be hidden
	
	e.g. when the div name is "drawing1", all other divs must have names like
	drawing0, drawing2 etc.
	The function loops trough those divs and, if the div is in the DOM tree, 
	it will be hidden
*/

function showDrawingDiv ( divName, divBaseName ) {
	var desiredDiv = window.document.getElementById ( divName );
	desiredDiv.style.display = "block";
	
	for ( i = 0; i <= 5; ++i ) {
		if ( window.document.getElementById ( divBaseName + i ) ) {
			if ( divBaseName + i !== divName ) {
				var undesiredDiv = window.document.getElementById ( divBaseName + i );
				undesiredDiv.style.display = "none";
			}
		}
	}
	return false;
}

function showDrawingJpeg (linkClicked)
{
	newWindow = window.open ( "/products/zoomerDrawing.php?" + linkClicked, 'Zoomer', "toolbar=no" );
	return false;
}
function showPictureJpeg (linkClicked)
{
	newWindow = window.open ( "/products/zoomerPicture.php?" + linkClicked, 'Zoomer', "toolbar=no" );
	return false;
}
function showAccessorie (linkClicked)
{
	var aw = screen.width;
	var ah = screen.height;
	
	var desiredWidth = 480;
	var desiredHeight = 240;

	var newX = (aw - desiredWidth)/2;
	var newY = (ah - desiredHeight)/2 - 20;
	var option = 'width=' + desiredWidth + ',height=' + desiredHeight + ',toolbar=no';

	newWindow = window.open (linkClicked, 'Accessorie', option );
	newWindow.moveTo(newX, newY);
	return false;
}
