var ID
ID=""
var sH = new Number(147)
//----------------------------------------------------------------------------------------------
function CheckAll(obj)
{	var st
	for (var i=0;i<document.frmName.elements.length;i++)
	{	var e=document.frmName.elements[i];	
		if(Right(e.id, String(e.id).length-2) == obj.id)
			if (e.checked == true) e.checked=false
			else e.checked = true
	}
}
//----------------------------------------------------------------------------------------------
function SetBorder(obj,on)
{	if(on)obj.style.border = "1px solid Silver";
	else obj.style.border = "1px solid white"
}
//----------------------------------------------------------------------------------------------
function onMouse(obj){
	obj.style.background="#F2F4F8"		
}

function outMouse(obj){
	obj.style.background="white"	
}
//----------------------------------------------------------------------------------------------
function CheckKyTu(e, obj)
{
	var charCode=(navigator.appName=="Netscape")?e.which:e.keyCode
	status=charCode
      	if(charCode>31&&(charCode<48||charCode>57))
        {
        	alert("Chỉ được phép nhập số");
		    obj.focus();	      
        	return false;
        } 	
	return true;
}
//----------------------------------------------------------------------------------------------
function CheckSpecialChar(e, obj)
{
	var charCode=(navigator.appName=="Netscape")?e.which:e.keyCode
	status=charCode
    if(charCode>=33&&charCode<=39)
    {
		document.all["strErr"].innerHTML = "<font color=red>Không nên dùng ký tự đặc biệt</font>"
		obj.focus();	      
        return false;
    } 	
    else{document.all["strErr"].innerHTML = ""
		return true
    }
	return true;
}
//----------------------------------------------------------------------------------------------
function Left(str, n)
{
    if (n <= 0)
        return "";
    else if (n > String(str).length)
        return str;
    else
        return String(str).substring(0,n);
}
//----------------------------------------------------------------------------------------------
function Right(str, n)
{
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else 
    {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
//---------------------------------------------------------------------------------------------
function Mid(str, start, len)
{
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}
//---------------------------------------------------------------------------------------------
function Disable_F5(){
    if (document.all)
    {  
        document.onkeydown = function ()
        {  
            var key_f5 = 116; // 116 = F5  
            if (key_f5==event.keyCode)
            {  
                event.keyCode = 27;  
                return false;  
            }  
        }  
    } 
}
//---------------------------------------------------------------------------------------------
function Disable_Right_Mouse_Click()
{
    var oLastBtn=0;
    bIsMenu = false;    
    if (window.Event)
    document.captureEvents(Event.MOUSEUP);
    function nocontextmenu()
    {
        event.cancelBubble = true
        event.returnValue = false;
        return false;
    }
    function norightclick(e)
    {
        if (window.Event)
        {
            if (e.which !=1)
            return false;
        }
        else
        if (event.button !=1)
        {
            event.cancelBubble = true
            event.returnValue = false;
            return false;
        }
    }
    document.oncontextmenu = nocontextmenu;
    document.onmousedown = norightclick;
    function onKeyDown() 
    {
        if ((event.altKey) || ((event.keyCode == 8) ||((event.ctrlKey) && ((event.keyCode == 78) || (event.keyCode == 82))) ||(event.keyCode == 116)||(event.keyCode == 122)))
        {
            event.keyCode = 0;
            event.returnValue = false;
        }
    }
}
//-------------------------------------------------------------------------------------------------------------------------------------------
function HotKey(){
	var HotkeyLcase=115;
	var HotkeyUcase=115;
	var destination="../Exec/Login.aspx";
	if (document.layers) document.captureEvents(Event.KEYPRESS);
	function backhome(e){
		if (document.layers){
			if ((e.which==HotkeyLcase) || (e.which==HotkeyUcase)) window.location=destination;
		}
		else if (document.all){
			if ((event.keyCode==HotkeyLcase) || (event.keyCode==HotkeyUcase))
			window.location=destination;
		}
	}
	document.onkeypress=backhome;
}
//-------------------------------------------------------------------------------------------------------------------------------------------
function tS(){ x=new Date(); x.setTime(x.getTime()); return x; }
function lZ(x){ return (x>9)?x:'0'+x; }
function tH(x){ if(x==0){ x=12; } return (x>12)?x-=12:x; }
function y2(x){ x=(x<500)?x+1900:x; return String(x).substring(0,4) }
function dT(){ if(fr==0){ fr=1; document.write('<span id="tP">'+eval(oT)+'</span>'); } tP.innerText=eval(oT); setTimeout('dT()',1000); }
function aP(x){ return (x>11)?'PM':'AM'; }
var dN=new Array('Chủ nhật','Thứ hai','Thứ ba','Thứ tư','Thứ năm','Thứ sáu','Thứ bảy'),mN=new Array('1','2','3','4','5','6','7','8','9','10','11','12'),fr=0,oT="tH(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '+aP(tS().getHours())+' |'+' '+dN[tS().getDay()]+', ngày '+tS().getDate()+'-'+mN[tS().getMonth()]+'-'+y2(tS().getYear())+' '";
//-------------------------------------------------------------------------------------------------------------------------------------------
function DisplayDate()
{
	var m_names = new Array("Tháng 1", "Thán 2", "Tháng 3", 
	"Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", 
	"Tháng 10", "Tháng 11", "Tháng 12");

	var d = new Date();
	var curr_date = d.getDate();
	var sup = "";
	if (curr_date == 1 || curr_date == 21 || curr_date ==31){
		sup = "st";
	}
	else if (curr_date == 2 || curr_date == 22)	{
		sup = "nd";
	}
	else if (curr_date == 3 || curr_date == 23)	{
		sup = "rd";
	}
	else{
		sup = "th";
	}

	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();

	document.write("Ngày " + curr_date + " " + m_names[curr_month] + " năm " + curr_year);
}