function check_memberblc(f,c,m){
	window.location = 'index.php?module=register&checkblc=1&mid='+m+'&check='+c+'&code='+f.value;
}

/*///////////////function popup/////////////////////*/	
var win=null;
function NewWindow(mypage,myname,w,h,pos,scrollbars,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars="+scrollbars+",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.focus();}
/*///////////////end/////////////////////*/	

function check_register(){
	var f = document.form_register_form;
	if(f.username.value == ""){
		alert('กรุณา ตรวจสอบชื่อผู้ใช้ด้วยค่ะ');
		f.username.focus();
		return false;
	}else if(f.password.value == ""){
		alert('กรุณาใส่ รหัสผ่านด้วยค่ะ');
		f.password.focus();
		return false;
	}else if(f.password.value != "" && f.repassword.value == ""){
		alert('กรุณาใส่ ยืนยันรหัสผ่านด้วยค่ะ');
		f.repassword.focus();
		return false;
	}else if(f.password.value !=  f.repassword.value){
		alert('กรุณาใส่ รหัสผ่าน กับยืนยันรหัสผ่านให้ตรงกันด้วยค่ะ');
		f.repassword.focus();
		return false;
	}else if(f.firstname.value == ""){
		alert('กรุณาใส่ ชื่อด้วยค่ะ');
		f.firstname.focus();
		return false;
	}else if(f.lastname.value == ""){
		alert('กรุณาใส่ นามสกุลด้วยค่ะ');
		f.lastname.focus();
		return false;
	}else if(f.email.value == ""){
		alert('กรุณาใส่ อีเมล์ด้วยค่ะ');
		f.email.focus();
		return false;
	}else if(f.address.value == ""){
		alert('กรุณาใส่ ที่อยู่ด้วยค่ะ');
		f.address.focus();
		return false;
	}else if(f.zipcode.value == ""){
		alert('กรุณาใส่ รหัสไปรษณีย์ด้วยค่ะ');
		f.zipcode.focus();
		return false;
	}else if(f.tel.value == ""){
		alert('กรุณาใส่ เบอร์โทรศัพท์ด้วยค่ะ');
		f.tel.focus();
		return false;
	}else if(f.mobile.value == ""){
		alert('กรุณาใส่ เบอร์โทรศัพท์มือถือด้วยค่ะ');
		f.mobile.focus();
		return false;
	}
	}
/*///////////////function ลบ field/////////////////////*/	
	var oBuffer=new FieldBuffer();
	
	function FieldBuffer() {
		FieldBuffer.prototype.BufferForm=fnBufferForm;
		FieldBuffer.prototype.RestoreForm=fnRestoreForm;
		FieldBuffer.prototype.ClearFileFields=fnClearFileFields
		arrEls=new Array;		
		hshEls={};
		function fnBufferForm(oFrm) {
			oEls=oFrm.elements;
			for (i=0;i<oEls.length;i++) {
				arrEls[i]=new Element(oEls[i]);
			}
		}
		function fnRestoreForm(oFrm) {
			for (i=0;i<arrEls.length;i++) {
				oEl=arrEls[i];
				if (oEl.BufferThis)
					oEl.SetValue();
			}
		}
		function fnClearFileFields(oFrm) {
			this.BufferForm(oFrm);
			oFrm.reset();
			this.RestoreForm(oFrm);
		}
		function Element(oEl) {
			Element.prototype.SetValue=fnSetValue;
			this.Type=oEl.type;
			this.ObjRef=oEl;
			this.Required=false;
			this.CommonName='';
			switch(this.Type) {
				case 'select-one':
					this.Value=oEl.selectedIndex;
					this.BufferThis=true;
					break;
				case 'checkbox':
				case 'radio':
					this.Value=oEl.checked;
					this.BufferThis=true;
					break;
				case 'textarea':
				case 'text':
				case 'password':
				case 'hidden':
					this.Value=oEl.value;
					this.BufferThis=true;
					break;
				default:
					this.BufferThis=false;
			}
			function fnSetValue() {
				switch(this.Type) {
					case 'select-one':
						this.ObjRef.selectedIndex=this.Value;
						break;
					case 'checkbox':
					case 'radio':
						this.ObjRef.checked=this.Value;
						break;
					case 'textarea':
					case 'text':
					case 'password':
					case 'hidden':
						this.ObjRef.value=this.Value;
						break;
				}
			}
		}
	}
/*///////////////end/////////////////////*/		
/*///////////////function ตรวจสอบไฟล์/////////////////////*/	
var fileTypesTotal=["jpg","jpeg","gif","mpg","mpeg","wmv","mp3","wav","wma","bmp","doc","ppt","xls","zip","rar","swf","pdf"];

function checkfile(form,what){
  var source=what.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypesTotal.length; i++) if (fileTypesTotal[i]==ext) break;
  globalPic=new Image();
  if (i<fileTypesTotal.length) globalPic.src=source;

  else {
		alert("กรุณาเลือกรูปที่ท่านต้องการ หรือปล่อยว่างไว้\nไฟล์ที่สามารถใส่ได้คือ \n\n"+fileTypesTotal.join(", "));
		oBuffer.ClearFileFields(form);
		return false;
  }
}
/*///////////////end/////////////////////*/	