function strTrim(tmpStr)
{
	var i;
	for (i=0; i < tmpStr.length; ++i)
		if (tmpStr.charAt(i) != " ") break;
	tmpStr = tmpStr.substring(i);
	for (i=tmpStr.length - 1; i >= 0; --i)
		if (tmpStr.charAt(i) != " ") break;
	tmpStr = tmpStr.substring(0, i + 1);
	return tmpStr;
}
//-------------------------------------------------------------
function chkName(tmpStr)
{
    var i = 0, tmpChar = "";
    for (i = 0; i < tmpStr.length; i++)
    {
    	tmpChar = tmpStr.charAt(i);
		if (!((tmpChar >= "A" && tmpChar <= "Z")
			|| (tmpChar >= "a" && tmpChar <= "z")
			|| (tmpChar == " ")
			|| (tmpChar == "'")))
		return false;
	}
    return true;
}
//-------------------------------------------------------------
function chkEmail(tmpStr)
{
	var i;
	var posAt = 0;
	var posDot = 0
	var count = 0;
	for(i=0;i<tmpStr.length;++i)
	{
		if(tmpStr.charAt(i) == "@")
		{
			posAt = i;
			count++;
		}
		if(tmpStr.charAt(i) == ".")
		{
			posDot = i;
		}
		if (!((tmpStr.charAt(i) >= "0" && tmpStr.charAt(i) <= "9")
				||(tmpStr.charAt(i) >= "a" && tmpStr.charAt(i) <= "z")
				|| (tmpStr.charAt(i)>= "A" && tmpStr.charAt(i) <= "Z")
				|| (tmpStr.charAt(i) == "-")
				|| (tmpStr.charAt(i) == "_")
				|| (tmpStr.charAt(i) == "@")
				|| (tmpStr.charAt(i) == ".")
			)) return false;
	}
	if(count>1) return false;
	if(eval(posAt) > 1 && posAt != tmpStr.length-1 && posDot > posAt && posDot != tmpStr.length-1) return true;
	return false;
}
//-------------------------------------------------------------
function openPictureWindow(imageName,imageWidth,imageHeight,alt)
{
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left=100,top=100");
	var doc = newWindow.document;
	doc.open();
	doc.write('<html>\n');
	doc.write('<head>\n');
	doc.write('<title>'+alt+'</title>\n');
	doc.write('<meta http-equiv="imagetoolbar" content="no">\n');
	doc.write('</head>\n');
	doc.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" ondblclick="self.close();" onblur="self.close();">\n');
	doc.write('<img src=\"'+imageName+'\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\" alt=\"'+alt+'\n(Double Click to Close)\" border="0">\n');
	doc.write('</body>\n');
	doc.write('</html>\n');
	doc.close();
	newWindow.focus();
}
