function Account(strLoginForm, isConsole)
{
	var m_content = document.getElementById("content_Account");

	var m_loginform = "loginform";
	if (strLoginForm!=null)
		m_loginform=strLoginForm;
		
	var m_isConsole=true;
	if (isConsole==false)
		m_isConsole=false;
	
	this.getUrl = function(url)
		{
			if (m_isConsole)
			{
				return url;
			}
			else
				return "../" + url;
		}
		
	this.getSecureUrl = function(url)
		{
			if (m_isConsole)
			{
				return "secure/"+url;
			}
			else
				return url;
		}
		
	this.displayTables=new Array();
	this.displayTables[this.displayTables.length]="login_accountTbl1";
	this.displayTables[this.displayTables.length]="account_changePasswordTbl";
	this.displayTables[this.displayTables.length]="account_passwordConfirmTbl";
	this.displayTables[this.displayTables.length]="account_forgotPasswordTbl";
	this.displayTables[this.displayTables.length]="account_forgotConfirmTbl";
	this.displayTables[this.displayTables.length]="account_unlockAccountTbl";
	this.displayTables[this.displayTables.length]="account_newSignupTbl";
	this.displayTables[this.displayTables.length]="account_updateConfirmTbl";
	this.displayTables[this.displayTables.length]="account_contactSupportTbl";
	this.displayTables[this.displayTables.length]="account_contactSupportConfirmTbl";
	
	this.hideDisplayTables = function()
		{
			for (var i=0; i<this.displayTables.length; i++)
			{
			   var tbl=document.getElementById(this.displayTables[i]);
			   if (tbl!=null)
			      tbl.style.display="none";
			}
		}
	
	this.display = function()
		{
			//if (window.navTabClick)
			//   navTabClick(-1);
			_account.hideDisplayTables();

		}

	this.getAccount = function()
		{
			var args = new Object();
			_console.getComponentContent(this.getSecureUrl("account"), args, this.getAccountCallBack, true);
			_util.cancelEvt(window.event);
		}

	this.getAccountBillingInfo = function()
		{
			var args = new Object();
			args.editbilling=true;
			_console.getComponentContent(this.getSecureUrl("account"), args, this.getAccountCallBack, true);
			_util.cancelEvt(window.event);

			if (document.getElementById("account_updateConfirmTbl")!=null)
				document.getElementById("account_updateConfirmTbl").style.display = "none";
			if (document.getElementById("account_passwordConfirmTbl")!=null)
				document.getElementById("account_passwordConfirmTbl").style.display = "none";
		}

	this.getAccountContactInfo = function()
		{
			var args = new Object();
			args.editaddress=true;
			_console.getComponentContent(this.getSecureUrl("account"), args, this.getAccountCallBack, true);
			_util.cancelEvt(window.event);

			if (document.getElementById("account_updateConfirmTbl")!=null)
				document.getElementById("account_updateConfirmTbl").style.display = "none";
			if (document.getElementById("account_passwordConfirmTbl")!=null)
				document.getElementById("account_passwordConfirmTbl").style.display = "none";
		}

	this.getAccountPreferencesInfo = function()
		{
			var args = new Object();
			args.editprefs=true;
			_console.getComponentContent(this.getSecureUrl("account"), args, this.getAccountCallBack, true);
			_util.cancelEvt(window.event);

			if (document.getElementById("account_updateConfirmTbl")!=null)
				document.getElementById("account_updateConfirmTbl").style.display = "none";
			if (document.getElementById("account_passwordConfirmTbl")!=null)
				document.getElementById("account_passwordConfirmTbl").style.display = "none";
		}
		
	this.getAccountTokenInfo = function()
		{
			var args = new Object();
			args.edittoken=true;
			_console.getComponentContent(this.getSecureUrl("account"), args, this.getAccountCallBack, true);
			_util.cancelEvt(window.event);
		}
		
	this.getAccountCallBack = function(result)
		{
			m_content.innerHTML = result;

			if (document.getElementById("notloggedintbl")!=null)
			{
				document.getElementById("notloggedintbl").style.display="none";
				alert(getLocalizedString("you_must_be_logged_in"));
				
				if (_util.isie)
					window.close();
				else
					top.close();
			}
		}

	this.updateUser = function()
		{
			var args=this.validateUserArgs();
			if (args==null)
			   return;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}

	this.updateAccount = function()
		{
			var args=this.validateAccountArgs();
			if (args==null)
			   return;

			// Attach user/pw to submission
			var username = document.getElementById("login_username").value;
			var password = document.getElementById("login_password").value;
			args.username = _util.trim(username);
			args.password = password;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}

	this.changeLocale = function(strLocale)
		{
			var args=new Object();
			args.locale=strLocale;
			_console.getComponentContent(this.getUrl("servlets/changelocale"), args, this.changeLocaleCallback, true);
		}

	this.changeLocaleCallback = function(xml)
		{
			try
			{
				var strRefresh=_util.selectSingleNodeText(xml, "/result/data/refresh");
				if(strRefresh!=null && strRefresh.length>0)
				{
					window.location.href = _account.getSecureUrl(m_loginform);
					return;
				}
			}
			catch (e)
			{
				alert("changeLocaleCallback:  Invalid xml value: '"+xml+"'");
				return;
			}


		}

	this.changeLocale_LoggedIn = function(strLocale)
		{
			var args=new Object();
			args.locale=strLocale;
			_console.getComponentContent(this.getUrl("servlets/changelocale"), args, this.changeLocaleCallback_LoggedIn, true);
		}

	this.changeLocaleCallback_LoggedIn = function(xml)
		{
			try
			{
				var strRefresh=_util.selectSingleNodeText(xml, "/result/data/refresh");
				if(strRefresh!=null && strRefresh.length>0)
				{
					var strURL=_account.getUrl("console");

					var tr=document.getElementById("centerIceTr");
					if (tr!=null && tr.style.display=="")
						strURL += "?product=SEASON";

					window.location.href = strURL;
					return;
				}
			}
			catch (e)
			{
				alert("changeLocaleCallback_LoggedIn:  Invalid xml value: '"+xml+"'");
				return;
			}
		}

	this.updateAccountPreferences = function()
		{
			var args=this.validatePreferencesArgs();
			if (args==null)
			   return;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}

	this.validatePreferencesArgs = function(args)	
		{
			if (window.__validatePreferencesArgs)
				return __validatePreferencesArgs(args);
		}

	this.updateAccountBilling = function()
		{
			var args=this.validateAccountArgs();
			if (args==null)
			   return;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}

	this.validateAccountArgs = function(args)	
		{
			var txtFullName=document.getElementById("txtFullName");
			var txtAddressLine1=document.getElementById("txtAddressLine1");
			var txtAddressLine2=document.getElementById("txtAddressLine2");
			var txtCity=document.getElementById("txtCity");
			var txtState=document.getElementById("txtState");
			var txtZip=document.getElementById("txtZip");
			var txtCountry=document.getElementById("txtCountry");
			var txtPhone=document.getElementById("txtPhone");
			
			var txtCCType=document.getElementById("txtCCType");
			var txtCCNumber=document.getElementById("txtCCNumber");
			var txtCCExpMonth=document.getElementById("txtCCExpMonth");
			var txtCCExpYear=document.getElementById("txtCCExpYear");
			
			var validationinfo=document.getElementById("divBillingValidationInfo");
			validationinfo.style.display="none";
			
			var arrErrors=new Array();
			
		
			txtFullName.className="input";
			txtAddressLine1.className="input";
			txtAddressLine2.className="input";
			txtCity.className="input";
			txtState.className="input";
			txtZip.className="input";
			txtCountry.className="input";
			
			if (txtPhone!=null)
				txtPhone.className="input";
	
			txtCCType.className="input";
			txtCCNumber.className="input";
			txtCCExpMonth.className="input";
			txtCCExpYear.className="input";

			if (txtAddressLine1.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("address1_required");
				txtAddressLine1.className="validation_error";
			}
			if (txtCity.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("city_required");
				txtCity.className="validation_error";
			}
			if (txtCountry.value=="US" || txtCountry.value=="CA")
			{
				if (txtState.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("state_required");
					txtState.className="validation_error";
				}
			}
			if (txtZip.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("zip_required");
				txtZip.className="validation_error";
			}
			
			if (txtPhone!=null)
			{
				txtPhone.value=_util.trim(txtPhone.value);

				var objRegExp  = /^[0-9]{10}$/i;
				var bValid=objRegExp.test(txtPhone.value);
				if (bValid)
					txtPhone.value=txtPhone.value.substring(0,3)+"-"+txtPhone.value.substring(3,6)+"-"+txtPhone.value.substring(6);

				if (txtPhone.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("enter_valid_phone");
					txtPhone.className="validation_error";
				}
				else if (txtCountry.value=="US" || txtCountry.value=="CA")
				{
					var objRegExp  = /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{3}-[a-zA-Z0-9]{4}$/i;
					var bValid=objRegExp.test(txtPhone.value);
					if (!bValid)
					{
						arrErrors[arrErrors.length]=getLocalizedString("enter_valid_phone");
						txtPhone.className="validation_error";
					}
				}
				else // Non-US Phone Number
				{
					var objRegExp = /(^[0-9]{1,3}-[0-9]{3,5}-[a-zA-Z0-9]{1,10}$)|(^[0-9]{1,3}-[a-zA-Z0-9]{1,10}$)/i;
					var bValid=objRegExp.test(txtPhone.value);
					if (!bValid)
					{
						arrErrors[arrErrors.length]=getLocalizedString("enter_valid_phone_non_us");
						txtPhone.className="validation_error";
					}
				}
			}
			
			if (window.g_validateCreditCard!=false)
			{
				if (txtFullName.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("full_name_required");
					txtFullName.className="validation_error";
				}
				if (txtCCNumber.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("cc_number_required");
					txtCCNumber.className="validation_error";
				}
				if (txtCCExpMonth.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("cc_expmonth_required");
					txtCCExpMonth.className="validation_error";
				}
				if (txtCCExpYear.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("cc_expyear_required");
					txtCCExpYear.className="validation_error";
				}
			}
			
			if (arrErrors.length>0)
			{
				var strMsg="<b>"+getLocalizedString("validation_error")+"</b><br/>";
				strMsg+=arrErrors.join("<br>");   // No room for all messages at once...
				// strMsg+=getLocalizedString("all_fields_required");
				validationinfo.innerHTML=strMsg;
				validationinfo.style.display="";
				return null;
			}

			var args=new Object();
			args.billing=true;
			
			if (document.getElementById("rbChargeType_0").checked==true)
				args.chargetype=0;
			else
				args.chargetype=1;
							
			args.cardholder=txtFullName.value;
			args.address1=txtAddressLine1.value;
			args.address2=txtAddressLine2.value;
			args.city=txtCity.value;
			args.state=txtState.value;
			args.zip=txtZip.value;
			args.country=txtCountry.value;

			if (txtPhone!=null)
				args.phone=txtPhone.value;

			args.cardtype=txtCCType.value;
			args.cardnumber=txtCCNumber.value;
			args.cardexpmonth=txtCCExpMonth.value;
			args.cardexpyear=txtCCExpYear.value;

			return args;
			
		}		

	this.updateAccountAddress = function()
		{
			var args=this.validateAccountAddressArgs();
			if (args==null)
			   return;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}
		
	this.validateAccountAddressArgs = function(args)	
		{
			var txtAddressLine1=document.getElementById("txtAddressLine1");
			var txtAddressLine2=document.getElementById("txtAddressLine2");
			var txtCity=document.getElementById("txtCity");
			var txtState=document.getElementById("txtState");
			var txtZip=document.getElementById("txtZip");
			var txtCountry=document.getElementById("txtCountry");
			var txtPhone=document.getElementById("txtPhone");

			var validationinfo=document.getElementById("divAddressValidationInfo");
			validationinfo.style.display="none";
			
			var arrErrors=new Array();
			
			txtAddressLine1.className="input";
			txtAddressLine2.className="input";
			txtCity.className="input";
			txtState.className="input";
			txtZip.className="input";
			txtCountry.className="input";
			txtPhone.className="input";

			if (txtAddressLine1.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("address1_required");
				txtAddressLine1.className="validation_error";
			}
			if (txtCity.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("city_required");
				txtCity.className="validation_error";
			}
			if (txtCountry.value=="US" || txtCountry.value=="CA")
			{
				if (txtState.value=="")
				{
					arrErrors[arrErrors.length]=getLocalizedString("state_required");
					txtState.className="validation_error";
				}
			}
			if (txtZip.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("zip_required");
				txtZip.className="validation_error";
			}
			if (txtCountry.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("country_required");
				txtCountry.className="validation_error";
			}
			if (txtPhone.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("phone_required");
				txtPhone.className="validation_error";
			}
			else
			{
				var objRegExp  = /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{3}-[a-zA-Z0-9]{4}$/i;
				var bValid=objRegExp.test(txtPhone.value);
				if (!bValid)
				{
					arrErrors[arrErrors.length]=getLocalizedString("enter_valid_phone");
					txtPhone.className="validation_error";
				}
			}

			if (arrErrors.length>0)
			{
				var strMsg="<b>"+getLocalizedString("validation_error")+"</b><br/>";
				strMsg+=arrErrors.join("<br>");   // No room for all messages at once...
				// strMsg+="* All fields are required.  Please enter values in all of the fields below.";
				validationinfo.innerHTML=strMsg;
				validationinfo.style.display="";
				return null;
			}

			var args=new Object();
			args.address=true;
			args.address1=txtAddressLine1.value;
			args.address2=txtAddressLine2.value;
			args.city=txtCity.value;
			if (txtCountry.value=="US" || txtCountry.value=="CA")
				args.state=txtState.value;
			else
				args.state="";
			args.zip=txtZip.value;
			args.country=txtCountry.value;
			args.phone=txtPhone.value;

			return args;
		}		

	this.updateAccountToken = function()
		{
			var args=this.validateAccountTokenArgs();
			if (args==null)
			   return;

			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}
		
	this.validateAccountTokenArgs = function(args)	
		{
			var token1=document.getElementById("txtToken1");
			var token2=document.getElementById("txtToken2");
			var token3=document.getElementById("txtToken3");

			var validationinfo=document.getElementById("divTokenValidationInfo");
			if(token1!=null)
			{
				token1.className="input";
				token2.className="input";
				token3.className="input";
			}
			validationinfo.style.display="none";

			var arrErrors=new Array();

			if(token1!=null)
			{
				if (token1.value.length!=4 || token2.value.length!=4 || token3.value.length!=4)
				{
					arrErrors[arrErrors.length]=getLocalizedString("enter_valid_auth_code");
					token1.className="validation_error";
					token2.className="validation_error";
					token3.className="validation_error";
				}
			}
			
			if (arrErrors.length>0)
			{
				var strMsg="<b>"+getLocalizedString("validation_error")+"</b><br/>";
				strMsg+=arrErrors.join("<br>");   // No room for all messages at once...
				// strMsg+="* All fields are required.  Please enter values in all of the fields below.";
				validationinfo.innerHTML=strMsg;
				validationinfo.style.display="";
				return null;
			}

			var args=new Object();
			if(token1!=null)
			{
				token1.value=token1.value.toUpperCase();
				token2.value=token2.value.toUpperCase();
				token3.value=token3.value.toUpperCase();
				args.token=token1.value+"-"+token2.value+"-"+token3.value;
			}

			return args;
		}		
		
	this.validateUserArgs = function(args)	
		{
			var email=document.getElementById("txtUserEmail");
			var firstname=document.getElementById("txtUserFirstName");
			var lastname=document.getElementById("txtUserLastName");
			var locale=document.getElementById("txtLocale");

			var validationinfo=document.getElementById("divAccountValidationInfo");
			var arrErrors=new Array();
			
			email.className="input";
			firstname.className="input";
			lastname.className="input";
			
			validationinfo.style.display="none";

			if (email.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("email_required");
				email.className="validation_error";
			}
			if (email.value.indexOf("@")<0 || email.value.indexOf(".")<0)
			{
				arrErrors[arrErrors.length]=getLocalizedString("enter_valid_email");
				email.className="validation_error";
			}
			if (firstname.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("first_name_required")
				firstname.className="validation_error";
			}
			if (lastname.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("last_name_required")
				lastname.className="validation_error";
			}
			
			if (arrErrors.length>0)
			{
				var strMsg="<b>"+getLocalizedString("validation_error")+"</b><br/>";
				strMsg+=arrErrors.join("<br>");
				validationinfo.innerHTML=strMsg;
				validationinfo.style.display="";
				return null;
			}
			else
			{
				var args=new Object();
				args.email=email.value;
				args.firstname=firstname.value;
				args.lastname=lastname.value;
				
				if (locale!=null)
					args.locale=locale.value;
				
				return args;
			}
			
		}

	this.accountCallback = function(xml)
		{
			if (_util.isDemoUser(xml)==true)
				return;

			var result = "";
			
			try
			{
				result = _util.selectSingleNodeText(xml, "/result/code");
				if (result==null)
				{ alert("AccountCallback:  Invalid returned xml");
				  return;
				}
			}
			catch (e)
			{
				alert("AccountCallback:  Invalid xml value: '"+xml+"'");
				return;
			}
			switch(result)
			{
			case "passwordsent":
				var btn=document.getElementById("btnSendPassword");
				if (btn)
					btn.disabled=true;
				document.getElementById("account_forgotConfirmTblMsg").innerHTML=getLocalizedString("your_password_has_been_sent");
				document.getElementById("account_forgotConfirmTbl").style.display = "";
				break;
			case "loginnotfound":
			case "loginnotfoundnoemail":
				document.getElementById("account_forgotConfirmTblMsg").innerHTML="<img src='../images/branding/validationerr.gif'/>&#xa0;<span style='color:red'>"+getLocalizedString("username_not_registered_contact_support")+"</span> <a href='mailto:"+getLocalizedString("support_email_address")+"'>"+getLocalizedString("support_email_address")+"</a>.";
				document.getElementById("account_forgotConfirmTbl").style.display = "";
				break;
			case "updatesuccess":
				// changed password info OR updated first/last name (both return the same code)
				document.getElementById("account_passwordConfirmTbl").style.display = "";
				var strRefresh=_util.selectSingleNodeText(xml, "/result/data/refresh");
				if(strRefresh!=null && strRefresh.length>0)
				{
					// var ret=confirm("You must refresh this page in order for language changes to take effect.  Do you want to refresh now?");
					// if (ret==true)
						window.location.href = _account.getUrl("console");
					return;
				}
				break;
			case "activationsent":
				// Do nothing for now
				break;
			case "billingupdatesuccess":
				document.getElementById("account_updateConfirmTbl").style.display = "";
				break;
			case "billingsignupsuccess":
			    // first time in
				alert(getLocalizedString("thank_you_for_signing_up"));
				_login.login();
				break;
			case "tokenupdatesuccess":
				document.getElementById("account_updateConfirmTbl").style.display = "";
				break;
			case "failedtoken":
				var validationinfo=document.getElementById("divTokenValidationInfo");
				validationinfo.innerHTML=getLocalizedString("type_in_auth_code_again");
				validationinfo.style.display="";
				document.getElementById("txtToken1").className="validation_error";
				document.getElementById("txtToken2").className="validation_error";
				document.getElementById("txtToken3").className="validation_error";
				//// _login.showRegistration();
				break;
			case "failedaddressstate":
				alert(getLocalizedString("state_country_combination_invalid"));
				document.getElementById("txtState").className="validation_error";
				document.getElementById("txtCountry").className="validation_error";
				break;
			case "addressupdatesuccess":
				document.getElementById("account_updateConfirmTbl").style.display = "";
				break;
			case "prefsupdatesuccess":
				document.getElementById("account_updateConfirmTbl").style.display = "";
				break;
			case "cardinvalid":
				alert(getLocalizedString("credit_card_invalid"));
				document.getElementById("txtCCNumber").className="validation_error";
				break;
			case "cardexpired":
				alert(getLocalizedString("credit_card_expired"));
				document.getElementById("txtCCNumber").className="validation_error";
				document.getElementById("txtCCExpMonth").className="validation_error";
				document.getElementById("txtCCExpYear").className="validation_error";
				break;
			case "loginfailed":     // Hacker attempt when calling billingsignup?
				alert(getLocalizedString("error_login_failed"));
				break;
			default:
				alert("Invalid Return Code: "+result);
				break;
			}
		}

	this.unlockCallback = function(xml)
		{
			var result = "";
			
			try
			{
				result = _util.selectSingleNodeText(xml, "/result/code");
				if (result==null)
				{ alert("UnlockCallback:  Invalid returned xml");
				  return;
				}
			}
			catch (e)
			{
				alert("UnlockCallback:  Invalid xml value: '"+xml+"' -- "+e.message);
				return;
			}
			switch(result)
			{
			case "unlocksent":
				var btn=document.getElementById("btnSendUnlock");
				if (btn)
					btn.disabled=true;
				document.getElementById("account_unlockConfirmTblMsg").innerHTML=getLocalizedString("unlock_request_received");
				document.getElementById("account_unlockConfirmTbl").style.display = "";
				break;
			case "loginnotfound":
			case "loginnotfoundnoemail":
				document.getElementById("account_unlockConfirmTblMsg").innerHTML="<img src='../images/branding/validationerr.gif'/>&#xa0;"+getLocalizedString("username_not_registered_contact_support")+" <a href='mailto:"+getLocalizedString("support_email_address")+"'>"+getLocalizedString("support_email_address")+"</a>.";
				document.getElementById("account_unlockConfirmTbl").style.display = "";
				break;
			default:
				alert("Invalid UnlockCallback Return Code: "+result);
				break;
			}
		}		

	this.showForgotPassword = function()
		{
			_console.showComponent('Account');
			this.hideDisplayTables();
			var btn=document.getElementById("btnSendPassword");
			if (btn)
				btn.disabled=false;
			document.getElementById("account_forgotEmail").value=document.getElementById("login_username").value;
			document.getElementById("account_forgotPasswordTbl").style.display = "";
			trackForgotPassword();
		}

	this.showUnlockAccount = function()
		{
			_console.showComponent('Account');
			this.hideDisplayTables();
			var btn=document.getElementById("btnSendUnlock");
			if (btn)
				btn.disabled=false;
			document.getElementById("account_unlockEmail").value=document.getElementById("login_username").value;
			document.getElementById("account_unlockAccountTbl").style.display = "";
			if(window.trackUnlock!=null)
				trackUnlock();
		}
	this.showContactSupport = function(track)
		{
			_console.showComponent('Account');
			this.hideDisplayTables();
			var btn=document.getElementById("btnContactSupport");
			if (btn)
				btn.disabled=false;
			document.getElementById("account_contactSupportTbl").style.display = "";
			if(track)
				trackContactSupport();
		}
	this.showChangePassword = function()
		{
			this.hideDisplayTables();
			document.getElementById("account_changePasswordTbl").style.display = "";			
		}
	this.showAccount = function()
		{
			if (window.navTabClick)
				navTabClick(-1);
			_console.showComponent('Account');
		}
	
	this.forgotPassword = function()
		{
			var strUsername=document.getElementById("account_forgotEmail").value;
			if (strUsername=="")
			{
				alert(getLocalizedString("enter_valid_username"));
				return;
			}
			var args=new Object();
			args.username=_util.trim(strUsername);

			_console.getComponentContent(this.getUrl("servlets/forgotpassword"), args, this.accountCallback, true);
		}

	this.unlockAccount = function()
		{
			var strUsername=document.getElementById("account_unlockEmail").value;
			if (strUsername=="")
			{
				alert(getLocalizedString("enter_valid_username_unlock"));
				return;
			}
			var args=new Object();
			args.username=_util.trim(strUsername);

			_console.getComponentContent(this.getUrl("servlets/sendunlock"), args, this.unlockCallback, true);
		}

	this.contactSupport = function()
		{
			var args=new Object();

			var oParams=_util.getURLParams();
			if (oParams && oParams.product=="SEASON")
				args.ci=true;

			args.name=document.getElementById("account_contactName").value;
			args.email=document.getElementById("account_contactEmail").value;
			args.category=document.getElementById("account_contactProblemCategory").value;
			args.details=document.getElementById("account_contactProblemDetails").value;

			if (args.name=="" || args.email=="" || args.category=="" || args.details=="")
			{
				alert(getLocalizedString("all_fields_required_validation"));
				return;
			}
			if (args.details.length > 1000)
			{
				alert(getLocalizedString("enter_text_max")+args.details.length);
				return;
			}
			var objRegExp  = /(^[a-zA-Z0-9]([a-zA-Z0-9_\-\~\.]*)@([a-zA-Z0-9_\-\.]*)([.][a-zA-Z]{3})$)|(^[a-zA-Z0-9]([a-zA-Z0-9_\.]*)@([a-zA-Z0-9_\-\.]*)(\.[a-zA-Z]{2,3})(\.[a-zA_Z]{2})*$)/i;

			var bValid=objRegExp.test(args.email);
			if (!bValid)
			{
				alert(getLocalizedString("enter_valid_email"));
				return;
			}

			_console.getComponentContent(this.getUrl("servlets/contactsupport"), args, this.contactSupportCallback, true);
		}

	this.contactSupportCallback = function(result)
		{
			var btn=document.getElementById("btnContactSupport");
			if (btn)
				btn.disabled=true;
			document.getElementById("account_contactSupportConfirmTbl").style.display="";
		}

	this.sendActivation = function()
		{
			var strUsername=document.getElementById("login_username").value;
			if (strUsername=="")
			{
				alert(getLocalizedString("enter_valid_username"));
				return;
			}
			var args=new Object();
			args.username=strUsername;

			_console.getComponentContent(this.getUrl("servlets/sendactivation"), args, this.accountCallback, true);
			alert(getLocalizedString("activation_email_sent_to")+" "+strUsername);
		}

	this.changePassword = function()
		{
			var password=document.getElementById("txtChangePassword");
			var verify=document.getElementById("txtChangeVerify");

			var validationinfo=document.getElementById("divChangePasswordValidationInfo");
			var arrErrors=new Array();

			password.className="input";
			verify.className="input";
			validationinfo.style.display="none";

			if (password.value=="")
			{
				arrErrors[arrErrors.length]=getLocalizedString("password_is_required");
				password.className="validation_error";
				verify.className="validation_error";
			}
			else if (password.value!=verify.value)
			{
				arrErrors[arrErrors.length]=getLocalizedString("password_confirm_do_not_match");
				password.className="validation_error";
				verify.className="validation_error";
			}
			else if (password.value.length<6 || password.value.indexOf(" ")>=0)
			{
				arrErrors[arrErrors.length]=getLocalizedString("password_invalid");
				password.className="validation_error";
				verify.className="validation_error";
			}

			if (arrErrors.length>0)
			{
				var strMsg="<b>"+getLocalizedString("validation_error")+"</b><br/>";
				strMsg+=arrErrors.join("<br/>");
				validationinfo.innerHTML=strMsg;
				validationinfo.style.display="";
				return;
			}

			var args=new Object();
			args.password=password.value;
			
			_console.getComponentContent(this.getSecureUrl("accountupdate"), args, this.accountCallback, true);
		}
		
}

