function GA_OpenScreen(sScreen, sTitle)
{
	var oDialog = new vdf.gui.ModalDialog();
	var oScreen = document.getElementById(sScreen);

	oDialog.sTitle = sTitle;

	oDialog.addButton("Save", "Save", "btnSave");
	oDialog.addButton("Cancel", "Cancel", "btnCancel");
	oDialog.onButtonClick.addListener(GA_onOpenScreenButtonClick);

	oDialog.displayDOM(oScreen);
	
	var eMask = vdf.gui.getCurrentModalDialog().eDivMask;
	vdf.sys.gui.setOpacity(eMask, 0);
}

function GA_ScreenInfo(sEmail, sSessionToken)
{
	var oAIC = new vdf.ajax.SoapCall("AccountInfo", {}, "GA_Proxy.asp");

	oAIC.addParam("sSessionToken", GA_GetCookie("vdfSessionKey"));
	oAIC.addParam("sEmail", GA_GetCookie("gaEmail"));
	oAIC.addParam("sIp", GA_IP);
	oAIC.onFinished.addListener(GA_handleScreenInfo);
	oAIC.send(true);
}

function GA_handleScreenInfo(oEvent) 
{
	var tAccInfo = null;
	var oWelcomeBar = document.getElementById("GA_WelcomeBar");
	var oLogoutButton = document.getElementById("GA_LogoutButton");
	var oCustomClientInfo = document.getElementById("GA_CustomClientInfo");
	var sHtml = "";
	var oCustomClientName = document.getElementById("GA_CustomClientName");
	var oCustomClientEmail = document.getElementById("GA_CustomClientEmail");
	var oCustomClientCompany = document.getElementById("GA_CustomClientCompany");
	var sCompany = "";
	
	if (!GA_CallFailed(oEvent))
	{
		tAccInfo = GA_CallValue(oEvent);
		
		if (tAccInfo.sEmail == "")
		{
			return;
		}
		
		if (oWelcomeBar)
		{
			oWelcomeBar.innerHTML = "Welcome " + tAccInfo.sFirstName;
		}
		
		if (oLogoutButton)
		{
			oLogoutButton.style.display = "block";
		}
		
		if (oCustomClientInfo)
		{
			if (oCustomClientName)
			{			
				oCustomClientName.innerHTML = "<span>Name:</span> " + tAccInfo.sFirstName + " " + tAccInfo.sLastName;
			}
			
			if (oCustomClientEmail)
			{
				oCustomClientEmail.innerHTML = "<span>Email:</span> " + tAccInfo.sEmail;
			}
			
			if (oCustomClientCompany)
			{
				sCompany = tAccInfo.sCompanyName;
				
				if (GA_IsNothing(sCompany))
				{
					sCompany = "(none)";
				}
			
				oCustomClientCompany.innerHTML = "<span>Company:</span> " + sCompany;
			}
		
			if (oCustomClientName || oCustomClientEmail || oCustomClientCompany)
			{		
				oCustomClientInfo.style.display = "block";
			}
		}
	}
}

function GA_onOpenScreenButtonClick(oEvent)
{
	switch (oEvent.sButtonName)
	{
		case "Save":
			GA_PasswordUpdate();
			break;
		case "Cancel":
			vdf.gui.closeModalDialog();
		break;
	}
}

function GA_CurrentEventHasOpt()
{
	var oRows = GA_get_ElementsByName("TR", "isEventRow");
	
	var oElement = null;
	var i = 0;
	
	for (i = 0; i < oRows.length; i++)
	{
		oElement = oRows[i].firstChild.children[0];
		
		if (oElement.attributes["isEvOpt"] != null && oRows[i].parentNode.parentNode.parentNode.id != "hiddenEvOpt")
		{
			return true;
		}
	}
	
	return false;
}

function GA_NotificationUnsubscribe()
{
	var sSubs = new Array();
	var oSelect = document.getElementById("GA_frmAccNotifySub").UserSubscriptions;
	var oUSC = new vdf.ajax.SoapCall("NotificationUnsubscribe", {}, "GA_Proxy.asp");

	if (oSelect.selectedIndex != -1)
	{
		sSubs.push(oSelect.value);

		oUSC.addParam("sSessionToken", GA_GetCookie("vdfSessionKey"));
		oUSC.addParam("sEmail", GA_GetCookie("gaEmail"));
		oUSC.addParam("sIp", GA_IP);
		oUSC.addParam("sSubs", sSubs);
		oUSC.onFinished.addListener(GA_handleNotificationUnsubscribe);
		oUSC.send(true);
	}
}

function GA_handleNotificationUnsubscribe(oEvent) 
{
	var oSelect = document.getElementById("GA_frmAccNotifySub").UserSubscriptions;
	
	if (!GA_CallFailed(oEvent))
	{
		if (GA_CallValue(oEvent) == 0)
		{
			oSelect.remove(oSelect.selectedIndex);
			alert("You are no longer subscribed to this topic.");
		}
		
		document.getElementById("btnTopicUnsubscribe").disabled = (oSelect.options.length == 0);
	}
}

function GA_ShowEventOpts(oElement)
{
	var iPrev = oElement.attributes["prev"].nodeValue;
	var iNext = oElement.value;
	var oContainer = document.getElementById("hiddenEvOpt");
	var oOptCon = document.getElementById("AccEvOpts");
	
	if (iPrev != 0 && iPrev != "")
	{
		oContainer.appendChild(document.getElementById("EvenOptOf" + iPrev));
	}
	
	if (iNext != "")
	{			
		oOptCon.appendChild(document.getElementById("EvenOptOf" + iNext));
	}
	
	oElement.attributes["prev"].nodeValue = iNext;
}

function GA_AccountCheck()
{
	var sEmail = GA_TrimString(document.getElementById("GA_frmAccountCheck").EmailAddress.value);
	var sReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (sReg.test(sEmail))
	{	
		document.getElementById("GA_frmAccountCheck").EmailAddress.value = sEmail;
		
		var oACC = new vdf.ajax.SoapCall("AccountCheck", {}, "GA_Proxy.asp");
		oACC.addParam("sEmail", sEmail);
		oACC.onFinished.addListener(GA_handleAccountCheck);
		oACC.send(false);
	}
	else
	{
		alert("Your e-mail address appears to be invalid. Please make sure it's entered correctly.");
	}
}

function GA_handleAccountCheck(oEvent) 
{
	if (!GA_CallFailed(oEvent))
	{
		if (GA_CallValue(oEvent) == 0)
		{
			// Non existing email address
			if (confirm("It seems we have no record of you in our Global Account database yet. Would you like to create your account?"))
			{ 
				document.getElementById("GA_divAccountEntry_spanEmail").innerHTML = document.getElementById("GA_frmAccountCheck").EmailAddress.value;
				GA_ShowScreen("GA_divAccountEntry");
				document.getElementById("GA_frmAccountEntry").FirstName.focus();
			}
		}
		else if (GA_CallValue(oEvent) == 1)
		{
			// Existing email address but no account
			document.getElementById("GA_frmGeneratePass_spanEmail").innerHTML = document.getElementById("GA_frmAccountCheck").EmailAddress.value;
			GA_ShowScreen("GA_divGeneratePass");

		}
		else if (GA_CallValue(oEvent) == 2)
		{
			// Existing email, but not yet activated
			document.getElementById("GA_frmAccountLogin").EmailAddress.value = document.getElementById("GA_frmAccountCheck").EmailAddress.value;
			GA_ShowScreen("GA_divAccountActivate");
		}
		else if (GA_CallValue(oEvent) == 3)
		{
			// Existing email and account
			document.getElementById("GA_frmAccountLogin").EmailAddress.value = document.getElementById("GA_frmAccountCheck").EmailAddress.value;
			GA_ShowScreen("GA_divAccountLogin");
			document.getElementById("GA_frmAccountLogin").Password.focus();
		}
	}
}

function GA_PasswordReset()
{
	var sEmail = document.getElementById("GA_frmAccountCheck").EmailAddress.value;
	var sReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if (confirm("Would you like to reset your Global Account password?"))
	{
		if (sReg.test(sEmail))
		{
			var oPRC = new vdf.ajax.SoapCall("PasswordReset", {}, "GA_Proxy.asp");
			oPRC.addParam("sEmail", sEmail);
			oPRC.addParam("sUrl", location.href);
			oPRC.onFinished.addListener(GA_handlePasswordReset);
			oPRC.send(false);
		}
		else
		{
			alert("Your e-mail address appears to be invalid. Please make sure it's entered correctly.");
		}
	}
}

function GA_handlePasswordReset(oEvent) 
{
	if (!GA_CallFailed(oEvent))
	{           
		if (GA_CallValue(oEvent) == 0)
		{
			alert("An e-mail has been sent to '" + oEvent.oSource.oParams.sEmail + "' with further instructions.");
		}
	}
}

function GA_AccountReset() 
{
	document.getElementById("GA_divAccountCheck").style.display = "";
	document.getElementById("GA_divAccountEntry").style.display = "none";
	document.getElementById("GA_divAccountOk").style.display = "none";
	document.getElementById("GA_frmAccountCheck").EmailAddress.focus();
	document.getElementById("GA_frmAccountCheck").EmailAddress.select();
}

function GA_AccountCreate()
{
	var oACC = null;
	stAccountInfo = null;

	if (document.getElementById("GA_frmAccountEntry").Password1.value != document.getElementById("GA_frmAccountEntry").Password2.value)
	{
		alert("A password mismatch has been detected.");
	}
	else if (!GA_IsNothing(document.getElementById("GA_hiddenInput").value))
	{
		stAccountInfo = new tAccountInfo();
		
		stAccountInfo.sEmail 		= document.getElementById("GA_divAccountEntry_spanEmail").innerHTML;
		stAccountInfo.sFirstName    = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").FirstName.value);
		stAccountInfo.sMiddleName   = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").MiddleName.value);
		stAccountInfo.sLastName     = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").LastName.value);
		stAccountInfo.sCompanyName  = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").CompanyName.value);
		stAccountInfo.sAddress1     = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").Address1.value);
		stAccountInfo.sAddress2     = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").Address2.value);
		stAccountInfo.sZipCode      = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").ZipCode.value);
		stAccountInfo.sCity         = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").City.value);
		stAccountInfo.sState        = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").State.value);
		stAccountInfo.sCountryCode  = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").CountryCode.value);
		stAccountInfo.sTelephone    = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").Telephone.value);
		stAccountInfo.sPassword     = GA_TrimParameter(document.getElementById("GA_frmAccountEntry").Password1.value);
	
		oACC = new vdf.ajax.SoapCall("AccountCreate", {}, "GA_Proxy.asp");
		oACC.addParam("stAccountInfo", stAccountInfo);
		oACC.addParam("sUrl", location.href);
		oACC.addParam("sHidden", document.getElementById("GA_hiddenInput").value);
		oACC.__sButton = document.getElementById("GA_divAccountEntry_buttonAccCreate").innerHTML;
		oACC.__sClass = document.getElementById("GA_divAccountEntry_buttonAccCreate").className;
		oACC.onFinished.addListener(GA_handleAccountCreate);
		
		document.getElementById("GA_divAccountEntry_buttonAccCreate").innerHTML = document.getElementById("GA_divLoadingPic").innerHTML;
	    document.getElementById("GA_divAccountEntry_buttonAccCreate").className = "";
		
		oACC.send(true);
	}
}

function GA_handleAccountCreate(oEvent) 
{
	if (!GA_CallFailed(oEvent))
	{
		if (GA_CallValue(oEvent) == 0)
		{
			alert("Your account has been successfully created and awaits activation. An activation e-mail has been sent to you with further instructions.");
			GA_ReloadLocation();
		}
		else if (GA_CallValue(oEvent) == 1)
		{
			alert("An error occured. This e-mail address already exists in our database.");
			document.getElementById("GA_divAccountEntry_buttonAccCreate").innerHTML = oEvent.oSource.__sButton;
			document.getElementById("GA_divAccountEntry_buttonAccCreate").className = oEvent.oSource.__sClass;
		}
		else
		{
			alert("An error occured. Make sure you've filled the form correctly.");
			document.getElementById("GA_divAccountEntry_buttonAccCreate").innerHTML = oEvent.oSource.__sButton;
			document.getElementById("GA_divAccountEntry_buttonAccCreate").className = oEvent.oSource.__sClass;
		}
	}
}

function GA_AccountLogin(sEmail, sPassword, bChecked)
{
	var oALC = new vdf.ajax.SoapCall("AccountLogin", {}, "GA_Proxy.asp");
	oALC.addParam("sEmail", sEmail);
	oALC.addParam("sPassword", sPassword);
	oALC.addParam("sIp", GA_IP);
	oALC.__iChecked = bChecked ? 1 : 0;
	oALC.onFinished.addListener(GA_handleAccountLogin);
	oALC.send(false);
}

function GA_handleAccountLogin(oEvent) 
{
	var iExpires = "";
	var sDomain = "";
	
	if (!GA_CallFailed(oEvent))
	{		
		if (GA_CallValue(oEvent) == "")
		{
			alert("Invalid login or password.")
			
			document.getElementById("GA_frmAccountLogin").Password.value = "";
			document.getElementById("GA_frmAccountLogin").Password.focus();
		}
		else
		{
			if (oEvent.oSource.__iChecked == 1)
			{
				iExpires = 300;
			}
			
			if (location.href.indexOf("dataaccess.eu") != -1)
			{			
				sDomain = ".dataaccess.eu";
			}
			
			GA_SetCookie("vdfSessionKey", GA_CallValue(oEvent), iExpires, "/", sDomain, "");
			GA_SetCookie("gaEmail", oEvent.oSource.oParams.sEmail, iExpires, "/", sDomain, "");
			
			GA_ReloadLocation();
		}
	}
}

function GA_PasswordCreate()
{
	var oPCC = new vdf.ajax.SoapCall("PasswordCreate", {}, "GA_Proxy.asp");	
	oPCC.addParam("sEmail", document.getElementById("GA_frmAccountCheck").EmailAddress.value);
	oPCC.addParam("sUrl", location.href);
	oPCC.onFinished.addListener(GA_handlePasswordCreate);
	oPCC.send(false);
}

function GA_handlePasswordCreate(oEvent) 
{
	if (!GA_CallFailed(oEvent))
	{      
		if (GA_CallValue(oEvent) == 0)
		{
			alert("Thank you for your registration. An e-mail has been sent to you with further instructions.");
			GA_ReloadLocation();
		}
		else
		{
			alert("An error occurred.");
		}
	}
}

function GA_GetCountries()
{
	var oGCC = new vdf.ajax.SoapCall("GetCountries", {}, "GA_Proxy.asp");	
	oGCC.onFinished.addListener(GA_handleGetCountries);
	oGCC.send(false);
}

function GA_handleGetCountries(oEvent) 
{
	var oElements = GA_get_ElementsByName("SELECT", "CountryCode");
	var i = 0;
	
	if (!GA_CallFailed(oEvent))
	{	
		for (i = 0; i < oElements.length; i++)
		{			
			oElements[i].parentNode.innerHTML = GA_CallValue(oEvent);
		}
	}
}

function GA_PasswordSave()
{
	if (document.getElementById('GA_frmAccountConfirm').Password1.value == document.getElementById('GA_frmAccountConfirm').Password2.value)
	{            
		var oPSC = new vdf.ajax.SoapCall("PasswordSave", {}, "GA_Proxy.asp");
		oPSC.addParam("sHashCode", GA_GetQueryString("code"));
		oPSC.addParam("sPassword", document.getElementById('GA_frmAccountConfirm').Password1.value);
		oPSC.onFinished.addListener(GA_handlePasswordSave);
		oPSC.send(false);
	}
	else
	{
		alert("A password mismatch has been detected.");
	}
}

function GA_handlePasswordSave(oEvent) 
{
	if (!GA_CallFailed(oEvent))
	{      
		if (GA_CallValue(oEvent) == 0)
		{
			alert("The password has been saved. You will now be logged in.");
			GA_AccountLogin(document.getElementById("GA_frmAccountConfirm_spanEmail").innerHTML, document.getElementById('GA_frmAccountConfirm').Password1.value);
		}
		else
		{
			alert("You've already used this code to set your password.");
		}
	}
}

function GA_RetrieveConfirmationEmail()
{
	var oRCEC = new vdf.ajax.SoapCall("RetrieveConfirmationEmail", {}, "GA_Proxy.asp");
	oRCEC.addParam("sCode", GA_GetQueryString("code"));
	oRCEC.onFinished.addListener(GA_handleRetrieveConfirmationEmail);
	oRCEC.send(false);
}

function GA_handleRetrieveConfirmationEmail(oEvent)
{
	if (!GA_CallFailed(oEvent))
	{
		var iPos = GA_CallValue(oEvent).indexOf("|");
		var sEmail = GA_CallValue(oEvent).substring(0, iPos);
		var sType = GA_CallValue(oEvent).substring(iPos + 1, GA_CallValue(oEvent).length);
		
		if (sType != "AA")
		{		
			GA_WriteAccountConfirm(sEmail);
		}
		else
		{
			GA_WriteAccountActivate(sEmail);
		}
	}
}

function GA_ReSendAccountConfirm()
{
	var RACC = new vdf.ajax.SoapCall("ReSendAccountConfirm", {}, "GA_Proxy.asp");
	RACC.addParam("sEmail", document.getElementById("GA_frmAccountCheck_textEmail").value);
	RACC.addParam("sUrl", location.href);
	RACC.onFinished.addListener(GA_handleReSendAccountConfirm);
	RACC.send(false);
}

function GA_handleReSendAccountConfirm(oEvent)
{
	if (!GA_CallFailed(oEvent))
	{
		if (GA_CallValue(oEvent) == 0)
		{
			alert("An activation e-mail has been sent to you with further instructions.")
			GA_ReloadLocation();
		}
		else
		{
			alert("An error occurred.")
		}
	}
}

function GA_WriteAccountActivate()
{
	var sForms = [

	    "<div id='GA_divAccountActivate'>",
		    "<form id='GA_frmAccountActivate' action='none'>",
				"<label id='GA_frmAccountActivate_labelActivate'>",
					"Your account has been activated. Thank you for registering, you may login now.",
				"</label>",
				"<a id='GA_frmAccountActivate_buttonLogin' href='#' class='button' onclick='GA_ReloadLocation();'><span>Login</span></a>",
		   "</form>",
		"</div>"

		];

		GA_ShowScreen("GA_Container", sForms.join(""));
}

function GA_WriteAccountConfirm(sEmail)
{
	var sForms = [

	    "<div id='GA_divAccountConfirm'>",
		    "<form id='GA_frmAccountConfirm' action='none' onsubmit='GA_PasswordSave();return false;'>",
				"<label>",
					"You may now choose your new password.",
				"</label>",
				
				"<label id='GA_frmAccountConfirm_labelEmail'>",
					"E-mail address:",
				"</label>",
				"<span id='GA_frmAccountConfirm_spanEmail'>" + sEmail + "</span>",

				"<div class='GA_br'></div>",

				"<label id='GA_frmAccountConfirm_labelPassword1'>",
					"New password:",
				"</label>",
				"<input autocomplete='off' type='password' id='GA_frmAccountConfirm_textPassword1' value='' name='Password1' >",

				"<label id='GA_frmAccountConfirm_labelPassword2'>",
					"Retype password:",
				"</label>",
				"<input autocomplete='off' type='password' id='GA_frmAccountConfirm_textPassword2' value='' name='Password2' >",				

				"<input type='submit' value='' style='width:1px; overflow: hidden; border: none; background: transparent;'>",
				
				"<a id='GA_frmAccountConfirm_buttonPassSave' href='#' class='button' onclick='GA_PasswordSave();'><span>Save password</span></a>",
		   "</form>",
		"</div>"

		];

		GA_ShowScreen("GA_Container", sForms.join(""));
}

function GA_WriteAccountEntry()
{
	if (GA_GetQueryString("code") != "")
	{
		GA_RetrieveConfirmationEmail();
	}
	else
	{
		var sForms = [
		
		"<div id='GA_divAccountCheck' name='screen'>",
			"<form id='GA_frmAccountCheck' action='none' onsubmit='GA_AccountCheck();return false;'>",
				"<label id='GA_frmAccountCheck_labelEmail'>",
					"Please enter your Global Account e-mail address:",
				"</label>",
				"<input type='text' id='GA_frmAccountCheck_textEmail' name='EmailAddress' value='" + GA_GetCookie("gaEmail") + "'>",

				"<a id='GA_frmAccountCheck_buttonCheck' href='#' class='button' onclick='GA_AccountCheck();'><span>OK</span></a>",
				
				"<input type='submit' value='' style='width:1px; overflow: hidden; border: none; background: transparent;'>",
			"</form>",
		"</div>",
		
		"<div id='GA_divGeneratePass' name='screen' style='display: none;'>",
			"<form id='GA_frmGeneratePass' action='none' onsubmit='GA_PasswordCreate();return false;'>",
				"<label>",
					"Your e-mail address has been recognized in our database, but it seems you do not have a password for your Global Account yet. Please create a password for it in order to use it.",
				"</label>",
				"<label id='GA_frmGeneratePass_labelEmail'>",
					"E-mail address:",
				"</label>",
				"<span id='GA_frmGeneratePass_spanEmail'></span>",
				"<div class='GA_br'></div>",

				"<a href='#' id='GA_frmGeneratePass_buttonCreatePass' class='button' onclick='GA_PasswordCreate();'><span>Click here to create a password</span></a>",
				
				"<input type='submit' value='' style='width:1px; overflow: hidden; border: none; background: transparent;'>",
			"</form>",
		"</div>",

		"<div id='GA_divAccountLogin' name='screen' style='display: none;'>",
			"<form id='GA_frmAccountLogin' action='none' onsubmit='GA_AccountLogin(this.EmailAddress.value, this.Password.value, this.RemeberUser.checked);return false;'>",
				"<label id='GA_divAccountLogin_labelEmail'>",
					"Please enter your Global Account e-mail address:",
				"</label>",
				"<input type='text' id='GA_frmAccountLogin_textEmail' value='' name='EmailAddress' >",

				"<label id='GA_divAccountLogin_labelPassword'>",
					"Please enter your password:",
				"</label>",
				"<input autocomplete='off' type='password' id='GA_frmAccountLogin_textPassword' value='' name='Password' >",	

				"<a id='GA_divAccountLogin_buttonLogin' href='#' class='button' onclick='GA_AccountLogin(this.parentNode.EmailAddress.value, this.parentNode.Password.value, this.parentNode.RemeberUser.checked);'><span>Login</span></a>",
				
				"<div class='GA_br'></div>",
				
				"<input autocomplete='off' type='checkbox' id='GA_frmAccountLogin_checkRemUser' value='' name='RemeberUser'><span id='GA_frmAccountLogin_spanRemUser'>Remember me</span>",
				
				"<div id='GA_divAccountLogin_ForgotPassword'><a href='#' onclick='GA_PasswordReset();'>I forgot my password</a></div>",

				"<input type='submit' value='' style='width:1px; overflow: hidden; border: none; background: transparent;'>",
			"</form>",
		"</div>",

		"<div id='GA_divAccountActivate' name='screen' style='display: none;'>",
			"<form id='GA_frmAccountActivate' action='none'>",
				"<label id='GA_divAccountActivate_labelActivate'>",
					"Your account awaits activation. Please check your e-mail.", 
				"</label>",
				"<span>If you didn't receive an activation e-mail, please </span>",
				"<a id='GA_divAccountActivate_ResendActivation' href='#' onclick='GA_ReSendAccountConfirm();'><span>click here.</span></a>",
			"</form>",
		"</div>",
		
		"<div id='GA_divAccountEntry' name='screen' style='display: none;'>",
			"<form id='GA_frmAccountEntry' action='none' onsubmit='GA_AccountCreate();return false;'>",
				"<input type='hidden' id='GA_hiddenInput'>",
				"<label id='GA_divAccountEntry_labelEmail'>",
					"E-mail address:",
				"</label>",
				"<span id='GA_divAccountEntry_spanEmail'></span>",
				
				"<label id='GA_divAccountEntry_labelFirstName'>",
					"First name: (required)",
				"</label>",
				"<input type='text' id='GA_divAccountEntry_textFirstName' value='' name='FirstName'>",

				"<label id='GA_divAccountEntry_labelMiddleName'>",
					"Middle name:",
				"</label>",
				"<input type='text' id='GA_divAccountEntry_textMiddleName' value='' name='MiddleName'>",

				"<label id='GA_divAccountEntry_labelLastName'>",
					"Last name: (required)",
				"</label>",
				"<input type='text' id='GA_divAccountEntry_textLastName' value='' name='LastName'>",

				"<label id='GA_divAccountEntry_labelCompanyName'>",
					"Company:",
				"</label>",
				"<input type='text' id='GA_divAccountEntry_textCompanyName' value='' name='CompanyName'>",		

				"<div id='GA_ExtraRegInfo' style='display: none;'>",
					"<label id='GA_divAccountEntry_labelTelephone'>",
						"Telephone:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textTelephone' value='' name='Telephone'>",	
					
					"<label id='GA_divAccountEntry_labelAddress1'>",
						"Address Line 1:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textAddress1' value='' name='Address1'>",						

					"<label id='GA_divAccountEntry_labelAddress2'>",
						"Address Line 2:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textAddress1' value='' name='Address2'>",						

					"<label id='GA_divAccountEntry_labelZipcode'>",
						"Zip code:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textZipcode' value='' name='ZipCode'>",			

					"<label id='GA_divAccountEntry_labelCity'>",
						"City:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textCity' value='' name='City'>",	

					"<label id='GA_divAccountEntry_labelState'>",
						"State:",
					"</label>",
					"<input type='text' id='GA_divAccountEntry_textState' value='' name='State'>",							
				"</div>",

				"<label id='GA_divAccountEntry_labelCountry'>",
					"Country: (required)",
				"</label>",
				"<span><select id='GA_divAccountEntry_textState' name='CountryCode'></select></span>",					
			
				"<label id='GA_divAccountEntry_labelPassword1'>",
					"Password: (required)",
				"</label>",
				"<input autocomplete='off' type='password' autocomplete='off' id='GA_divAccountEntry_textPassword1' value='' name='Password1'>",	

				"<label id='GA_divAccountEntry_labelPassword2'>",
					"Retype password: (required)",
				"</label>",
				"<input type='password' autocomplete='off' id='GA_divAccountEntry_textPassword2' value='' name='Password2'>",
			
				"<div class='GA_BR'></div>",
			
				"<input type='checkbox' autocomplete='off' id='GA_divAccountEntry_chckAddDetails' value='' name='AddDetails' onClick='GA_ShowAddRegInfo();'>Add more details",
				
				"<div class='GA_BR'></div>",
				"<br />",
				
				"<a id='GA_divAccountEntry_buttonAccCreate' href='#' class='button'><span onclick='GA_AccountCreate();'>Register account</span></a>",
				
				"<input type='submit' value='' style='width:1px; overflow: hidden; border: none; background: transparent;'>",
			"</form>",
		"</div>"

		];
		
		document.getElementById("GA_Container").innerHTML = sForms.join("");
		
		GA_GetCountries();
		
		GA_GenerateNumber();
	}
}
