function revealImg(element,imgName) { 
	var e = document.getElementById(element); 
	if (e){ 
		e.innerHTML = "";
		var img = document.createElement("img");
		img.src = g_imgPath + imgName + ".jpg";
		img.setAttribute("align","left");
		e.appendChild(img); 
		var a = document.createElement("a");
		a.setAttribute("href","javascript:hideImg('" + e.id + "')");
		a.innerHTML = "x";
		a.className = "imgCloser";
		e.appendChild(a);
		e.style.display = ""; 
	} 
} 
function hideImg(element){ 
	if (document.getElementById(element)){ 
		document.getElementById(element).style.display = "none"; 
	}  
}
var g_imgPath;
function writeImgLink(imgName)	{
	if (g_imgPath)	{		
		var str = "";
		str += '<a href="javascript:revealImg(\'img' + imgName + '\',\''
			+ imgName 
			+ '\')"><img src="' + g_imgPath + imgName + '_t.jpg" align="left" border="1" class="thumbnail" /></a>'
			+ '<div id="img' + imgName 
			+ '" class="hiddenPic" style="display:none">&nbsp;</div><br clear="all"/>';
		return str;
	}
}

function getElement(e)	{
	if (document.getElementById(e))	{
		return document.getElementById(e);
	}
	return null;
}
function trimStr(a)	{
	return a.replace(/^\s+/,'').replace(/\s+$/,'');
}


function doImgLink(imgName)	{
	if (g_imgPath)	{	
		var A = document.createElement("A");
		A.setAttribute("href","javascript:getRevealImg('" + g_imgPath + "','" + imgName + "')");
		A.innerHTML = "<img src=\"" + g_imgPath + imgName + "_t.jpg\" align=\"left\" border=\"1\" class=\"thumbnail\" />";
		var D = document.createElement("DIV");
		D.setAttribute("id","div_" + imgName);
		D.className = "hiddenPic";
		D.style.display = "none";
		D.innerHTML = "&nbsp;";
		document.getElementById(imgName).appendChild(A);
		document.getElementById(imgName).appendChild(D);
	}
}
function getRevealImg(path,name)	{
	var e = document.getElementById("div_" + name); 
	if (e){ 
		e.innerHTML = "";
		var img = document.createElement("img");
		img.src = path + name + ".jpg";
		img.setAttribute("align","left");
		e.appendChild(img); 
		var a = document.createElement("a");
		a.setAttribute("href","javascript:hideImg('" + e.id + "')");
		a.innerHTML = "x";
		a.className = "imgCloser";
		e.appendChild(a);
		e.style.display = ""; 
	} 
}