function Agree(){ $("Submit").disabled=($("Submit").disabled)?false:true; };
function AccNews(){ $("ActiveNews").value=($("ActiveNews").value=="Y")?"N":"Y"; };

function MemberRegister(){
		//Get value==========
		var txtUsername=$("txtUsername").value;
		var txtPassword=$("txtPassword").value;
		var txtPassword2=$("txtPassword2").value;
		var cboPrefix=$("cboPrefix").value;
		var txtFirstName=$("txtFirstName").value;
		var txtLastName=$("txtLastName").value;
		var txtEmail=$("txtEmail").value;
		var cboNationality=$("cboNationality").value;
		var txtAddress1=$("txtAddress1").value;
		var txtAddress2=$("txtAddress2").value;
		var txtAddress3=$("txtAddress3").value;
		var txtState=$("txtState").value;
		var cboCountry=$("cboCountry").value;
		var cboCity=$("cboCity").value;
		var txtZipCode=$("txtZipCode").value;
		var txtPhone=$("txtPhone").value;
		var txtMobile=$("txtMobile").value;
		var txtFAX=$("txtFAX").value;
		var ActiveNews=$("ActiveNews").value;
		var txtMembership=$("txtMembership").value;
		var chkTermsConditons=$("chkTermsConditons").checked;

		//Hide error==========
		$("errUsername").style.display="none";
		$("errPassword").style.display="none";
		$("errPassword2").style.display="none";
		$("errPrefix").style.display="none";
		$("errFirstName").style.display="none";
		$("errLastName").style.display="none";
		$("errEmail").style.display="none";
		$("errNationality").style.display="none";
		$("errAddress1").style.display="none";
		$("errCountry").style.display="none";
		$("errCity").style.display="none";
		$("errZipCode").style.display="none";
		$("errPhone").style.display="none";
		$("errMobile").style.display="none";
		$("errMembership").style.display="none";

		//Check error=========
//		if(txtUsername=="" || txtUsername.length < 6){ $("errUsername").style.display=""; $("txtUsername").focus(); }else
//		if(txtPassword=="" || txtPassword.length < 6){ $("errPassword").style.display=""; $("txtPassword").focus(); }else
//		if(txtPassword !=txtPassword2){ $("errPassword2").style.display=""; $("txtPassword").focus(); }else
//		if(cboPrefix=="" || cboPrefix == "NONE"){ $("errPrefix").style.display=""; $("cboPrefix").focus(); }else
//		if(txtFirstName==""){ $("errFirstName").style.display=""; $("txtFirstName").focus(); }else
//		if(txtLastName==""){ $("errLastName").style.display=""; $("txtLastName").focus(); }else
//		if(txtEmail==""){ $("errEmail").style.display=""; $("txtEmail").focus(); }else
//		if(cboNationality=="" || cboNationality=="NONE"){ $("errNationality").style.display=""; $("cboNationality").focus(); }else
//		if(txtAddress1==""){ $("errAddress1").style.display=""; $("txtAddress1").focus(); }else
//		if(cboCountry=="" || cboCountry=="NONE"){ $("errCountry").style.display=""; $("cboCountry").focus(); }else
//		if(cboCity=="" || cboCity=="NONE"){ $("errCity").style.display=""; $("cboCity").focus(); }else
//		if(txtZipCode==""){ $("errZipCode").style.display=""; $("txtState").focus(); }else
//		if(txtPhone==""){ $("errPhone").style.display=""; $("txtPhone").focus(); }else
//		if(txtMobile==""){ $("errMobile").style.display=""; $("txtMobile").focus(); }else
//		if(txtMembership==""){ $("errMembership").style.display=""; $("txtMembership").focus(); }else

		if(!chkTermsConditons){alert("Please click accept Terms and Conditions."); return false; }else
		if(txtUsername=="" || txtUsername.length < 6){alert("Please input a Username that is within 6-12 characters.");$("txtUsername").focus(); return false;}else
		if(txtPassword=="" || txtPassword.length < 6){alert("Please Insert Password 6-12 characters.");$("txtPassword").focus(); return false;}else
		if(txtPassword !=txtPassword2){alert("The passwords do not match, please retype you passwords.");$("txtPassword").focus(); return false;}else
		if(txtUsername=="" || txtUsername.length < 6){ $("errUsername").style.display=""; $("txtUsername").focus(); }else
		if(txtPassword=="" || txtPassword.length < 6){ $("errPassword").style.display=""; $("txtPassword").focus(); }else
		if(txtPassword !=txtPassword2){ $("errPassword2").style.display=""; $("txtPassword").focus(); }else
		if(cboPrefix=="" || cboPrefix == "NONE"){ alert("Please select a Title"); $("cboPrefix").focus(); }else
		if(txtFirstName==""){ alert("Please input First Name."); $("txtFirstName").focus(); }else
		if(txtLastName==""){ alert("Please input Surname/Family Name."); $("txtLastName").focus(); }else
		if(txtEmail==""){ alert("Please input E-mail."); $("txtEmail").focus(); }else
		if(cboNationality=="" || cboNationality=="NONE"){ alert("Please Select Nationality"); $("cboNationality").focus(); }else
		if(txtAddress1==""){ alert("Please input Unit / Blk No"); $("txtAddress1").focus(); }else
		if(txtAddress2==""){ alert("Please input Street"); $("txtAddress2").focus(); }else
		if(cboCountry=="" || cboCountry=="NONE"){ alert("Please Select Country"); $("cboCountry").focus(); }else
		if(cboCity=="" || cboCity=="NONE"){ alert("Please Select City"); $("cboCity").focus(); }else
		if(txtZipCode==""){ alert("Please input Zip / Postal Code"); $("txtZipCode").focus(); }else
		if(txtPhone==""){ alert("Please input Phone Number"); $("txtPhone").focus(); }else
		if(txtMobile==""){ alert("Please input Mobile Number"); $("txtMobile").focus(); }else
		if(txtMembership==""){ alert("Please select membership");}else
		{
			Mode="REGISTERCHECK";
			Path="txtUsername="+txtUsername+"&";
			Path+="txtPassword="+txtPassword+"&";
			Path+="cboPrefix="+cboPrefix+"&";
			Path+="txtFirstName="+txtFirstName+"&";
			Path+="txtLastName="+txtLastName+"&";
			Path+="txtEmail="+txtEmail+"&";
			Path+="cboNationality="+cboNationality+"&";
			Path+="txtAddress1="+txtAddress1+"&";
			Path+="txtAddress2="+txtAddress2+"&";
			Path+="txtAddress3="+txtAddress3+"&";
			Path+="txtState="+txtState+"&";
			Path+="cboCountry="+cboCountry+"&";
			Path+="cboCity="+cboCity+"&";
			Path+="txtZipCode="+txtZipCode+"&";
			Path+="txtPhone="+txtPhone+"&";
			Path+="txtMobile="+txtMobile+"&";
			Path+="txtFAX="+txtFAX+"&";
			Path+="ActiveNews="+ActiveNews+"&";
			Path+="txtMembership="+txtMembership+"&";
			var myurl = "../Member/MemberRegister.php", http = new getXMLHTTPRequest();
			$("sProcessing").style.display="";
			$("sSubmit").style.display="none";
			http.onreadystatechange = function() {if (http.readyState != 4) { return; }
				var mytext = http.responseText;
				$("sMemberLogin").innerHTML=mytext;
				if($("MemCode")){
					if($("MemCode").value != ""){
						$("txtLoginUsername").value=$("txtUsername").value;
						$("txtLoginPassword").value=$("txtPassword").value;
						TravFlex.login ();
					}else{
						$("sProcessing").style.display="none";
						$("sSubmit").style.display="";
						alert("You username or email is dupicate. Please try again.");
					}
				}else{
						$("sProcessing").style.display="none";
						$("sSubmit").style.display="";
						alert("You username or email is dupicate. Please try again.");
				}
			}
			http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			http.send(Path+"&"+new Date().getTime());
	}
}

function DropCity(ObjCo,CityCode){
	var myurl = "../Member/dropcity.php", http = new getXMLHTTPRequest();
	http.onreadystatechange = function() {if (http.readyState != 4) { return; }
		var mytext = http.responseXML;
		$("cboCity").length = 1;
		var obj = mytext.getElementsByTagName("Code");
		for(i=0; i<obj.length; i+=1){
			var data = obj[i];
			var Code = data.firstChild.nodeValue;
			var LongName = mytext.getElementsByTagName("LongName")[i].firstChild.nodeValue;
			var objOption = new Option(LongName, Code);
			$("cboCity").options[i] = objOption;
		}
		if(CityCode){ $("cboCity").value=CityCode;}
	};
	http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send("CountryCode="+ObjCo.value+"&"+new Date().getTime());
}
function isEmail(string){
	chkMail=string.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) ;
	if(chkMail==-1){
		alert("Please check the email address. A valid email address is required.");
		string.focus();
		string.value="";
	}
	return(chkMail);
}
function ShowMRegis(){
	if($("content-memberregis")){ $("content-memberregis").style.display=($("content-memberregis").style.display=="")?"none":""; }
	if($("c-rg-member")){ $("c-rg-member").style.display=($("c-rg-member").style.display=="")?"none":""; }
}
function MemberProfile(){
	var myurl = "../Member/MemberProfile.php", http = new getXMLHTTPRequest();
	http.onreadystatechange = function() {if (http.readyState != 4) { return; }
		var mytext = http.responseText;
		if($("sMemberProfile")){
			$("sMemberProfile").innerHTML = mytext;

			if($("ssPPoint")) $("ssPPoint").style.display=($("PAmount").value > 0)?"":"none";
			if($("sPAmount")) $("sPAmount").innerHTML=$("PAmount").value;
			if($("sPCurrency")) $("sPCurrency").innerHTML=$("PCurrency").value;
			if($("sPPoint")) $("sPPoint").innerHTML=$("PPoint").value;

			if($("ssUPPoint")) $("ssUPPoint").style.display=($("UPAmount").value > 0)?"":"none";
			if($("sUPAmount")) $("sUPAmount").innerHTML=$("UPAmount").value;
			if($("sUPCurrency")) $("sUPCurrency").innerHTML=$("UPCurrency").value;
			if($("sUPPoint")) $("sUPPoint").innerHTML=$("UPPoint").value;

			if($("ssTotalPoint")) $("ssTotalPoint").style.display=($("Point").value > 0)?"":"none";
			if($("sTotalPoint")) $("sTotalPoint").innerHTML=$("Point").value;
			if($("sUsedPoint")) $("sUsedPoint").innerHTML=$("UPoint").value;

			if($("sUsername")) $("sUsername").innerHTML=$("UserName").value+"&nbsp;";
			if($("sMembership")) $("sMembership").innerHTML=$("Membership").value+"&nbsp;";
			if($("sPrefix")) $("sPrefix").innerHTML=$("PrefixName").value+"&nbsp;";
			if($("cboPrefix")) $("cboPrefix").value=$("PrefixCode").value;
			if($("sFirstName")) $("sFirstName").innerHTML=$("Name").value+"&nbsp;";
			if($("txtFirstName")) $("txtFirstName").value=$("Name").value;
			if($("sLastName")) $("sLastName").innerHTML=$("Surname").value+"&nbsp;";
			if($("txtLastName")) $("txtLastName").value=$("Surname").value;
			if($("sEmail")) $("sEmail").innerHTML=$("Email").value+"&nbsp;";
			if($("txtEmail")) $("txtEmail").value=$("Email").value;
			if($("sPhone")) $("sPhone").innerHTML=$("Telno").value+"&nbsp;";
			if($("txtPhone")) $("txtPhone").value=$("Telno").value;
			if($("sMobile")) $("sMobile").innerHTML=$("Mobileno").value+"&nbsp;";
			if($("txtMobile")) $("txtMobile").value=$("Mobileno").value;
			if($("sNationality")) $("sNationality").innerHTML=$("NationalityName").value+"&nbsp;";
			if($("cboNationality")) $("cboNationality").value=$("NationalityCode").value;
			if($("sAddress1")) $("sAddress1").innerHTML=$("Address1").value+"&nbsp;";
			if($("txtAddress1")) $("txtAddress1").value=$("Address1").value;
			if($("sAddress2")) $("sAddress2").innerHTML=$("Address2").value+"&nbsp;";
			if($("txtAddress2")) $("txtAddress2").value=$("Address2").value;
			if($("sAddress3")) $("sAddress3").innerHTML=$("Address3").value+"&nbsp;";
			if($("txtAddress3")) $("txtAddress3").value=$("Address3").value;
			if($("sState")) $("sState").innerHTML=$("State").value+"&nbsp;";
			if($("txtState")) $("txtState").value=$("State").value;
			if($("sCountry")) $("sCountry").innerHTML=$("CountryName").value+"&nbsp;";
			if($("cboCountry")) $("cboCountry").value=$("CountryCode").value;
			if($("cboCity")) DropCity($("cboCountry"),$("CityCode").value);
			if($("sCity")) $("sCity").innerHTML=$("CityName").value+"&nbsp;";
			if($("sZip")) $("sZip").innerHTML=$("Zipcode").value+"&nbsp;";
			if($("txtZipCode")) $("txtZipCode").value=$("Zipcode").value;
			if($("sFAX")) $("sFAX").innerHTML=$("Facsimile").value+"&nbsp;";
			if($("txtFAX")) $("txtFAX").value=$("Facsimile").value;
		}
	};
	http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send("sAgentCode="+$("sAgentCode").value+"&"+new Date().getTime());
}
function ShowMenuProfile(Mode){
	$("sChangePassword").style.display="none";
	$("sChangeProfile").style.display="none";
	$("sDetailProfile").style.display="none";
	switch(Mode){
		case "CP" : $("sChangePassword").style.display=""; break;
		case "EP" : $("sChangeProfile").style.display=""; break;
		case "P" : $("sDetailProfile").style.display=""; break;
	}
}
function ChangePassword(){
	$("errOldPass").style.display="none";
	$("errPassword").style.display="none";
	$("errPassword2").style.display="none";
//	alert($("txtOldPass").value+"="+$("txtNewPass").value+"="+$("txtPassCon").value);
	$txtOldPass=$("txtOldPass").value;
	$txtNewPass=$("txtNewPass").value;
	$txtPassCon=$("txtPassCon").value;
	if($txtOldPass=="" || $txtOldPass.length < 6){ $("errOldPass").style.display=""; $("errOldPass").focus(); }else
	if($txtNewPass=="" || $txtNewPass.length < 6){ $("errPassword").style.display=""; $("txtNewPass").focus(); }else
	if($txtPassCon != $txtNewPass){ $("errPassword2").style.display=""; $("txtPassCon").focus(); }else{
	FileChangePassword();
	}
}
function FileChangePassword(){
	var myurl = "../Member/MemberChangePassword.php", http = new getXMLHTTPRequest();
	http.onreadystatechange = function() {if (http.readyState != 4) { return; }
		var mytext = http.responseText;
		$("DataChangePassword").innerHTML=mytext;
		if($("ChangeValue").value==1){
			MemberLoginConnect($("ShortName").value,$("UserName").value,$("txtNewPass").value);
		}else{
			alert("Can not change password. Please try again.");
		}
	};
	alert("Change Password Complete");
	window.location.reload();
	http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send("PfUserCode="+$("PfUserCode").value+"&txtOldPass="+$("txtOldPass").value+"&txtNewPass="+$("txtNewPass").value+"&txtPassCon="+$("txtPassCon").value+"&"+new Date().getTime());
}
//////////////////Edit by kid 18/09/2008 1:15 PM /.////////////////////
function chkshowlyMemberStatLogin(M){
		if(M=="rss"){
			var myurl = "/inc/hs_member_status.php";
		}else{
			var myurl = "/inc/member-status.php";
		}
		var http = new getXMLHTTPRequest();
		http.onreadystatechange = function() {if (http.readyState != 4) { return; }
			var myText = http.responseText;
			if ($("lyMemberStatLogin"))$("lyMemberStatLogin").innerHTML=myText;
			return;
		};
		http.open("POST", myurl, true);
		http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send("DateTime="+new Date().getTime());
	};

	/////////////////   END   ///////////////////////////////////////

function ChangeProfile(){
	var Code=$("Code").value;
	var PfUserCode=$("PfUserCode").value;
	var cboPrefix=$("cboPrefix").value;
	var txtFirstName=$("txtFirstName").value;
	var txtLastName=$("txtLastName").value;
	var txtEmail=$("txtEmail").value;
	var cboNationality=$("cboNationality").value;
	var txtAddress1=$("txtAddress1").value;
	var txtAddress2=$("txtAddress2").value;
	var txtAddress3=$("txtAddress3").value;
	var txtState=$("txtState").value;
	var cboCountry=$("cboCountry").value;
	var cboCity=$("cboCity").value;
	var txtZipCode=$("txtZipCode").value;
	var txtPhone=$("txtPhone").value;
	var txtMobile=$("txtMobile").value;
	var txtFAX=$("txtFAX").value;

	//Hide error==========
	$("errPrefix").style.display="none";
	$("errFirstName").style.display="none";
	$("errLastName").style.display="none";
	$("errEmail").style.display="none";
	$("errNationality").style.display="none";
	$("errAddress1").style.display="none";
	$("errCountry").style.display="none";
	$("errCity").style.display="none";
	$("errZipCode").style.display="none";
	$("errPhone").style.display="none";
	$("errMobile").style.display="none";

	//Check error=========
	if(cboPrefix=="" || cboPrefix == "NONE"){ $("errPrefix").style.display=""; $("cboPrefix").focus(); }else
	if(txtFirstName==""){ $("errFirstName").style.display=""; $("txtFirstName").focus(); }else
	if(txtLastName==""){ $("errLastName").style.display=""; $("txtLastName").focus(); }else
	if(txtEmail==""){ $("errEmail").style.display=""; $("txtEmail").focus(); }else
	if(cboNationality=="" || cboNationality=="NONE"){ $("errNationality").style.display=""; $("cboNationality").focus(); }else
	if(txtAddress1==""){ $("errAddress1").style.display=""; $("txtAddress1").focus(); }else
	if(cboCountry=="" || cboCountry=="NONE"){ $("errCountry").style.display=""; $("cboCountry").focus(); }else
	if(cboCity=="" || cboCity=="NONE"){ $("errCity").style.display=""; $("cboCity").focus(); }else
	if(txtZipCode==""){ $("errZipCode").style.display=""; $("txtZipCode").focus(); }else
	if(txtPhone==""){ $("errPhone").style.display=""; $("txtPhone").focus(); }else
	if(txtMobile==""){ $("errMobile").style.display=""; $("txtMobile").focus(); }else
	{
		Path="Code="+Code+"&";
		Path+="PfUserCode="+PfUserCode+"&";
		Path+="cboPrefix="+cboPrefix+"&";
		Path+="txtFirstName="+txtFirstName+"&";
		Path+="txtLastName="+txtLastName+"&";
		Path+="txtEmail="+txtEmail+"&";
		Path+="cboNationality="+cboNationality+"&";
		Path+="txtAddress1="+txtAddress1+"&";
		Path+="txtAddress2="+txtAddress2+"&";
		Path+="txtAddress3="+txtAddress3+"&";
		Path+="txtState="+txtState+"&";
		Path+="cboCountry="+cboCountry+"&";
		Path+="cboCity="+cboCity+"&";
		Path+="txtZipCode="+txtZipCode+"&";
		Path+="txtPhone="+txtPhone+"&";
		Path+="txtMobile="+txtMobile+"&";
		Path+="txtFAX="+txtFAX+"&";
		var myurl = "../Member/MemberEditProfile.php", http = new getXMLHTTPRequest();
		http.onreadystatechange = function() {if (http.readyState != 4) { return; }
			var mytext = http.responseText;
			if(mytext=="complete"){
				//$("DataChangeProfile").innerHTML=mytext;
				if(ChkNumaric($("txtFirstName"))==false || ChkNumaric($("txtLastName"))==false){return;}else{MemberLoginConnect($("ShortName").value,$("UserName").value,$("UPassword").value);}
			}else{
				alert("Can not change email. Please try again.");
			}
		}
		alert("Change Profile Complete");
		window.location.reload();
		http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send(Path+"&"+new Date().getTime());
	}
}
var Posi;
function mozilarShow(e) {
	evt = e;
	if(navigator.appName!="Netscape"){
	xCoord =event.x+document.body.scrollLeft-50;
	yCoord = Calendar.getAbsolutePos(Posi).y+25;
	}else{
	xCoord = window.evt.pageX-150 ;
	yCoord = window.evt.pageY+25 ;
	}
	$("dek").style.left = xCoord+'px';
	$("dek").style.top = yCoord+'px';
}
function popup(Obj){
	var des = Obj.getAttribute("des");
//	var comp = Obj.getAttribute("com");
//	var surc =  Obj.getAttribute("sup");
//	var CheckIn = Obj.getAttribute("dt");
	if(des!=""){
		GenHtml ="<div style='width:400px; border:1px solid #EEE;'>";
		GenHtml +="		<span style='display:block; padding:1px; background:#FFFEEE;'><span style='display:block; background:#0051A1; padding:3px 5px;'>";
		GenHtml +="			<span style='display:block; float:left; color:#FFF; font-size:11px; font-weight:bold;'>Description</span>";
	//	GenHtml +="			<span style='display:block; float:right; color:#FFF; font-size:11px; font-weight:bold;'>"+CheckIn+"</span>";
		GenHtml +="			<span style='display:block; clear:both;'></span></span>";
		GenHtml +="		</span>";
		GenHtml +="	<span style='display:block; padding:1px; background:#FFFEEE;'>";
		GenHtml +="		<span style='display:block; padding:5px;'>";
		GenHtml +="			<strong style='display:block; float:left;'></strong>			<span style='display:block; float:left;'>"+des+"</span>";
		GenHtml +="			<span style='display:block; clear:both;'></span>";
	//	GenHtml +="			<strong style='display:block; float:left;'>Compulsory</strong>		<span style='display:block; float:right;'>"+comp+"</span>";
	//	GenHtml +="			<span style='display:block; clear:both;'></span>";
	//	GenHtml +="			<strong style='display:block; float:left;'>Supplement</strong>		<span style='display:block; float:right;'>"+surc+"</span>";
	//	GenHtml +="			<span style='display:block; clear:both;'></span>";
		GenHtml +="		</span>";
		GenHtml +="	</span>";
		GenHtml +="</div>";
		$("dek").innerHTML=GenHtml;
		$("dek").style.visibility="visible";
		$("dek").style.display="";
		Posi=Obj;
		document.onmousemove = mozilarShow;
	}
}

function hide(){
$("dek").style.visibility="";
$("dek").style.display="none";
}

function ChkNumaric(obj){
	var chkString = true;
	inputStr = obj.value;
	if(inputStr.length<2){
		alert("Name and Surname must be more than 1 character");
		obj.value="";
		obj.focus();
		chkString = false;
	}
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.substring(i, i + 1);
		if (oneChar == "0" || oneChar == 1 || oneChar == 2 || oneChar == 3 || oneChar == 4 || oneChar == 5 || oneChar == 6 || oneChar == 7 || oneChar == 8 || oneChar == 9) {
			//chk = true;
			alert("The digits not allows");
			obj.value="";
			obj.focus();
			chkString = false;
			break;
	   }
	}
	return chkString;
}
function isBlankF(string) {
var vchkBlank;
chkBlank=string.value.substr(0,1);
cText=string.value;
	if(chkBlank==" "){
		alert("First charactor not allow to space. Please try again.");
		string.value="";
		vchkBlank=true;
	}else
		if(chkBlank=="-" || chkBlank=="_" || chkBlank=="^"){
		alert('First charactor not allow to " - "," _ "," ^ " Please try again.');
		string.value="";
		vchkBlank=true;
	}else
		if(cText.indexOf(".")!="-1"){
		alert('All charactor not allow to " . " Please try again.');
		string.value="";
		vchkBlank=true;
	}else{
		vchkBlank=true;
	}
	return(vchkBlank);
}

function CheckNum(obj) {
	inputStr = obj.value;
	chk = true;
	for (var i = 0; i < inputStr.length; i++) {
		var oneChar = inputStr.substring(i, i + 1)
		if (oneChar != 0 && oneChar != 1 && oneChar != 2 && oneChar != 3 && oneChar != 4 && oneChar != 5 && oneChar != 6 && oneChar != 7 && oneChar != 8 && oneChar != 9 && oneChar != "+" && oneChar != "(" && oneChar != ")") {
			chk=false;
			obj.value="";
	   }
	}
	if(!chk){
		alert("Only numeric. Please try again.");
		obj.focus();
	}
}

function MemberLoginConnect(){
	var txtUserName=($("txtUserName"))?$("txtUserName").value:$("UserName").value;
	var txtPassword=($("txtPassword"))?$("txtPassword").value:$("UPassword").value;
	var txtLoginShortName=($("txtLoginShortName"))?$("txtLoginShortName").value:$("txtLoginShortName").value;
	if($("btn_login")) $("btn_login").disabled=true;
	var myurl = "/Member/MemberLoginConnect.php", http = new getXMLHTTPRequest();
	http.onreadystatechange = function() {if (http.readyState != 4) { return; }
		var mytxt=http.responseText;
		if($("lyDetailRegister")){
			if($("btn_login")) $("btn_login").disabled=false;
			$("lyDetailRegister").innerHTML=mytxt;
			if($("Respond")){
				if($("Respond").value=="GO"){
					if($("URLNext")){ window.open($("URLNext").value,"_self"); }else
					if(LoadPay){
						window.location.reload();
						//LoadPay.LoadPayment();
					}
				}else{
					alert($("Respond").value);
				}
			}
		}
	};
	http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	//http.send("txtUserName="+txtUserName+"&Respond="+txtPassword+"&txtLoginShortName="+txtLoginShortName+"&"+new Date().getTime());
	http.send("txtUserName="+txtUserName+"&txtPassword="+txtPassword+"&txtLoginShortName="+txtLoginShortName+"&"+new Date().getTime());
}

var strDup="unknown";
function SubmitPaymentNewMember(){
	var elm=$("ly-membership").getElementsByTagName("input");
	var found=false;
	for(var i=0; i<elm.length; i++){
		if($("memberfee-"+i).checked){
			found=true;
			break;
		}
	}
	$("lytxtUserNameNew").style.display='none';
	$("lytxtPasswordNew").style.display='none';
	$("lytxtPasswordNewConfirm").style.display='none';
	$("lytxtEmail").style.display='none';
	$("lytxtFirstName").style.display='none';
	$("lytxtLastName").style.display='none';
	$("lycboPassport").style.display='none';
	$("lycboCountry").style.display='none';
	$("lycboCity").style.display='none';
	$("lytxtPhone").style.display='none';
	$("lytxtMobile").style.display='none';
	$("lytxtAddress1").style.display='none';
	$("lytxtAddress2").style.display='none';
	if(($("txtUserNameNew").value=="")||($("txtUserNameNew").value.length < 6)){ chktxtUserNameNew(); }else
	if(($("txtPasswordNew").value=="")||($("txtPasswordNew").value.length < 6) || ($("txtPasswordNew").value.toLowerCase()==strDup)){ chktxtPasswordNew(); }else
	if(($("txtPasswordNewConfirm").value=="")||($("txtPasswordNewConfirm").value.length < 6) || ($("txtPasswordNewConfirm").value.toLowerCase()==strDup)){ chktxtPasswordNewSame(); }else
	if($("txtPasswordNewConfirm")!=$("txtPasswordNewConfirm")){ chktxtPasswordNewConfirm(); }else
	if($("txtFirstName").value==""){ chktxtFirstName(); }else
	if($("txtLastName").value==""){ chktxtLastName(); }else
	if($("txtAddress1").value==""){ chktxtAddress1(); }else
	if($("txtAddress2").value==""){ chktxtAddress2(); }else
	if($("txtPhone").value==""){ chktxtPhone(); }else
	if($("txtMobile").value==""){ chktxtMobile(); }else
	if($("cboPassport").value==""){ chkcboPassport(); }else
	if($("cboCountry").value==""){ chkcboCountry(); }else
	if($("cboCity").value=="" || $("cboCity").value=="NONE"){ chkcboCity(); }else
	if($("txtEmail").value==""){ chktxtEmail(); }else
	if(($("txtPasswordNew").value!=$("txtPasswordNewConfirm").value)){ chktxtPasswordNewSame(); }else{
	if(!found){alert('Please select membership');}else{
		var Path="txtUsername="+$("txtUserNameNew").value+"&";
		Path+="txtPassword="+$("txtPasswordNew").value+"&";
		Path+="cboPrefix="+$("cboPrefix").value+"&";
		Path+="txtFirstName="+$("txtFirstName").value+"&";
		Path+="txtLastName="+$("txtLastName").value+"&";
		Path+="txtAddress1="+$("txtAddress1").value+"&";
		Path+="txtAddress2="+$("txtAddress2").value+"&";
		Path+="txtEmail="+$("txtEmail").value+"&";
		Path+="cboNationality="+$("cboPassport").value+"&";
		Path+="cboCountry="+$("cboCountry").value+"&";
		Path+="cboCity="+$("cboCity").value+"&";
		Path+="txtPhone="+$("txtPhone").value+"&";
		Path+="txtMobile="+$("txtMobile").value+"&";
		Path+="txtFAX="+$("txtFAX").value+"&";
		Path+="txtMembership="+$("txtMembership").value+"&";

		var myurl = "/Member/MemberRegister.php", http = new getXMLHTTPRequest();
		$("btn_register").style.disabled=true;
		http.onreadystatechange = function() {
			if (http.readyState != 4) { return; }
			var mytext = http.responseText;
			$("lyDetailRegister").innerHTML=mytext;
			if($("MemCode")){
				if($("MemCode").value != ""){
					$("txtUserName").value=$("txtUserNameNew").value;
					$("txtPassword").value=$("txtPasswordNew").value;
					$("txtLoginShortName").value=$("txtLoginShortName").value;
					MemberLoginConnect();
				}else{
					$("btn_register").style.disabled=false;
					alert("You username or email is dupicate. Please try again.");
				}
			}else{
				$("btn_register").style.disabled=false;
				alert("You username or email is dupicate. Please try again.");
			}
		}
		http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send(Path+"&"+new Date().getTime());
	}
	}
}

function chktxtPasswordNew(){
	$("txtPasswordNew").select();
	$("txtPasswordNew").focus();
	$("lytxtPasswordNew").style.display='';
	if($("txtPasswordNew").value.toLowerCase()==strDup){
		$("lytxtPasswordNew").innerHTML='Sorry but this password are not accepted.';
	}
	else {
		$("lytxtPasswordNew").innerHTML='Please Insert Password 6-12 Characters';
	}
}
function chktxtPasswordNewConfirm(){
	$("txtPasswordNewConfirm").select();
	$("txtPasswordNewConfirm").focus();
	$("lytxtPasswordChkNewConfirm").style.display='';
}
function chktxtPasswordNewSame(){
	$("txtPasswordNew").select();
	$("lytxtPasswordNew").style.display='';
	$("lytxtPasswordNewConfirm").style.display='';
}
function chktxtFirstName(){
	$("txtFirstName").select();
	$("txtFirstName").focus();
	$("lytxtFirstName").style.display='';
}
function chktxtLastName(){
	$("txtLastName").select();
	$("txtLastName").focus();
	$("lytxtLastName").style.display='';
}
function chktxtPhone(){
	$("txtPhone").select();
	$("txtPhone").focus();
	$("lytxtPhone").style.display='';
}
function chktxtMobile(){
	$("txtMobile").select();
	$("txtMobile").focus();
	$("lytxtMobile").style.display='';
}
function chkcboCountry(){
	$("lycboCountry").style.display='';
}
function chkcboCity(){
	$("lycboCity").style.display='';
}
function chkcboPassport(){
	$("lycboPassport").style.display='';
}
function chktxtAddress1(){
	$("txtAddress1").select();
	$("lytxtAddress1").style.display='';
}
function chktxtAddress2(){
	$("txtAddress2").select();
	$("lytxtAddress2").style.display='';
}
function chktxtCity(){
	$("lytxtCity").style.display='';
}
function chktxtZipcode(){
	$("txtZipcode").select();
	$("lytxtZipcode").style.display='';
}
function chktxtEmail(){
	$("txtEmail").select();
	$("lytxtEmail").style.display='';
}
function chkVarchkMemberC(){
	$("lychkMember").style.display='';
}
function chktxtUserNameNew(){
	$("txtUserNameNew").select();
	$("txtUserNameNew").focus();
	$("lytxtUserNameNew").style.display='';
}
