/*
 File $Workfile: jfgallery.js $ 
 $Archive: /IMatch/scripts/WebGallery/jfgallery/jfgallery.js $ 
 Last changed by $Author: Duster $ 
 Last modified   $Modtime: 11/22/04 5:36p $ 
 Last checked in $Date: 11/22/04 6:05p $ 
 $Revision: 6 $ 
*/

// If condition is true, create a link for trueImage with given width/height, otherwise just reference the falseImage 
// trueAlternate, falseAlternate are alternative representations of the corresponding images
function button(condition, trueImage, falseImage, width, height, link, trueAlternate, falseAlternate ) {
	if (condition) {
		document.write('<td align="center"><a href="')
		document.write(link)
		document.write('"><img class="ms-button" border="0" src="')
		document.write(trueImage)
		document.write('" align="absmiddle" width="')
		document.write(width)
		document.write('" height="')
		document.write(height)
		document.write('" alt="')
		document.write(trueAlternate)
		document.write('"></a></td>')
	}
	else {
		document.write('<td align="center">')
		document.write('<img border="0" src="')
		document.write(falseImage)
		document.write('" align="absmiddle" width="')
		document.write(width)
		document.write('" height="')
		document.write(height)
		document.write('" alt="')
		document.write(falseAlternate)
		document.write('"></td>')
	}
}

// Answer the minimum of the argument and the actual screen width
function widthLimited(desiredWidth) {
	return Math.min(desiredWidth, screen.availWidth);
}

// Answer the minimum of the argument and the actual screen height
function heightLimited(desiredHeight) {
	return Math.min(desiredHeight, screen.availHeight);
}

//If the window opener is still open, it is brought to the top.
//Otherwise the opener is re-opened to display the URL.
//Note: the main window must have its name set to "jfmain".
function refocus(url) {
	if (window.opener.closed) {
		opener = window.open(url,'jfmain');
	} 
	else {
		window.opener.focus();
	}
	return false;
}

