function showPicture(name, width, height)
{
	url = "show_picture.php?PN=" + name;

	name = name.replace(/\//g, "");
	name = name.replace(/\./g, "");

	openNewWindow(url, name, width, height, 3);
}

function MM_openBrWindow(theURL, winName, features)
{
    window.open(theURL, winName, features);
}

function openNewWindow(url, name, width, height, style)
{
	if (style == 1)
    {
		newWindow = window.open(url, name, "width=" + width + ", height=" + height + ", menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=no, location=no");
    }
	else if (style == 2)
    {
		newWindow = window.open(url, name, "width=" + width + ", height=" + height + ", menubar=yes, toolbar=no, resizable=yes, scrollbars=yes, status=no, location=no");
    }
	else if (style == 3)
    {
		newWindow = window.open(url, name, "width=" + width + ", height=" + height + ", menubar=no, toolbar=no, resizable=no, scrollbars=no, status=no, location=no");
    }
	else
    {
		newWindow = window.open(url, name, "width=" + width + ", height=" + height + ", menubar=yes, toolbar=yes, resizable=yes, scrollbars=yes, status=yes, location=yes");
    }

	newWindow.focus();
}


function closeWindow()
{
	opener.focus();
	window.close();
}

function button(image, title, target, style, language)
{
	var bgcolor = "#eeeeee";
	var lborder = "#a5a5a5";
	var dborder = "#555555";

	if (style == 1)
	{
		bgcolor = "#eeeeee";
		lborder = "#a5a5a5";
		dborder = "#555555";
	}
	else if (style == 2)
	{
		bgcolor = "#d2d2d2";
		lborder = "#ffffff";
		dborder = "#a5a5a5";
	}
	else if (style == 3)
	{
		bgcolor = "#dddddd";
		lborder = "#ffffff";
		dborder = "#a5a5a5";
	}
	else if (style == 4)
	{
		bgcolor = "#dddddd";
		lborder = "#a5a5a5";
		dborder = "#ffffff";
	}
	else if (style == 5)
	{
		bgcolor = "#dddddd";
		lborder = "#ffffff";
		dborder = "#aaaaaa";
	}
	else if (style == 6)
	{
		bgcolor = "#d2d2d2";
		lborder = "#ffffff";
		dborder = "#a5a5a5";
	}

	document.write("<table border='0' cellpadding='0' cellspacing='0'>");
	document.write(" <tr>");
	document.write("  <td bgcolor='"+lborder+"' height='1' colspan='7'><img src='#WebRoot()#/images/others/space.gif' width='1' height='1'></td>");
	document.write(" </tr>");
	document.write(" <tr valign='middle'>");
	document.write("  <td bgcolor='"+lborder+"' width='1' height='21'><img src='#WebRoot()#/images/others/space.gif' width='1' height='1'></td>");
	document.write("  <td bgcolor='"+bgcolor+"' width='5' height='21'><img src='#WebRoot()#/images/others/space.gif' width='5' height='1'></td>");

	if ((style != 3) && (style != 4) && (style != 6))
	{
		document.write("  <td bgcolor='"+bgcolor+"' width='14' height='21'><a href='"+target+"' onmouseover='window.status=\""+title+"\";return true;' onmouseout='window.status=\"\";return true;'><img src='images/actions/"+image+".gif' border='0' width='18' height='13'></a></td>");
		document.write("  <td bgcolor='"+bgcolor+"' width='5' height='21'><img src='#WebRoot()#/images/others/space.gif' width='5' height='1'></td>");
	}

	document.write("  <td bgcolor='"+bgcolor+"' height='21' nowrap><a href='"+target+"' onmouseover='window.status=\""+title+"\";return true;' onmouseout='window.status=\"\";return true;'><span class='buttons'>"+title+"</span></a></td>");
	document.write("  <td bgcolor='"+bgcolor+"' width='5' height='21'><img src='#WebRoot()#/images/others/space.gif' width='5' height='1'></td>");
	document.write("  <td bgcolor='"+dborder+"' width='1' height='21'><img src='#WebRoot()#/images/others/space.gif' width='1' height='1'></td>");
	document.write(" </tr>");
	document.write(" <tr>");
	document.write("  <td bgcolor='"+dborder+"' height='1' colspan='7'><img src='#WebRoot()#/images/others/space.gif' width='1' height='1'></td>");
	document.write(" </tr>");
	document.write("</table>");
}

function submitForm(formName)
{
	document.forms[formName].submit();
}

function showGalleryImage(imageSource, width, height)
{
    var galleryImageDiv = document.getElementById("GalleryImageDiv");
    var galleryImage = document.getElementById("GalleryImage");

    galleryImageDiv.style.visibility = "visible";
    galleryImage.src = imageSource;
    galleryImage.width = width;
    galleryImage.height = height;

    galleryImageDiv.style.left =
        mousePositionX - width / 2;
}

function closeGalleryImage()
{
    var galleryImageDiv = document.getElementById("GalleryImageDiv");
    galleryImageDiv.style.visibility = "hidden";
}
