function view_image(image_path,wimg,himg){
	var w1,h1;w1 = 720;h1 = 480;
	w = parseInt(wimg);h = parseInt(himg);
	if(w<720){w1 = w;}
	if(h<480){h1 = h;}
	h1+=30;
	w1+=30;
	var strTop = parseInt((screen.height - h1)/2)-30;
	var strLeft = parseInt((screen.width - w1)/2);
	if((w>720)||(h>480)){
		args="width="+w1+"px,height="+h1+"px,top="+strTop+"px,left="+strLeft+"px,resizable=0,scrollbars=1,status=0";	
	}
	else{
		args="width="+w1+"px,height="+h1+"px,top="+strTop+"px,left="+strLeft+"px,resizable=0,scrollbars=0,status=0";
	}
	url = "/view_image.html?path=" + image_path + "&height=" + himg + "&width=" +wimg;	
	window.open(url,"test",args);
	//window.event.returnValue=false;
}

function callmembers(){	
	var user  		= document.all["txtusernamemember"].value;
	if((user=="")||(user.length<6)||(user.indexOf(" ")>0)){
		alert(" Tai khoan khong chua ky tu trang. \n Tai khoan phai lon hon 6 ky tu");
		if(confirm("Ban co muon dang ky thanh vien nua khong?")){
			document.all["txtusernamemember"].disabled 	= false;
			document.all["txtpasswordmember"].disabled 	= false;
			document.all["txtemailmember"].disabled 	= false;
			document.all["txtconfirmmember"].disabled 	= false;
			document.all["chkdisabled"].checked 		= true;
			document.all["txtusernamemember"].focus();
			document.all["txtusernamemember"].style.backgroundColor = "#FFFFFF";
			document.all["txtpasswordmember"].style.backgroundColor = "#FFFFFF";
			document.all["txtemailmember"].style.backgroundColor 	= "#FFFFFF";
			document.all["txtconfirmmember"].style.backgroundColor 	= "#FFFFFF";
		}
		else{
			document.all["txtusernamemember"].disabled 	= true;
			document.all["txtpasswordmember"].disabled 	= true;
			document.all["txtemailmember"].disabled 	= true;
			document.all["txtconfirmmember"].disabled 	= true;
			document.all["chkdisabled"].checked 		= false;
			document.all["txtusernamemember"].style.backgroundColor = "#D4D0C8";
			document.all["txtpasswordmember"].style.backgroundColor = "#D4D0C8";
			document.all["txtemailmember"].style.backgroundColor 	= "#D4D0C8";
			document.all["txtconfirmmember"].style.backgroundColor 	= "#D4D0C8";
		}
		return false;
	}
	else{
		xmlhttp=false;
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) {
						try {
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (E) {
								xmlhttp = false;
							}
		}
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		
		rand = new Date().getTime()+new Date().getMilliseconds();
		user = escape(user.replace(/^\s*|\s*$/g,""));

		url='php/bolmembers.php?user='+user+'&'+rand;
		xmlhttp.open("GET", url,true); 
		
		if(navigator.appName!='Microsoft Internet Explorer'){//FIRE FOX
			xmlhttp.onreadystatechange = function (){
				if (xmlhttp.readyState==4){
					if(xmlhttp.responseText.indexOf('OK')!=-1){
						alert(" Tai khoan da ton tai. \n Xin ban nhap lai tai khoan khac");
						if(confirm("Ban co muon dang ky thanh vien nua khong?")){
							document.all["txtusernamemember"].disabled 	= false;
							document.all["txtpasswordmember"].disabled 	= false;
							document.all["txtemailmember"].disabled 	= false;
							document.all["txtconfirmmember"].disabled 	= false;
							document.all["chkdisabled"].checked 		= false;
							document.all["txtusernamemember"].focus();
							document.all["txtusernamemember"].style.backgroundColor = "#FFFFFF";
							document.all["txtpasswordmember"].style.backgroundColor = "#FFFFFF";
							document.all["txtemailmember"].style.backgroundColor 	= "#FFFFFF";
							document.all["txtconfirmmember"].style.backgroundColor 	= "#FFFFFF";
						}
						else{
							document.all["txtusernamemember"].disabled 	= true;
							document.all["txtpasswordmember"].disabled 	= true;
							document.all["txtemailmember"].disabled 	= true;
							document.all["txtconfirmmember"].disabled 	= true;
							document.all["chkdisabled"].checked 		= true;
							document.all["txtusernamemember"].style.backgroundColor = "#D4D0C8";
							document.all["txtpasswordmember"].style.backgroundColor = "#D4D0C8";
							document.all["txtemailmember"].style.backgroundColor 	= "#D4D0C8";
							document.all["txtconfirmmember"].style.backgroundColor 	= "#D4D0C8";
						}
						return false;
					}
				}
			}
		}
		else{//IE
				xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				xmlhttp.onreadystatechange = function (){
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
						if(xmlhttp.responseText.indexOf('OK')!=-1){
							alert(" Tai khoan da ton tai. \n Xin ban nhap lai tai khoan khac");
							if(confirm("Ban co muon dang ky thanh vien nua khong?")){
								document.all["txtusernamemember"].disabled 	= false;
								document.all["txtpasswordmember"].disabled 	= false;
								document.all["txtemailmember"].disabled 	= false;
								document.all["txtconfirmmember"].disabled 	= false;
								document.all["chkdisabled"].checked 		= false;
								document.all["txtusernamemember"].focus();
								document.all["txtusernamemember"].style.backgroundColor = "#FFFFFF";
								document.all["txtpasswordmember"].style.backgroundColor = "#FFFFFF";
								document.all["txtemailmember"].style.backgroundColor 	= "#FFFFFF";
								document.all["txtconfirmmember"].style.backgroundColor 	= "#FFFFFF";
							}
							else{
								document.all["txtusernamemember"].disabled 	= true;
								document.all["txtpasswordmember"].disabled 	= true;
								document.all["txtemailmember"].disabled 	= true;
								document.all["txtconfirmmember"].disabled 	= true;
								document.all["chkdisabled"].checked 		= true;
								document.all["txtusernamemember"].style.backgroundColor = "#D4D0C8";
								document.all["txtpasswordmember"].style.backgroundColor = "#D4D0C8";
								document.all["txtemailmember"].style.backgroundColor 	= "#D4D0C8";
								document.all["txtconfirmmember"].style.backgroundColor 	= "#D4D0C8";
							}
							return false;
						}
					}
				}
		}
		xmlhttp.send(null);
	}
}


function calldisabled(frm){
	with(frm){
		chkdisabled.value = (chkdisabled.checked)?"1":"0";
		if(!chkdisabled.checked){
			txtpasswordmember.style.backgroundColor = "#D4D0C8";
			txtusernamemember.style.backgroundColor = "#D4D0C8";
			txtemailmember.style.backgroundColor 	= "#D4D0C8";
			txtconfirmmember.style.backgroundColor 	= "#D4D0C8";
			txtpasswordmember.disabled 	= true;
			txtusernamemember.disabled 	= true;
			txtemailmember.disabled 	= true;
			txtconfirmmember.disabled  	= true;
		}
		else{
			txtpasswordmember.style.backgroundColor = "#ffffff";
			txtusernamemember.style.backgroundColor = "#ffffff";
			txtemailmember.style.backgroundColor 	= "#ffffff";
			txtconfirmmember.style.backgroundColor 	= "#ffffff";
			txtpasswordmember.disabled 	= false;
			txtusernamemember.disabled 	= false;
			txtemailmember.disabled 	= false;
			txtconfirmmember.disabled  	= false;
		}
	}
}

function oncontact(city, id_t, type_i)
{
	with(document.frmcontact)	
	{
		hdcityid.value	= city;
		hdid.value		= id_t;
		hdtype.value 	= type_i;
		submit();
	}
}