	function ChuanXauNoiDung(str){
		strChuan = str;
		strChuan = ThayThe(strChuan,"&nbsp;");
		strChuan = ThayThe(strChuan," ");
		if(strChuan=="") strChuan="<p></p>";
		return strChuan;
	}
	function Sorry(){
		alert("Chuc nang nay chua cai dat. Xin ban quay lai sau.");
	}
	function CancelBubble(){
		if(document.all) window.event.cancelBubble = true;
	}
	function Trim(s){
	  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')){
	    s = s.substring(1,s.length);
	  }
	  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')){
	    s = s.substring(0,s.length-1);
	  }
	  return s;
	}
	function ThayThe(str,KyTu){
		while (str.indexOf(KyTu)>=0){
			str = str.replace(KyTu,"");	
		} 
		return str;
	}
	function ChuanXau(str){
		strChuan=str;
		strChuan=ThayThe(strChuan,"~");
		strChuan=ThayThe(strChuan,"%");
		strChuan=ThayThe(strChuan,"@");
		strChuan=ThayThe(strChuan,"#");
		strChuan=ThayThe(strChuan,"$");
		strChuan=ThayThe(strChuan,"^");
		strChuan=ThayThe(strChuan,"&");
		strChuan=ThayThe(strChuan,"*");
		strChuan=ThayThe(strChuan,"'");
		strChuan=Trim(strChuan);		
		return strChuan;
		
	}
	function ChuanXau_Email(str){
		strChuan = str;
		if(strChuan.indexOf("~")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("%")>=0){
			strChuan="";
		}
		
		if(strChuan.indexOf("#")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("$")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("^")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("&")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("*")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("'")>=0){
			strChuan="";
		}
		if(strChuan.indexOf("!")>=0){
			strChuan="";
		}
		
		return strChuan;
	}
	
	function CheckFileImg(FileName){
			alert(FileName);
		var dotpos;
		FileName = FileName.substring(FileName.lastIndexOf("\\")+1,FileName.length);
		dotpos = FileName.lastIndexOf('.');
		ext = FileName.substr(dotpos+1,FileName.length-dotpos);
		ext = ext.toLowerCase();	
		alert(ext);
		if (ext != ""){
			if (ext != "gif" && ext != "jpg" && ext != "bmp") {
				return false;					
			}else{
				return true;
			}
		}else{
			return true;
		}
		
	}
	function CompDate(strDate1,strDate2){
		var m1, d1, y1;
		var m2, d2, y2;
		var s, pos1, pos2;
		var s = strDate1, s1 = strDate2;
		if (s.length == 0 || s1.length == 0) return true;

		pos1 = s.indexOf("/",0);
		pos2 = s.indexOf("/",pos1+1);
		d1 = parseInt(s.substr(0,pos1),10);
		m1 = parseInt(s.substr(pos1+1,pos2-pos1-1),10);
		y1 = parseInt(s.substr(pos2+1,s.length-pos2),10);
		
		pos1 = s1.indexOf("/",0);
		pos2 = s1.indexOf("/",pos1+1);
		d2 = parseInt(s1.substr(0,pos1),10);
		m2 = parseInt(s1.substr(pos1+1,pos2-pos1-1),10);
		y2 = parseInt(s1.substr(pos2+1,s1.length-pos2),10);
		
		var d1 = new Date(y1,m1,d1);
		var d2 = new Date(y2,m2,d2);
		if (d1 >= d2) 
			return true;
		else
			return false;
	}
	function CompDateE(strDate1,strDate2){
		var m1, d1, y1;
		var m2, d2, y2;
		var s, pos1, pos2;
		var s = strDate1, s1 = strDate2;
		if (s.length == 0 || s1.length == 0) return true;

		pos1 = s.indexOf("/",0);
		pos2 = s.indexOf("/",pos1+1);
		d1 = parseInt(s.substr(0,pos1),10);
		m1 = parseInt(s.substr(pos1+1,pos2-pos1-1),10);
		y1 = parseInt(s.substr(pos2+1,s.length-pos2),10);
		
		pos1 = s1.indexOf("/",0);
		pos2 = s1.indexOf("/",pos1+1);
		d2 = parseInt(s1.substr(0,pos1),10);
		m2 = parseInt(s1.substr(pos1+1,pos2-pos1-1),10);
		y2 = parseInt(s1.substr(pos2+1,s1.length-pos2),10);
		
		var d1 = new Date(y1,m1,d1);
		var d2 = new Date(y2,m2,d2);
		if (d1 == d2) 
			return true;
		else
			return false;
	}	
	
	function ViewNote(url){
		args = "width=600px,height=400px,top=0px,left=0px,resizable=0,status=0,scrollbars=";		
		window.open(url,"ViewNote",args);
	}
	
	function ViewImg(strCommon,Path,wimg,himg){
		var w1,h1;
		w1 = 750;
		h1 = 480;
		w = parseInt(wimg);
		h = parseInt(himg);
		if (w <= 750){
			w1 = w;
		}
		if (h <= 480){
			h1 = h;
		}
		w1 += 58;
		h1 += 48;
		var strTop = parseInt((screen.height - h1)/2)-20;
		var strLeft = parseInt((screen.width - w1)/2);
		args = "width=" + w1 + "px,height=" + h1 + "px,top=" + strTop + "px,left=" + strLeft + "px,resizable=0,status=0,scrollbars=";
		if ((wimg>=750)||(himg>=480)){
			args += "1";
		}else{
			args += "0";
		}
		url = strCommon+"ViewImg.asp?Path=" + Path + "&Height=" + himg + "&Width=" +wimg;		
		window.open(url,"ViewImages",args);
		window.event.returnValue = false;
	}
	function ViewImgDetail(Path,wimg,himg,strMa){
		var w1,h1
		w1 = 650;
		h1 = 500;
		w = parseInt(wimg);
		h = parseInt(himg);
		if (w <= 630) w1 = w;
		if (h <= 580) h1 = h;
		w1 += 48;
		h1 += 30;
		var strTop = parseInt((screen.height - h1)/2)-20;
		var strLeft = parseInt((screen.width - w1)/2);
		args = "width=" + w1 + "px,height=" + h1 + "px,top=" + strTop + "px,left=" + strLeft + "px,resizable=no,scrollbars=yes,status=0";
		url = "ViewImage.asp?Path=" + Path + "&Height=" + himg + "&Width=" + wimg + "&Ma=" + strMa;
		window.open(url,"test",args);
	}
	
	function CheckAll(){
		chk = document.getElementById("chkAllBox");
		frm = document.getElementById("frmExe");
		Num = (frm.elements.length-1);
		for (i=0;i<=Num;i++){
			if (frm.elements[i].name=="chkBox"){
				frm.elements[i].checked = chk.checked;
			}
		}
	}
	
	
	function ChkExe(flag){
		hid = document.getElementById("hidDk");
		frm = document.getElementById("frmExe");	
		chk = frm.getElementsByTagName("input");
		strMsg = "";
		vExe = 0;				
		num = frm.elements.length;
		for (i=1;i<=(num-1);i++){
			allchk = frm.elements[i];					
			if (allchk.type=="checkbox"){
				if (allchk.checked){
					vExe = 1;
					break;
				}
			}
		}
		if (vExe==0){
			strMsg += "\n- Xin danh dau chon truoc khi xu ly !";
		}
		if (strMsg==""){
			if (flag==1){
				if (confirm("Ban co muon duyet hay khong ?")){
					hid.value = "UNPASS";
					return true;
				}else{
					return false;
				}
			}else{
				if (confirm("Ban co muon xoa hay khong ?")){
					hid.value = "DEL";
					return true;
				}else{
					return false;
				}
			}
		}else{
			strMsg = strMsg.substr(1);
			alert(strMsg);
			return false;
		}
	}
	
	function CheckFileImg(FileName){
		var dotpos;
		FileName = FileName.substring(FileName.lastIndexOf("\\")+1,FileName.length);
		dotpos = FileName.lastIndexOf('.');
		ext = FileName.substr(dotpos+1,FileName.length-dotpos);
		ext = ext.toLowerCase();	
		if (ext != ""){
			if (ext != "gif" && ext != "jpg" && ext != "bmp"){
				return false;					
			}else{
				return true;
			}
		}else{
			return true;
		}
	}
	
	function __doDuyet(){
		document.frmExe.submit();
	}
	
	function __doDel(){
		document.frmExe.submit();
	}
	
	function funDelImage(){
		frm = document.getElementById("frmNew");
		if (frm.chkDelImage.checked) {
			if(confirm("Ban muon xoa anh nay phai khong?")){
				frm.chkDelImage.value = "1";
				frm.submit();
			}
		}
	}
	
	function Tab_HuyClick(){
		window.event.returnValue = false;
	}
	
	function callAjax(strPath){
		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(); //FF
			xmlhttp.overrideMimeType('text/xml');
		}
		
		rand 	= new Date().getTime()+new Date().getMilliseconds();
		url		= strPath+'&'+rand;
		try{
			xmlhttp.open("GET", url,false); 
	
			xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			xmlhttp.send();
			
			document.all["div_main_content"].innerHTML = xmlhttp.responseText;
			height();
		}
		catch(E){
			alert('Khong ho tro FF nay');
		}
		
	}