//------------------------------------------------------------------------------
// Class:  UserInfo
//------------------------------------------------------------------------------
// Author:  JY
// Date:  2007/03/19
// Description:  This class defines the functions used by User Info tab
//               under Manage Account.
//------------------------------------------------------------------------------
function UserInfo()
{
	// Variables:
	var maxMsgLength = 4000;
	
	//--------------------------------------------------------------------------

	// Methods:
	this.updateCharCount = updateCharCount;
	this.updateUserProfile = updateUserProfile;
	this.previewUserProfile = previewUserProfile;

	//--------------------------------------------------------------------------

	function updateCharCount(textarea, alertField)
	{
		if (textarea.value.length > maxMsgLength)
		{
			textarea.value = textarea.value.substr(0, maxMsgLength);
			alertField.value = maxMsgLength - textarea.value.length;
			//document.getElementById('frmErr').style.display = "block";
			//document.getElementById('frmErr').innerHTML = '* Your message must have ' + maxMsgLength + ' chars or less.';
		}
		else
		{
			alertField.value = maxMsgLength - textarea.value.length;
		}
	}
	
	//--------------------------------------------------------------------------

	function updateUserProfile(URL)
	{
		document.frmUserProfileInfo.isSave.value = 1;
		document.frmUserProfileInfo.submit();
	}
	
	//--------------------------------------------------------------------------

	function previewUserProfile(URL)
	{
		//var popUp = window.open('', 'PreviewForum', 'toolbar=no,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=900,height=600,left=122,top=0');
		var popUp = dhtmlwindow.open("PreviewForum", "iframe", "about:blank", "Preview User Profile", "width=900px,height=600px,resize=1,scrolling=1,center=1", "recal");
		document.frmUserProfileInfo.isPreview.value = 1;
		document.frmUserProfileInfo.isSave.value = 0;
		//document.frmUserProfileInfo.target = 'PreviewForum';
		document.frmUserProfileInfo.target = '_iframe-PreviewForum';
		document.frmUserProfileInfo.action = URL;
		document.frmUserProfileInfo.submit();
		popUp.focus();
		document.frmUserProfileInfo.target = 'parent';
		document.frmUserProfileInfo.isPreview.value = 0;
		document.frmUserProfileInfo.action = "";
	}
	

}

// Create UserInfo object.
oUserInfo = new UserInfo();
