// JavaScript Document
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

function countImgs(maxWidth)
{
var img = document.images;

for (var i = 0; i < img.length; i++) {

if (img[i].width > maxWidth){
img[i].height = maxWidth*img[i].height/img[i].width;
img[i].width = maxWidth;
}
}
}
function delete_confirm(theURL) {
	if (confirm("B?n có th?c s? mu?n xóa không?")) {
	window.location.href=theURL;
	}				   
}   
function hide(elemID){	
	var obj
	if (document.all) {
		obj = document.all(elemID);
	} else if (document.getElementById) {
		obj = document.getElementById(elemID)
	} else if (document.layers) {
		obj = document.layers[elemID];
	}	
	if(obj.style.display==""){
		obj.style.display="none";
	}  
}
function reSizeImage(elemID) {
	var obj 
	if (document.all) {
		obj = document.all(elemID)
	} else if (document.getElementById) {
		obj = document.getElementById(elemID)
	} else if (document.layers) {
		obj = document.layers[elemID];
	}	
	var standHeight = 200*(obj.height/obj.width);
	var str= " width=\"200\" height=\"" + standHeight + "\" " ;
	return str;
}
function display(elemID){	
	var obj
	if (document.all) {
		obj = document.all(elemID)
	} else if (document.getElementById) {
		obj = document.getElementById(elemID)
	} else if (document.layers) {
		obj = document.layers[elemID]
	}	
	if(obj.style.display=="none"){
		obj.style.display="";
	}  
}
function changeDisplay(elemID){	
	var obj
	if (document.all) {
		obj = document.all(elemID)
	} else if (document.getElementById) {
		obj = document.getElementById(elemID)
	} else if (document.layers) {
		obj = document.layers[elemID]
	}	
	if(obj.style.display==""){
		obj.style.display="none";
	}  
	else{
		obj.style.display="";
    }
}
function popUp(theUrl, height, width, scroll){
	var t = screen.Height/2 - height/2;
	var l = screen.Width/2 - width/2;
	var h = height;
	var w = width;
	window.open(theUrl,"hell","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable=no,width="+w+",height="+h+",top="+t+",left="+l);
}
var last_image = new Image;
function changeAvatar(image){	
	last_image.border = 0;
	image.border = 1;	
	last_image = image;
	document.member.avatar.value = image.src;		
}