	function Insert()
	{
		//~ //Show Modal Background
		revealModal("modalPage", "");
				
		//Get object Account info
		var hAccountSetup = document.getElementById("hAccountSetup");
		//Get object Company input hidden
		var hCompany = document.getElementById("hCompany");
		//Get object languageSupport input hidden
		var hLanguageSupport = document.getElementById("hLanguageSupport");
		//Get object Company Profile
		var hCompanyProfile = document.getElementById("hCompanyProfile");;
		//Get object Primary Contact
		var hPrimaryContact = document.getElementById("hPrimaryContact");
		//Get object ServiceArea input hidden
		var hServiceArea = document.getElementById("hServiceArea");
		//Get object Industry input hidden
		var hIndustry = document.getElementById("hIndustry");
		//Get object ServiceVar input hidden
		var hServiceVar = document.getElementById("hServiceVar");
		//Get object Partnerships input hidden
		var hPartnerships = document.getElementById("hPartnerships");	


		//~ //Split All Value Company Profile for Encode the Logo Source
		//~ var AllValueCP = hCompanyProfile.value.split("#");
		//~ var CompanyLogo = "";
		//~ if(AllValueCP[2] != null && AllValueCP[2] != "")
			//~ CompanyLogo = ReplaceIllegalChar(AllValueCP[2]);
			
		//~ hCompanyProfile.value = AllValueCP[0] + "#" + AllValueCP[1] + "#" + CompanyLogo;
		
		
		//~ //Split All Value Primary Contact for Encode the Photo Source
		//~ var AllValuePC = hPrimaryContact.value.split("#");
		//~ //Get Photo Length
		//~ var PhotoName = AllValuePC[6].split(",");
		
		//~ var Photos = "";		
		//~ //There is A photo uploaded
		//~ if(AllValuePC[6] != "" && AllValuePC[6] != null && AllValuePC[6].length > 0)
		//~ {	
			//~ for(var i = 0; i < PhotoName.length; i++)
				//~ Photos += ReplaceIllegalChar(PhotoName[i]) + ",";
				
			//~ Photos = Photos.substring(0, Photos.length - 1);
		//~ }
		
		//~ hPrimaryContact.value = AllValuePC[0] + "#" + AllValuePC[1] + "#" + AllValuePC[2] + "#" + AllValuePC[3] + "#" + AllValuePC[4] + "#" + AllValuePC[5] + "#" + Photos;
		
		
		var Parameter = "AccountSetup=" + ReplaceIllegalChar(hAccountSetup.value) +
				       "&Company=" + ReplaceIllegalChar(hCompany.value) + 
				       "&LanguageSupport=" + hLanguageSupport.value + 
				       "&CompanyProfile=" + ReplaceIllegalChar(hCompanyProfile.value) +
				       "&PrimaryContact=" + ReplaceIllegalChar(hPrimaryContact.value) +
				       "&ServiceArea=" + ReplaceIllegalChar(hServiceArea.value) +
				       "&Industry=" + hIndustry.value +
				       "&ServiceVar=" + hServiceVar.value +
				       "&Partnerships=" + hPartnerships.value;	
			
		//~ alert(hAccountSetup.value);
		//~ alert(hCompany.value);
		//~ alert(hLanguageSupport.value);
		//~ alert(hCompanyProfile.value);
		//~ alert(hPrimaryContact.value);
		//~ alert(hServiceArea.value);
		//~ alert(hIndustry.value);
		//~ alert(hServiceVar.value);
		//~ alert(hPartnerships.value);
		
		//~ alert(Parameter);
	
		fullURL = parent.document.URL;
		qs = fullURL.split('?');
		var cid = "";
		if(qs.length > 1)
		{
			queryStr = qs[1].split('&');
			for(var i=0; i<queryStr.length; i++)
			{
				key = queryStr[i].split('=');
				if(key[0] =="cid")
					cid = key[1];
			}
		}
	
		if (cid != "")
			cid = "?cid=" + cid;
		RequestPageInsert("insertregistration.php" + cid, Parameter);
	}
	
	function RequestPageInsert(url, parameter)
	{
		xmlhttp=null;
		// code for Mozilla, etc.
		if (window.XMLHttpRequest)
		  {
			xmlhttp=new XMLHttpRequest();
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		if (xmlhttp!=null)
		  {
			  xmlhttp.open("POST",url,true);
			  
			  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			  xmlhttp.setRequestHeader("Content-length", parameter.length);
			  xmlhttp.setRequestHeader("Connection", "close");
			  
			  xmlhttp.onreadystatechange=StateChangeInsert;					
			  xmlhttp.send(parameter);				
		  }
		else
		  {
			alert("Your browser does not support XMLHTTP.");
		  }
	}
	
	function StateChangeInsert()
	{				
		//readyState, 0 = uninitialized
		//		1 = loading
		//		2 = loaded
		//		3 = interactive
		//		4 = complete
		
		//Completed Request
		if (xmlhttp.readyState==4)
		  {
			// Status value just 404 and 200, 404 = "Not Found" & 200 = "Ok"
			if (xmlhttp.status==200)
			{				
				//Get Response from next page
				var resp = xmlhttp.responseText;	// response
				//~ alert(resp);				
				var sNotification = document.getElementById("Notification");
				var sConfirmation = document.getElementById("Confirmation");
				var tblConfirmation = document.getElementById("tblConfirmation");
				var content2 = document.getElementById("content2");
				var RespValue = resp.split("#");
				//~ Successfull for Registration
				if(RespValue[0] == "true")
				{
					//From Registration
					if(RespValue[1] == "insert")
					{
						sNotification.innerHTML = "Registration success";
						sConfirmation.innerHTML = " ";
						tblConfirmation.innerHTML = " ";
						content2.style.display = "none";
					}
					//From Update
					else
					{
						sNotification.innerHTML = "Update success <br/>";
					}
				}
				//~ Registration not completed
				else
				{	
					sNotification.innerHTML = "Save data failed.";
					content2.style.display = "";
				}
				
				hideModal("modalPage");
				//var sResultSearch = document.getElementById("ResultSearch");						
				//sResultSearch.innerHTML = resp;
			}
			else
			{
				alert("Problem retrieving data");
				hideModal("modalPage");
			}
		  }
	}