var selectedName = "";
var currentName = "";
var imgLibrary;
var imgCompartment;
var imgBlog;
var imgBBS;
var imgClass;
var imgItemGet;
var imgPresent;
var imgRevival;

function PreLoadImages()
{
	imgLibrary = new Image();
	imgCompartment = new Image();
	imgBlog = new Image();
	imgBBS = new Image();
	imgClass = new Image();
	imgItemGet = new Image();
	imgPresent = new Image();
	imgRevival = new Image();

	imgLibrary.Name = "library";
	imgCompartment.Name = "compartment";
	imgBlog.Name = "blog";
	imgBBS.Name = "bbs";
	imgClass.Name = "class";
	imgItemGet.Name = "item-get";
	imgPresent.Name = "present";
	imgRevival.Name = "revival";

	imgLibrary.src = "/scm_pub/img/button/library_on.gif";
	imgCompartment.src = "/scm_pub/img/button/compartment_on.gif";
	imgBlog.src = "/scm_pub/img/button/blog_on.gif";
	imgBBS.src = "/scm_pub/img/button/bbs_on.gif";
	imgClass.src = "/scm_pub/img/button/class_on.gif";
	imgItemGet.src = "/scm_pub/img/button/item-get_on.gif";
	imgPresent.src = "/scm_pub/img/button/present_on.gif";
	imgRevival.src = "/scm_pub/img/button/revival_on.gif";
}

function SwapImage(imgname)
{
	document.images[imgname].src = "/scm_pub/img/button/" + imgname + "_on.gif";
	currentName = imgname;
}

function RestoreImage(imgname)
{
	if( selectedName != imgname )
	{
		document.images[imgname].src = "/scm_pub/img/button/" + imgname + "_off.gif";
	}
}

function SetSelectedName(name)
{
	var contents = new Array("library","compartment","blog","bbs","class","item-get","present","revival");

	for(i=0; i<contents.length; i++ )
	{
		if( contents[i] != currentName )
		{
			document.images[contents[i]].src = "/scm_pub/img/button/" + contents[i] + "_off.gif";
		}
	}
	
	selectedName = name;
}
