		
		// REGISTRATION AND MANAGEMENT CONSOLE
		// -----------------------++++++++++++++++++++++++++++-----------------------
		
		// If loading an existing account, init with an Account ID: init(AccountID);
		
		// -----------------------++++++++++++++++++++++++++++-----------------------
		
		var iInvalidCount = 0;
		
		var iPrimaryStep = 1; // Indicates the current step on the timeline
		
		var lGlob_AccountID = null;
		var sGlob_EmailAddress = null;
		var sGlob_FullName = null;
		
		var sRegProxy = "";
		
		function get(s){
			return document.getElementById(s);
		}
		
		function validate(o,r,t,minimum,m){
		
			setValid(o); // As default, set as valid
			
			if(o.tagName == "SELECT"){ 
			// This is a SELECT element
				// Check not empty
				if(o.selectedIndex != -1){
					if((r == true || r == "true") && o[o.selectedIndex].value == ""){
						setInvalid(o,"Required field.");
						return false;
					}
				}
			}else{ 
			// This is NOT a SELECT element
				minimum = parseInt(minimum);
				// Check not empty
				if((r == true || r == "true") && o.value == ""){
					setInvalid(o,"Required field.");
					return false;
				}
				if(o.value != ""){
					// Check min length
					if((r == true || r == "true") && o.value.length < minimum){
						setInvalid(o,"This fields needs to be at least " + minimum + " characters long.");
						return false;
					}
					// Check matching
					if((r == true || r == "true") && m != ""){
						var mO = get(m);
						if(mO){
							setValid(mO);
							if(o.value != mO.value && mO.value != ""){
								setInvalid(o,"Does not match.");
								return false;
							}
						}
					}
					// Check type
					if(t != ""){
						switch(t){
						case "email":
							if(o.value.indexOf("@") == -1 || o.value.indexOf(".") == -1){
								setInvalid(o,"Not a valid email address.");
								return false;
							}
							break;
						}
					}
					// Remove unwanted characters
					o.value = makeFriendly(o.value,o);
				}
			}
		}
		
		function makeFriendly(s,o){
			if(!o){
				return "";
			}
			if(!s){
				return "";
			}
			while(s.indexOf("&") != -1){
				s = s.replace("&","and");
			}
			while(s.indexOf("+") != -1){
				s = s.replace("+","");
			}
			while(s.indexOf("'") != -1){
				s = s.replace("'","");
			}
			while(s.indexOf("\"") != -1){
				s = s.replace("\"","");
			}
			while(s.indexOf("<") != -1){
				s = s.replace("<","");
			}
			while(s.indexOf(">") != -1){
				s = s.replace(">","");
			}
			return s;
		}
		
		function validateAll(){
			
			iInvalidCount = 0;
			get("InvalidCount").value = iInvalidCount;
			
			var o = aSections[currNav][1]; // This is the div containing the form elements
			var inputs = o.getElementsByTagName("input"); // All input elements within div object
			var selects = o.getElementsByTagName("select"); // All select elements within div object
			
			for(i=0;i<inputs.length;i++){
				if((inputs[i].onblur + "").indexOf("validate") != -1){
					if(o.style.display == "block"){
						
						if(navigator.appName=='Netscape'){
							inputs[i].focus();
							inputs[i].blur();
						}else{
							sFunc = inputs[i].onblur + "";
							sFunc = sFunc.replace("this,",",this,");
							sFunc = sFunc.replace(");",",'','',''");
							aFunc = sFunc.split(",");
							validate(inputs[i],makeFriendly(aFunc[2],inputs[i]),makeFriendly(aFunc[3],inputs[i]),makeFriendly(aFunc[4],inputs[i]),makeFriendly(aFunc[5],inputs[i]));
						}
						
					}
				}
			}
			
			for(i=0;i<selects.length;i++){
				if((selects[i].onblur + "").indexOf("validate") != -1){
					if(o.style.display == "block"){
						
						if(navigator.appName=='Netscape'){
							selects[i].focus();
							selects[i].blur();
						}else{
							sFunc = selects[i].onblur + "";
							sFunc = sFunc.replace("this,",",this,");
							sFunc = sFunc.replace(");",",'','',''");
							aFunc = sFunc.split(",");
							validate(selects[i],makeFriendly(aFunc[2],selects[i]),makeFriendly(aFunc[3],selects[i]),makeFriendly(aFunc[4],selects[i]),makeFriendly(aFunc[5],selects[i]));
						}
						
					}
				}
			}
			
		}
		
		function showLoading(){
			var o = get("lB");
			o.style.left = (screen.width/2) - (o.style.width/2);
			o.style.display = "block";
		}
		function hideLoading(){
			get("lB").style.display = "none";
		}
		
		function load_AccountTypes(AccountID){
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dAccountID", "buildProfileOptions()", "AccountID=" + AccountID + "&Get_AccountTypes=Y");
			blnUpdateMode = true;
			selNav(1,false);
		}
		
		function load_Extra(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Extra_Process();", "CardHolderID=" + iAccountType + "&Get_Extra=Y");
		}
		function load_Extra_Process(){
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						get("Profile_OwnEquipment").value = a2[0];
						get("Resume_Bio").value = a2[1];
						get("Resume_Guilds").value = a2[2];
						get("Resume_Awards").value = a2[3];
						get("Resume_Education").value = a2[4];
						get("Resume_Achievements").value = a2[5];
						get("Resume_Website1").value = a2[6];
						get("Resume_Website1Name").value = a2[7];
						get("Resume_Website2").value = a2[8];
						get("Resume_Website2Name").value = a2[9];
						get("Resume_Website3").value = a2[10];
						get("Resume_Website3Name").value = a2[11];
						//get("Resume_CV").value = a2[12];
					}
				}
			}
			load_Genre();
		}
		
		function load_Genre(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Genre_Process();", "CardHolderID=" + iAccountType + "&Get_Genre=Y");
		}
		function load_Genre_Process(){
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						var checks = get("dProfile").getElementsByTagName("input");
						for(j=0;j<checks.length;j++){
							if(checks[j].id == "Profile_Genre" && checks[j].value == a2[0]){
								checks[j].checked = true;
								var sO = "Profile_Genre_" + a2[0] + "_" + a2[1];
								var o = get(sO);
								rate("set",o);
							}
						}
					}
				}
			}
			//load_Speciality();
			load_Exposure();
		}
		
		function load_Speciality(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Speciality_Process();", "CardHolderID=" + iAccountType + "&Get_Speciality=Y");
		}
		function load_Speciality_Process(){
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						var checks = get("dProfile").getElementsByTagName("input");
						for(j=0;j<checks.length;j++){
							if(checks[j].id == "Profile_Speciality" && checks[j].value == a2[0]){
								checks[j].checked = true;
								var sO = "Profile_Speciality_" + a2[0] + "_" + a2[1];
								var o = get(sO);
								rate("set",o);
							}
						}
					}
				}
			}
			load_Exposure();
		}
		
		function load_Exposure(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Exposure_Process();", "CardHolderID=" + iAccountType + "&Get_Exposure=Y");
		}
		function load_Exposure_Process(){
			var checks = get("dExposure").getElementsByTagName("input");
			for(j=0;j<checks.length;j++){
				if(checks[j].id == "Exposure"){
					afterRem(checks[j]);
					if(checks[j].disabled == true){
						checks[j].checked = true;
					}
				}
			}
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						for(j=0;j<checks.length;j++){
							if(checks[j].id == "Exposure" && checks[j].value == a2[0]){
								checks[j].checked = true;
								get("Exposure_Approved" + a2[0]).value = a2[1];
								if(a2[1] == "Y"){
									var n = document.createElement("img");
									n.src = "images/approved-y.gif";
									n.title = "Approved.";
									after(n,checks[j]);
								}else if(a2[1] == "X"){
									var n = document.createElement("img");
									n.src = "images/approved-x.gif";
									n.title = "Disapproved.";
									after(n,checks[j]);
								}else{
									var n = document.createElement("img");
									n.src = "images/approved-n.gif";
									n.title = "Waiting on approval.";
									after(n,checks[j]);
								}
							}
						}
					}
				}
			}
			load_Credits();
		}
		
		function load_Credits(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Credits_Process();", "CardHolderID=" + iAccountType + "&Get_Credits=Y");
		}
		function load_Credits_Process(){
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						aCredits[aCreditsIndex] = new Array(7);
						aCredits[aCreditsIndex][0] = a2[0];
						aCredits[aCreditsIndex][1] = a2[1];
						aCredits[aCreditsIndex][2] = a2[2];
						aCredits[aCreditsIndex][3] = a2[3];
						aCredits[aCreditsIndex][4] = a2[4];
						aCredits[aCreditsIndex][5] = a2[5];
						aCredits[aCreditsIndex][6] = a2[6];
						
						var sN = document.createElement("div");
						sN.className = "lRow";
						
						var sW = document.createElement("div");
						sW.innerHTML = aCredits[aCreditsIndex][4] + "&nbsp;";
						sW.className = "lCol";
						sN.appendChild(sW);
						
						var sW2 = document.createElement("div");
						sW2.innerHTML = aCredits[aCreditsIndex][0] + "&nbsp;";
						sW2.className = "lCol";
						sN.appendChild(sW2);
						
						var sW3 = document.createElement("div");
						sW3.innerHTML = aCredits[aCreditsIndex][1] + "&nbsp;";
						sW3.className = "lCol";
						sN.appendChild(sW3);
						
						var sW4 = document.createElement("div");
						sW4.innerHTML = aCredits[aCreditsIndex][2] + "&nbsp;";
						sW4.className = "lCol";
						sN.appendChild(sW4);
						
						var sW5 = document.createElement("div");
						sW5.innerHTML = "<a onclick='credits_Rem(" + aCreditsIndex + ",this)' class='btn'>Remove</a>";
						sW5.className = "lCol";
						sN.appendChild(sW5);
			
						get("dCreditsList").appendChild(sN);
						aCreditsIndex++;
					}
				}
			}
			load_Agency();
		}
		
		function load_Agency(){
			showLoading();
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_get_accountdetails.asp","dTemp", "load_Agency_Process();", "CardHolderID=" + iAccountType + "&Get_Agency=Y");
		}
		function load_Agency_Process(){
			var s = get("dTemp").innerHTML;
			if(s.indexOf("|") != -1){
				var a = s.split("|");
				for(i=0;i<a.length;i++){
					if(a[i] != ""){
						var a2 = a[i].split(",");
						
						if(a2[1] != "Freelancers"){
							
							get("dAgency_1").style.display = "block";
							get("Agency_HaveAgency").checked = true;
							
							aAgency[aAgencyIndex] = new Array(7);
							aAgency[aAgencyIndex][0] = a2[0];
							aAgency[aAgencyIndex][1] = "";
							aAgency[aAgencyIndex][2] = "";
							aAgency[aAgencyIndex][3] = "";
							aAgency[aAgencyIndex][4] = a2[2];

							var sN = document.createElement("div");
							sN.className = "lRow";
							
							var sW = document.createElement("div");
							sW.innerHTML = "" + a2[1];
							sW.className = "lCol";
							sN.appendChild(sW);
							
							var sW2 = document.createElement("div");
							if(aAgency[aAgencyIndex][4] == "Y"){ // Check if is default
								sW2.innerHTML = "(Default)";
							}else{
								sW2.innerHTML = "-";
							}
							sW2.className = "lCol";
							sN.appendChild(sW2);
							
							var sW3 = document.createElement("div");
							sW3.innerHTML = "<a onclick='agency_Rem(" + aAgencyIndex + ",this)' class='btn'>Remove</a>";
							sW3.className = "lCol";
							sN.appendChild(sW3);
				
							get("dAgencyList").appendChild(sN);
							aAgencyIndex++;
							
						}else{
							
							get("Agency_Freelance").checked = true;
							get("Agency_ContactNo").value = a2[3];
							get("Agency_EmailAddress").value = a2[4];
							get("Agency_CellNo").value = a2[5];
							if(a2[2] == "Y"){ // Check if is default
								get("Agency_DefaultFL").checked = true;
							}else{
								get("Agency_DefaultFL").checked = false;
							}
							
							
						}
					}
				}
			}
			selNav(2,true);
			hideLoading();
		}
		
		function clearAll(){
		
			// Clear form
			var o;
			for(j=2;j<aSections.length;j++){ // Do not reset the first two sections
				o = aSections[j][1];
				if(o != null){
					var inputs = o.getElementsByTagName("input");
					for(i=0;i<inputs.length;i++){
						if((inputs[i].type == "checkbox" || inputs[i].type == "radio") && inputs[i].disabled != "disabled"){
							inputs[i].checked = false;
						}
						if(inputs[i].type == "text" || inputs[i].type == "hidden"){
							inputs[i].value = "";
						}
					}
					var selects = o.getElementsByTagName("select");
					for(i=0;i<selects.length;i++){
						selects[i].selectedIndex = 0;
					}
					var textareas = o.getElementsByTagName("textarea");
					for(i=0;i<textareas.length;i++){
						textareas[i].value = "";
					}
					var images = o.getElementsByTagName("img"); // Reset start ratings
					for(i=0;i<images.length;i++){
						if(images[i].src.indexOf("rating_") != -1 && images[i].src.indexOf("_off.gif") == -1){
							images[i].src = images[i].src.replace(".gif","_off.gif");
						}
					}
				}
			}
			
			if(bCredits){
				// Clear credits
				aCreditsIndex = 0;
				aCredits = [];
				remAll(get("dCreditsList"));
			}
			
			if(bAgency){
				// Clear agents
				aAgencyIndex = 0;
				aAgency = [];
				remAll(get("dAgencyList"));
				get("dAgency_1").style.display = "none";
			}
			
			
		}
		
		function lockAccountInfo(){
			get("Account_FirstName").readOnly = true;
			get("Account_Surname").readOnly = true;
			get("Account_EmailAddress").readOnly = true;
			get("Account_Password").readOnly = true;
			get("Account_ConfirmPassword").readOnly = true;
			get("Account_Gender").disabled = true;
			get("Account_DOB_Year").disabled = true;
			get("Account_DOB_Month").disabled = true;
			get("Account_DOB_Day").disabled = true;
			get("Account_Country").disabled = true;
			get("Account_City").disabled = true;
			//get("Account_Area").disabled = true;
			for (i = 0; i < document.regForm.elements.length; i++){
				if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Account_Type"){
					document.regForm.elements[i].disabled = true;
				}
			}
		}
		
		function saveAccount(){
			// Save account (Create account)
			var PostData = "";
			PostData = PostData + "Account_FirstName=" + get("Account_FirstName").value;
			PostData = PostData + "&Account_Surname=" + get("Account_Surname").value;
			PostData = PostData + "&Account_Gender=" + get("Account_Gender")[get("Account_Gender").selectedIndex].value;
			PostData = PostData + "&Account_Country=" + get("Account_Country")[get("Account_Country").selectedIndex].text;
			PostData = PostData + "&Account_City=" + get("Account_City")[get("Account_City").selectedIndex].text;
			//PostData = PostData + "&Account_Area=" + get("Account_Area")[get("Account_Area").selectedIndex].text;
			PostData = PostData + "&Account_EmailAddress=" + get("Account_EmailAddress").value;
			PostData = PostData + "&Account_Password=" + get("Account_Password").value;
			PostData = PostData + "&Account_DOB_Year=" + get("Account_DOB_Year")[get("Account_DOB_Year").selectedIndex].value;
			PostData = PostData + "&Account_DOB_Month=" + get("Account_DOB_Month")[get("Account_DOB_Month").selectedIndex].value;
			PostData = PostData + "&Account_DOB_Day=" + get("Account_DOB_Day")[get("Account_DOB_Day").selectedIndex].value;
			PostData = PostData + "&Account_Type=";
			if(blnUpdateMode){
				PostData = PostData + "&AccountID=";
			}
			for (i = 0; i < document.regForm.elements.length; i++){
				if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Account_Type"){
					if(document.regForm.elements[i].checked == true){
						PostData = PostData + document.regForm.elements[i].value + ",";
					}
				}
			}
			PostData = PostData + "&ExposureID=" + lExposureID;
			PostData = encodeQS(PostData);
			var sSrc = 
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_save_account.asp","dAccountID", "checkProfile()", PostData);
		}
		
		function checkProfile(){
			var sS = get("dAccountID").innerHTML;
			
			get("dAccountMade").style.display = "none";
			get("dAccount").style.display = "block";
			get("iBtnSubmit").style.display = "block";
			get("iBtnSubmit2").style.display = "block";
			
			if(sS=="EMAIL_EXISTS"){
				blnNoGo = true;
				setInvalid(get("Account_EmailAddress"),"<b>Account not created.</b> An account already exists for this email address.");
			}else{
				blnNoGo = true;
				get("dAccountMade").style.display = "block";
				get("dAccount").style.display = "none";
				get("iBtnSubmit").style.display = "none";
				get("iBtnSubmit2").style.display = "none";
			}
		}
		
		function saveAll(){
			// Save all data in form (account already created)
			
			var qS = "AccountID=" + lGlob_AccountID + "&CardHolderID=" + iAccountType;
			var aS = (sChanges + "|").split("|");
			for(x=0;x<aS.length;x++){
				if(aS[x] != ""){
					switch(aS[x]){
					
						// Save Exposure selection
						case "Exposure":
							qS += "&Save_Exposure=Y&Exposure_List=";
							for (i = 0; i < document.regForm.elements.length; i++){
								if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Exposure"){
									if(document.regForm.elements[i].checked == true){
										qS += document.regForm.elements[i].value + "," + get("Exposure_Approved" + document.regForm.elements[i].value).value + "|";
									}
								}
							}
							break;
					
						// Save Genre selection
						case "Genre":
							qS += "&Save_Genre=Y&Genre_List=";
							for (i = 0; i < document.regForm.elements.length; i++){
								if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Profile_Genre"){
									if(document.regForm.elements[i].checked == true){
										qS += document.regForm.elements[i].value + "," + get("Profile_Genre_" + document.regForm.elements[i].value + "_P").value + "|";
									}
								}
							}
							break;
							
						// Save Speciality selection
						case "Speciality":
							qS += "&Save_Speciality=Y&Speciality_List=";
							for (i = 0; i < document.regForm.elements.length; i++){
								if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Profile_Speciality"){
									if(document.regForm.elements[i].checked == true){
										qS += document.regForm.elements[i].value + "," + get("Profile_Speciality_" + document.regForm.elements[i].value + "_P").value + "|";
									}
								}
							}
							break;
							
						// Save Agency selection
						case "Agency":
							qS += "&Save_Agency=Y";
							if(get("Agency_HaveAgency").checked == true){
								qS += "&Agency_HaveAgency=Y";
								qS += "&Agency_List=";
								for (i = 0; i < aAgency.length; i++){
									if(aAgency[i] != null){
										if(aAgency[i][4] == true){
											qS += aAgency[i][0] + "," + aAgency[i][1] + "," + aAgency[i][2] + "," + aAgency[i][3] + ",Y|";
										}else{
											qS += aAgency[i][0] + "," + aAgency[i][1] + "," + aAgency[i][2] + "," + aAgency[i][3] + ",N|";
										}
									}
								}
							}
							if(get("Agency_Freelance").checked == true){
								qS += "&Agency_Freelance=Y";
								qS += "&Agency_ContactNo=" + get("Agency_ContactNo").value;
								qS += "&Agency_EmailAddress=" + get("Agency_EmailAddress").value;
								qS += "&Agency_CellNo=" + get("Agency_CellNo").value;
								if(get("Agency_DefaultFL").checked == true){
									qS += "&Agency_Default=Y";
								}else{
									qS += "&Agency_Default=N";
								}
							}
							break;
							
						// Save Credits selection
						case "Credits":
							qS += "&Save_Credits=Y&Credits_List=";
							for (i = 0; i < aCredits.length; i++){
								if(aCredits[i] != null){
									qS += aCredits[i][0] + "," + aCredits[i][1] + "," + aCredits[i][2] + "," + aCredits[i][3] + "," + aCredits[i][4] + "," + aCredits[i][5] + "," + aCredits[i][6] + "|";
								}
							}
							break;
							
						// Save Extra info (Profile, resume, etc)
						case "Extra":
							qS += "&Save_Extra=Y";
							qS += "&Profile_OwnEquipment=" + get("Profile_OwnEquipment").value;
							qS += "&Resume_Bio=" + get("Resume_Bio").value;
							qS += "&Resume_Guilds=" + get("Resume_Guilds").value;
							qS += "&Resume_Awards=" + get("Resume_Awards").value;
							qS += "&Resume_Education=" + get("Resume_Education").value;
							qS += "&Resume_Achievements=" + get("Resume_Achievements").value;
							qS += "&Resume_Website1=" + get("Resume_Website1").value;
							qS += "&Resume_Website1Name=" + get("Resume_Website1Name").value;
							qS += "&Resume_Website2=" + get("Resume_Website2").value;
							qS += "&Resume_Website2Name=" + get("Resume_Website2Name").value;
							qS += "&Resume_Website3=" + get("Resume_Website3").value;
							qS += "&Resume_Website3Name=" + get("Resume_Website3Name").value;
							//qS += "&Resume_CV=" + get("Resume_CV").value;
							break;
						
					}
				}
			}
			qS = qS + "&ExposureID=" + lExposureID;
			qS = encodeQS(qS);
			DynamicLoad(sRegProxy + "http://www.useimagine.com/imagine2/api/register_component/register_save_accountdetails.asp","dSave", "saveDone()", qS);
			setChanges(false);
			alert("Changes have been saved.");
		}
		
		function saveDone(){
			// Insert any post save actions here
		}
		
		function encodeQS(s){
			while(s.indexOf(" ") != -1){
				s = s.replace(" ","+");
			}
			while(s.indexOf("\n") != -1){
				s = s.replace("\n","[br]");
			}
			return s;
		}
		
		var blnUpdateMode = false;
		var aAccountDetails = new Array(3);
		var blnNoGo = false; // Allow first load
		
		function postSaveAccount(){
			blnUpdateMode = true;
		}
		
		function buildProfileOptions(){
		
			// Build the profile type selection radio buttons
			var oS = get("dAccountID");
			
			var sS = oS.innerHTML;
			
			if(sS=="EMAIL_EXISTS"){
				blnNoGo = true;
				setInvalid(get("Account_EmailAddress"),"<b>Account not created.</b> An account already exists for this email address.");
			}else{
				
				lockAccountInfo();
				
				blnNoGo = false;
				var aS = sS.split(";");
				var oD = get("dProfileSel_Options");
				oD.innerHTML = "";
				var aA1 = aS[1].split(",");
				var aA2 = aS[2].split(",");
				var aA3 = aS[3].split(",");
				for(x=0;x<aA1.length;x++){
					if(aA1[x] != ""){
						if(x==0){
							oD.innerHTML += "<input onClick='setAccountType(" + aA1[x] + ",\"" + aA2[x] + "\");' type='radio' id='Profile_CardHolderID' name='Profile_CardHolderID' value='" + aA1[x] + "' title='" + aA2[x] + "' checked='checked'> " + aA2[x] + "<br>";
							iAccountType = aA1[x];
							sAccountType = aA2[x];
						}else{
							oD.innerHTML += "<input onClick='setAccountType(" + aA1[x] + ",\"" + aA2[x] + "\");' type='radio' id='Profile_CardHolderID' name='Profile_CardHolderID' value='" + aA1[x] + "' title='" + aA2[x] + "'> " + aA2[x] + "<br>";
						}
						checkSel("Account_Type",aA2[x]);
					}
				}
				get("Account_EmailAddress").value = aA3[0];
				get("Account_Password").value = aA3[1];
				get("Account_ConfirmPassword").value = aA3[1];
				get("Account_FirstName").value = aA3[2];
				get("Account_Surname").value = aA3[3];
				get("Account_Gender").value = aA3[4];
				get("Account_DOB_Year").value = aA3[5];
				get("Account_DOB_Month").value = aA3[6];
				get("Account_DOB_Day").value = aA3[7];
				get("Account_Country").value = aA3[9];
				get("Account_City").value = aA3[10];
				//get("Account_Area").value = aA3[11];
				sGlob_EmailAddress = aA3[0];
				sGlob_Fullname = aA3[2] + " " + aA3[3];
				setPrimaryStep(aA3[8]);
				if(iPrimaryStep != 2 && iPrimaryStep != 4){
					postSaveAccount();
					selNav(1,false);
					setAccountType(iAccountType,sAccountType);
				}
			}
		}
		
		function setPrimaryStep(s){
			switch(s){
				case "O":
					iPrimaryStep = 2;
					get("PrimStepNumA").innerHTML = "2";
					get("PrimStepText").innerHTML = "Confirm Email Address";
					get("dFormsNavigationT").style.display = "none";
					get("dFormsDisplay").innerHTML = "Please confirm your email address by clicking the link in the email you received from us.<br><br>Once you have confirmed your email address, you will be allowed to create your full profile(s).<br><br>If you have lost the email, <a>click here</a> and we will send it again.";
					break;
				case "C":
					iPrimaryStep = 3;
					get("PrimStepNumA").innerHTML = "3";
					get("PrimStepText").innerHTML = "Complete Profile(s) And Submit For Approval";
					get("dApproval").style.display = "block";
					break;
				case "A":
					iPrimaryStep = 4;
					get("PrimStepNumA").innerHTML = "4";
					get("PrimStepText").innerHTML = "Awaiting Approval";
					get("dFormsNavigationT").style.display = "none";
					get("dFormsDisplay").innerHTML = "Your account has been sent to us to approve. This process can take anywhere from an hour, up to 2 working days.<br><br><b>Why Do I Have To Wait?</b><br>We monitor all accounts being created to ensure that the integrity of information is upheld.<br>";
					break;
				case "AC":
					iPrimaryStep = 5;
					get("PrimStepNumA").style.display = "none";
					get("PrimStepNumB").style.display = "none";
					get("PrimStepText").style.display = "none";
					break;
				default:
					iPrimaryStep = 1;
					get("PrimStepNumA").innerHTML = "1";
					get("PrimStepText").innerHTML = "Create Account";
					break;
			}
		}
		
		function checkSel(sId,sVal){
			for (i = 0; i < document.regForm.elements.length; i++){
				if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == sId && document.regForm.elements[i].value == sVal){
					document.regForm.elements[i].checked = true;
				}
			}
		}
		
		var iAccountType = 0;
		var sAccountType = "";
		function setAccountType(s1,s2){
			if(blnChanges){
				if(window.confirm("Save changes to your '" + sAccountType + "' profile?")){
					saveAll();
				}
			}
			iAccountType = s1;
			sAccountType = s2;
			clearAll();
			if(bImages){
				try
				{
					window.imagesFrame.location.href = "http://www.digicastcards.com/packages/Analysis/ImageManagement.asp?userid=0&cardholderid=" + iAccountType;
				}
				catch(ex){
					var o = document.getElementById("imagesFrame");
					if(o){
						document.getElementById("imagesFrame").src = "http://www.digicastcards.com/packages/Analysis/ImageManagement.asp?userid=0&cardholderid=" + iAccountType;
					}else{
						alert("Could not load image manager. Please close your browser and try again.");	
					}
				}
			}
			load_Extra();
		}		
	
		function checkFormVal(b){
			
			validateAll();
			
			if(get("InvalidCount").value == "0"){
				pass = true;
			}else{
				pass = false;
			}
			
			var d = get("dFormValid");
			if(d){
				if(pass){
					d.style.display = "none";
				}else if(b){
					d.style.display = "block";
				}
			}
			return pass;
			
		}
		
		function setInvalid(o,em){
			var n = document.createElement("div");
			n.className = "invalid";
			n.innerHTML = "" + em;
			after(n,o);
			//o.style.backgroundColor = "#FFEEEE";
			iInvalidCount = iInvalidCount + 1;
			get("InvalidCount").value = iInvalidCount;
			//checkFormVal(false);
		}
		
		function setValid(o){
			//o.style.backgroundColor = "#FFFFFF";
			afterRem(o);
		}
		
		function after(elem,targetElem) {
			var parent = targetElem.parentNode;
			if (targetElem == parent.lastChild){
				parent.appendChild(elem);
			} else {
				parent.insertBefore(elem,targetElem.nextSibling);
			}
		}
		
		function afterRem(targetElem){
			var parent = targetElem.parentNode;
			if(parent.childNodes.length > 1){
				var x;
				for(x=1;x<=parent.childNodes.length-1;x++){
					elem = parent.childNodes[x];
					if(elem.tagName == "DIV" || elem.tagName == "IMG"){
						elem.parentNode.removeChild(elem);
					}
				}
			}
		}
		
		function inject(elem,targetElem){
			try {
				targetElem.add(elem, null); // standards compliant; doesn't work in IE
			}
			catch(ex) {
				targetElem.add(elem); // IE only
			}
		}
		
		function rem(o){
			o.parentNode.removeChild(o);
		}
		
		function remAll(o){
			//if(o.style.display == "block"){
				if(o.hasChildNodes()){
					while(o.childNodes.length >= 1){
						o.removeChild(o.firstChild);
					}
				}
			//}
		}
			
		var aSections = new Array();
		
		function init(AccountID){
			
			lGlob_AccountID = AccountID
			
			var i = 0;
			
			if(bAccount){
				aSections[i] = new Array(2);
				aSections[i][0] = "Account";
				aSections[i][1] = get("dAccount");
				aSections[i][2] = null; // Parent section
				i++;
			}
			if(bProfileSel){
				aSections[i] = new Array(2);
				aSections[i][0] = "Profiles";
				aSections[i][1] = get("dProfileSel");
				aSections[i][2] = 0; // Parent section
				i++;
			}
			if(bProfile){
				aSections[i] = new Array(2);
				aSections[i][0] = "Profile Details";
				aSections[i][1] = get("dProfile");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bAgency){
				aSections[i] = new Array(2);
				aSections[i][0] = "Respresentation";
				aSections[i][1] = get("dAgency");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bResume){
				aSections[i] = new Array(2);
				aSections[i][0] = "Resume";
				aSections[i][1] = get("dResume");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bCredits){
				aSections[i] = new Array(2);
				aSections[i][0] = "Credits";
				aSections[i][1] = get("dCredits");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bExposure){
				aSections[i] = new Array(2);
				aSections[i][0] = "Exposure";
				aSections[i][1] = get("dExposure");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bImages){
				aSections[i] = new Array(2);
				aSections[i][0] = "Images";
				aSections[i][1] = get("dImages");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			if(bVideo){
				aSections[i] = new Array(2);
				aSections[i][0] = "Video";
				aSections[i][1] = get("dVideo");
				aSections[i][2] = 1; // Parent section
				i++;
			}
			
			buildNav();
			
			if(AccountID){
				load_AccountTypes(AccountID);
			}else{
				selNav(0,true);
				get("dFormsNavigationT").style.display = "none";
				setPrimaryStep();
			}
		
		}
		
		function buildNav(){
			
			var navT = get("dFormsNavigationT");
			
			var i;
			for(i=0;i<aSections.length;i++){
				var menuItem = document.createElement("div");
				menuItem.innerHTML = "<a onClick='selNav(" + i + ",true)'>" + aSections[i][0] + "</a>";
				menuItem.className = "tab";
				menuItem.setAttribute("onClick","selNav(" + i + ",true)");
				navT.appendChild(menuItem);
			}
			
		}
		
		var currNav = 0; // Hold the currently loaded step
		
		function selNav(j,b){
		
			var blnCheck = checkFormVal(true);
		
			if(currNav == 0 && j != 0 && b && blnCheck && get("InvalidCount").value == "0" && blnUpdateMode != true){
				blnNoGo = true;
				saveAccount();
			}
			if(!blnCheck || get("InvalidCount").value != "0" || blnNoGo == true){

			}else{
			
				var navT = get("dFormsNavigationT");
				var i;
				if(navigator.appName=='Netscape'){
					xF = 1
				}else{
					xF = 0
				}
				for(i=0;i<aSections.length;i++){
					if(navT.childNodes[i + xF]){
						navT.childNodes[i + xF].className = "tab";
						aSections[i][1].style.display = "none";
					}
				}
				navT.childNodes[j + xF].className = "tabSel";
				aSections[j][1].style.display = "block";
				buildNavB(j);
				if(currNav == 1){
					get("dProfile_Head").innerHTML = "" + sAccountType;
					get("dAgency_Head").innerHTML = "" + sAccountType;
					get("dResume_Head").innerHTML = "" + sAccountType;
					get("dCredits_Head").innerHTML = "" + sAccountType; get("Credits_Role").value = "" + sAccountType;
					get("dExposure_Head").innerHTML = "" + sAccountType;
					get("dImages_Head").innerHTML = "" + sAccountType;
					get("dVideo_Head").innerHTML = "" + sAccountType;
				}
				if(currNav == 0 && j != 0){
					setChanges(false);
				}
				currNav = j;
				
			}
		}
		
		function buildNavB(j){
			// Update the navigation buttons
			
			if(iPrimaryStep == 2 || iPrimaryStep == 4){
				return false;	
			}
			
			var bB = get("iBtnBack");
			var bN = get("iBtnNext");
			var bS = get("iBtnSubmit");
			var bB2 = get("iBtnBack2");
			var bN2 = get("iBtnNext2");
			var bS2 = get("iBtnSubmit2");
			var aL = aSections.length;
			if(j == 0){
				bB.style.display = "none";
				bB2.style.display = "none";
			}else if(aL > 1){
				bB.onclick = function(){selNav(j - 1,true)};
				bB.style.display = "inline";
				bB2.onclick = function(){selNav(j - 1,true)};
				bB2.style.display = "inline";
			}
			if(aL <= 1 || (j + 1) >= aL){
				bN.style.display = "none";
				bN2.style.display = "none";
			}else{
				bN.onclick = function(){selNav(j + 1,true)};
				bN.style.display = "inline";
				bN2.onclick = function(){selNav(j + 1,true)};
				bN2.style.display = "inline";
			}
			if(j == 0){
				if(blnUpdateMode){
					bN.style.display = "block";
					bS.style.display = "none";
					bN2.style.display = "block";
					bS2.style.display = "none";
				}else{
					bN.style.display = "none";
					bS.style.display = "block";
					bN2.style.display = "none";
					bS2.style.display = "block";
				}
				bS.value = "Save Account";
				bS.onclick = function(){selNav(j + 1,true)};
				bS2.value = "Save Account";
				bS2.onclick = function(){selNav(j + 1,true)};
			}else{
				bN.style.display = "block";
				bS.style.display = "block";
				bS.value = "Save Changes";
				bS.onclick = function(){saveAll()};
				bN2.style.display = "block";
				bS2.style.display = "block";
				bS2.value = "Save Changes";
				bS2.onclick = function(){saveAll()};
			}
			//Update the page number
			var pN = get("dFormsPN");
			pN.innerHTML = "Step " + (j + 1) + " of " + aL;
		}
		
		// Set details as changed/saved
		var blnChanges = false; // Holds whether there any changes to be saved
		var sChanges = ""; // Holds the sections that have been changed and need saving
		function setChanges(b,s){
			blnChanges = b;
			get("iBtnSubmit").disabled = !b;
			get("iBtnSubmit2").disabled = !b;
			if(!b){
				sChanges = "";
			}else{
				if(sChanges.indexOf(s + "|") == -1){
					sChanges += s + "|";
				}
			}
		}
		
		// Hold all NEW credits added using the credits form
		var aCredits = new Array;
		var aCreditsIndex = 0;
		function credits_Store(){
			setChanges(true,"Credits");
			aCredits[aCreditsIndex] = new Array(7);
			aCredits[aCreditsIndex][0] = get("Credits_Type")[get("Credits_Type").selectedIndex].value; get("Credits_Type").selectedIndex = 0;
			aCredits[aCreditsIndex][1] = get("Credits_Project").value; get("Credits_Project").value = "";
			aCredits[aCreditsIndex][2] = get("Credits_Role").value; //get("Credits_Role").value = ""; // We'll keep this filled in for now, most likey going to be the same for CREW
			aCredits[aCreditsIndex][3] = get("Credits_Company").value; get("Credits_Company").value = "";
			aCredits[aCreditsIndex][4] = get("Credits_Year")[get("Credits_Year").selectedIndex].value; get("Credits_Year").selectedIndex = get("Credits_Year").length - 1;
			aCredits[aCreditsIndex][5] = get("Credits_Country")[get("Credits_Country").selectedIndex].value; get("Credits_Country").selectedIndex = 0;
			aCredits[aCreditsIndex][6] = 0; // City

			var sN = document.createElement("div");
			sN.className = "lRow";
			
			var sW = document.createElement("div");
			sW.innerHTML = aCredits[aCreditsIndex][4] + "&nbsp;";
			sW.className = "lCol";
			sN.appendChild(sW);
			
			var sW2 = document.createElement("div");
			sW2.innerHTML = aCredits[aCreditsIndex][0] + "&nbsp;";
			sW2.className = "lCol";
			sN.appendChild(sW2);
			
			var sW3 = document.createElement("div");
			sW3.innerHTML = aCredits[aCreditsIndex][1] + "&nbsp;";
			sW3.className = "lCol";
			sN.appendChild(sW3);
			
			var sW4 = document.createElement("div");
			sW4.innerHTML = aCredits[aCreditsIndex][2] + "&nbsp;";
			sW4.className = "lCol";
			sN.appendChild(sW4);
			
			var sW5 = document.createElement("div");
			sW5.innerHTML = "<a onclick='credits_Rem(" + aCreditsIndex + ",this)' class='btn'>Remove</a>";
			sW5.className = "lCol";
			sN.appendChild(sW5);
			
			get("dCreditsList").appendChild(sN);
			
			aCreditsIndex++;
		}
		function credits_Rem(i,n){
			aCredits[i] = null;
			rem(n.parentNode.parentNode);
			setChanges(true,"Credits");

		}
		
		
		// Hold all NEW agencies added using the agency form
		var aAgency = new Array;
		var aAgencyIndex = 0;
		function agency_Store(){
			
			if(agency_DefaultCheck(1) == false){
				return false;
			}
			
			setChanges(true,"Agency");
			
			var s = get("Agency_ID")[get("Agency_ID").selectedIndex].text;
			
			aAgency[aAgencyIndex] = new Array(2);
			aAgency[aAgencyIndex][0] = get("Agency_ID")[get("Agency_ID").selectedIndex].value; get("Agency_ID").selectedIndex = 0;
			aAgency[aAgencyIndex][1] = ""
			aAgency[aAgencyIndex][2] = ""
			aAgency[aAgencyIndex][3] = ""
			aAgency[aAgencyIndex][4] = get("Agency_Default").checked; get("Agency_Default").checked = false;

			var sN = document.createElement("div");
			sN.className = "lRow";
			
			var sW = document.createElement("div");
			sW.innerHTML = s;
			sW.className = "lCol";
			sN.appendChild(sW);
			
			var sW2 = document.createElement("div");
			if(aAgency[aAgencyIndex][4]){ // Check if is default
				sW2.innerHTML = "(Default)";
			}else{
				sW2.innerHTML = "-";
			}
			sW2.className = "lCol";
			sN.appendChild(sW2);
			
			var sW3 = document.createElement("div");
			sW3.innerHTML = "<a onclick='agency_Rem(" + aAgencyIndex + ",this)' class='btn'>Remove</a>";
			sW3.className = "lCol";
			sN.appendChild(sW3);
			
			get("dAgencyList").appendChild(sN);
			aAgencyIndex++;
		}
		function agency_Rem(i,n){
			aAgency[i] = null;
			rem(n.parentNode.parentNode);
			setChanges(true,"Agency");
		}
		function agency_DefaultCheck(m){
			var blnGo = false;
			if(m==1){ // Adding a agent representative
				if(get("Agency_Default").checked == true && get("Agency_DefaultFL").checked == true){
					alert("You cannot add a default agency if you have selected your freelance contact details as your default already. First unselect freelance as default contact method.");
					return false;
				}else if(get("Agency_Default").checked == true){
					for(x=0;x<aAgency.length;x++){
						if(aAgency[x][4] == true){
							if(blnGo == false){
								if(confirm("You have already selected another agent as your default. Would you prefer this agent as your default?") == true){
									blnGo = true;
								}else{
									blnGo = false;
									return false;
								}
							}
							if(blnGo == true){
								aAgency[x][4] = false;
								get("dAgencyList").childNodes[x].childNodes[1].innerHTML = "-";
							}
						}
					}
				}
			}else{ // Selecting freelance as default?
				if(get("Agency_DefaultFL").checked == true){
					for(x=0;x<aAgency.length;x++){
						if(aAgency[x][4] == true){
							if(blnGo == false){
								if(confirm("Would you prefer to be contacted at these contact details instead? Doing so will deselect any agents as your default.") == true){
									blnGo = true;
								}else{
									blnGo = false;
									return false;
								}
							}
							if(blnGo == true){
								aAgency[x][4] = false;	
								get("dAgencyList").childNodes[x].childNodes[1].innerHTML = "-";
							}
						}
					}
				}
			}
			return true;
		}
		
		// Rating system (stars)
		function rate(action,o){
			var s = ""; // To hold the id of the start img obj
			var aPnt = o.id.split("_");
			xM = aPnt[3];
			switch(action){
				case "hi":
					for(x=1;x<=xM;x++){
						s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_" + x;
						get(s).src=get(s).src.replace('_off.gif','.gif');
					}
					break;
				case "lo":
					for(x=1;x<=3;x++){
						s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_" + x;
						if(get(s).src.indexOf("_off.gif") == -1){
							get(s).src=get(s).src.replace('.gif','_off.gif');
						}
					}
					s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_P";
					if(get(s).value != ""){
						s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_" + get(s).value;
						rate('hi',get(s));
					}
					break;
				case "set":
					for(x=1;x<=3;x++){
						s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_" + x;
						if(get(s).src.indexOf("_off.gif") == -1){
							get(s).src=get(s).src.replace('.gif','_off.gif');
						}
					}
					for(x=1;x<=xM;x++){
						s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_" + x;
						get(s).src=get(s).src.replace('_off.gif','.gif');
					}
					s = aPnt[0] + "_" + aPnt[1] + "_" + aPnt[2] + "_P";
					get(s).value = xM;
					break;
			}
		}
		
		function setAgent(o){
			if(o.checked){
				get("dAgency_1").style.display = "block";
			}else{
				get("dAgency_1").style.display = "none";
			}
		}
		
		function setAgentEmail(){
			get("Agency_EmailAddress").value = get("Account_EmailAddress").value;
		}
		
		function loadReg(AccountID){
			
			switch(iPRoxyMethod){
				case 1:
					sRegProxy = "proxy/proxy_asp.asp?uri=";
					break;
				case 2:
					sRegProxy = "proxy/proxy_php.asp?uri=";
					break;
				case 3:
					sRegProxy = "proxy/proxy_aspdotnet.aspx?uri=";
					break;
			}
			
			// Reset variables
			iInvalidCount = 0;
			iPrimaryStep = 1;
			lGlob_AccountID = null;
			sGlob_EmailAddress = null;
			sGlob_FullName = null;
			blnChanges = false;
			sChanges = "";
			currNav = 0;
			aSections = new Array();
			// ******************
			
			DynamicLoad(sRegProxy + 'http://www.useimagine.com/imagine2/api/register_component/register.asp?ExposureID=' + lExposureID,sRegBlock,'init(' + AccountID + ')');	
			
		}
		
		function setForApproval(o){
			if(o.checked){
				var b = confirm('Submitting this account for approval will lock the account until approved by an administrator. Please ensure that you are satisfied with the quality of information before doing so.\n\nAre you sure you want submit your account now?');
				if(b){
					if(blnChanges){
						if(confirm("Save changes first?")==true){
							saveAll();
						}
					}
					// get list of exposure
					var eL = "&ExposureList=";
					for (i = 0; i < document.regForm.elements.length; i++){
						if (document.regForm.elements[i].type == "checkbox" && document.regForm.elements[i].id == "Exposure"){
							if(document.regForm.elements[i].checked == true){
								eL += document.regForm.elements[i].value + ",";
							}
						}
					}
					// ----------------------------
					DynamicLoad(sRegProxy + 'http://www.useimagine.com/imagine2/api/register_component/register_requestapproval.asp',sRegBlock,'setPrimaryStep("A")',encodeQS('AccountID=' + lGlob_AccountID + '&EmailAddress=' + sGlob_EmailAddress + '&Fullname=' + sGlob_Fullname + "&ExposureID=" + lExposureID + eL));
					
				}else{
					o.checked = false;
				}
			}
		}
		
		function loadCityValues(o){
			showLoading();
			if(o[o.selectedIndex].value != ""){
				
				remAll(get("Account_City"));
				elem = document.createElement("option");
				elem.value = "";
				elem.text = "- loading list -"
				inject(elem,get("Account_City"));
				
				/*
				remAll(get("Account_Area"));
				elem = document.createElement("option");
				elem.value = "";
				elem.text = "- loading list -"
				inject(elem,get("Account_Area"));
				*/
				
				DynamicLoad(sRegProxy + 'http://www.useimagine.com/imagine2/api/values_get_cities.asp','dTemp','showCityValues(\'' + o.id + '\');','as=text&country=' + o[o.selectedIndex].value);
			}else{
				
				remAll(get("Account_City"));
				//remAll(get("Account_Area"));
				hideLoading();
			}
				
		}
		function showCityValues(o){
			o = get(o);
			var oC = get("Account_City");
			var s = get("dTemp").innerHTML;
			var a = s.split("|");
			remAll(oC);
			for(x=0;x<a.length;x++){
				a2 = a[x].split(",");
				if(a2[2]){
					elem = document.createElement("option");
					elem.value = a2[0];
					elem.text = a2[2];
					inject(elem,get("Account_City"));
				}
			}
			//loadAreaValues(o.id);
			hideLoading();
		}
		
		function loadAreaValues(o){
			o = get(o);
			DynamicLoad(sRegProxy + 'http://www.useimagine.com/imagine2/api/values_get_towns.asp','dTemp','showAreaValues(\'' + o.id + '\');','as=text&country=' + o[o.selectedIndex].value);
		}
		function showAreaValues(o){
			o = get(o);
			var oC = get("Account_Area");
			var s = get("dTemp").innerHTML;
			var a = s.split("|");
			remAll(oC);
			for(x=0;x<a.length;x++){
				a2 = a[x].split(",");
				if(a2[2]){
					elem = document.createElement("option");
					elem.value = a2[0];
					elem.text = a2[2];
					inject(elem,get("Account_Area"));
				}
			}
			hideLoading();
		}
		
		function uploadCV(){
			window.open('http://www.useimagine.com/imagine2/api/register_component/register_cvupload.asp?AccountID=' + lGlob_AccountID + '&EmailAddress=' + sGlob_EmailAddress + '&Fullname=' + sGlob_Fullname + "&ExposureID=" + lExposureID + "&CardHolderID=" + iAccountType,'cvupload','width=320,height=30,resize=no,top='+ (screen.height/2 - 15) +',left=' + (screen.width/2 - 150));
		}
		
		function agency_addrequest(){
			DynamicLoad(sRegProxy + 'http://www.useimagine.com/imagine2/api/register_agencyaddrequest.asp','dTemp','agency_hiderequest()','agency_new_name=' + get('Agency_New_Name').value + '&agency_new_tel=' + get('Agency_New_Tel').value);
		}
		
		function agency_hiderequest(){
			get('dAgencyNew').style.display = 'none';
			if(get('Agency_ID').selectedIndex == 1){
				get('Agency_ID').selectedIndex = 0;
			}
		}
		
		function agency_showrequest(){
			get('dAgencyNew').style.display = 'block';
		}