function correctPNGBackground( divId, imgURL, sizingMethod ) // correctly handle PNG transparency in Win IE 5.5 , 6 & 7.
{
	if ( typeof sizingMethod == 'undefined' ) {
		sizingMethod = 'scale'
	}
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		var div = document.getElementById( divId );
		div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgURL+"', sizingMethod='" + sizingMethod + "')";
		div.style.background = '';
	}
}

function correctPNG( imageId, imgURL ) // correctly handle PNG transparency in Win IE 5.5 , 6 & 7.
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
	{
		var img = document.getElementById( imageId );
		if ( typeof imgURL == 'undefined' ) {
			imgURL = img.src;
		}
		var imgID = (img.id) ? "id='" + img.id + "' " : "";
		var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		var imgStyle = "display:inline-block;" + img.style.cssText 
		if (img.align == "left") imgStyle = "float:left;" + imgStyle
		if (img.align == "right") imgStyle = "float:right;" + imgStyle
		if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		var strNewHTML = "<span " + imgID + imgClass + imgTitle
		+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		+ "(src=\'" + imgURL + "\', sizingMethod='scale');\"></span>";
		img.outerHTML = strNewHTML;
		return false;
	}
}

function changePanelButton( id, on ) {
	var url = '/custom/images/' + id + 'button' + ( ( on ) ? 'over' : '' ) + '.png';
	document.getElementById( 'panelButton_' + id ).style.backgroundImage = 'url(' + url + ')';
	correctPNGBackground( 'panelButton_' + id, url );
}

var showGalleryPanelOnLoad = false;

function initGalleryPanel() {
	// Initialize the temporary Panel to display while waiting for external content to load
	correctPNGBackground( 'galleryPanelBg', '/custom/images/gallerybg.png' );
	document.getElementById('galleryPanel').style.display = '';
	galleryPopup = 
			new YAHOO.widget.Panel("galleryPanel",  
											{ width:"466px", 
											  height:"612px", 
											  fixedcenter:true, 
											  close:false, 
											  draggable:false, 
											  modal:true,
											  visible:false,
											  underlay:"none",
											  effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:0.5} 
											} 
										);

	galleryPopup.render(document.body);
	if( showGalleryPanelOnLoad )
		galleryPopup.show();
}

function hideGalleryPanel() {
	if( typeof galleryPopup != "undefined" )
		galleryPopup.hide();
}

function showGalleryPanel() {
	if( typeof galleryPopup != "undefined" )
		galleryPopup.show();
	else
		showGalleryPanelOnLoad = true
}


function inputBoxFocus( input, defaultText, passwordField ) {
	if( typeof( passwordField ) != 'undefined' ) {
		document.getElementById( passwordField ).style.display = '';
		document.getElementById( passwordField+'_text' ).style.display = 'none';
		document.getElementById( passwordField ).focus();
	} else {
		if( input.value == defaultText ) {
			input.value = '';
		}
	}
}

function inputBoxBlur( input, defaultText, passwordField ) {
	if( input.value == '' ) {
		if( typeof( passwordField ) != 'undefined' ) {
			document.getElementById( passwordField ).style.display = 'none';
			document.getElementById( passwordField+'_text' ).style.display = '';
		} else {
			input.value = defaultText;
		}
	}
}