/*######################################################### 
# (c) http://www.yellowgreen.de                           #
#########################################################*/

// Make select box clickable
function AlbumJump() {
	var queryLink = document.album_container.album.selectedIndex;
	top.location.href = "?album=" + document.album_container.album.options[queryLink].value;
}

// Generate popup for image
var pop = null;
function imagePopup(obj, name, width, height) {
	// Get URL
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
	if(!url) return true;
	
	// Scale image down
	if(width > screen.availWidth) {
		height = Math.round(height * (100 * screen.availWidth / width) / 100);
		width = screen.availWidth;
	}
	
	if(height > screen.availHeight) {
		width = Math.round(width * (100 * screen.availHeight / height) / 100);
		height = screen.availHeight;
	}
	
	// Center window
	positionLeft = (screen.availWidth - width) / 2;
	positionTop = (screen.availHeight - height) / 2;
	
	// Generate window
	if(navigator.appName == "Microsoft Internet Explorer") {
		if(pop) pop.close();
		pop = window.open("mosaic/popups/popup.php?src=" + obj + "&width=" + width + "&height=" + height, "name", "width=" + width + ", height=" + height + ", left=" + positionLeft + ", top=" + positionTop + ", resizable=no, status=no, toolbar=no, menubar=no, locationbar=no, directories=0, scrollbars=no");
	} else
		pop = window.open("mosaic/popups/popup.php?src=" + obj + "&width=" + width + "&height=" + height, name, "width=" + width + ", height=" + height + ", left=" + positionLeft + ", top=" + positionTop + ", resizable=no, status=no, toolbar=no, menubar=no, locationbar=no, directories=0, scrollbars=no");
	
	pop.moveTo(positionLeft, positionTop);
	pop.focus();
	
	// Return status
	return (pop) ? false : true;
}
