var ID
ID=""
var sH = new Number(147)
//----------------------------------------------------------------------------------------------
function CheckAll(obj)
{	var st
	document.all.SelAll.checked=!document.all.SelAll.checked;
	for (var i=0;i<document.frmName.elements.length;i++)
	{	var e=document.frmName.elements[i];
		if (e.id != 'SelAll')
		e.checked = document.all.SelAll.checked;
	}
	if(document.all.SelAll.checked)st="1px inset white";
	else st="1px outset white";
	obj.style.border=st;
}
//----------------------------------------------------------------------------------------------
function SetBorder(obj,on)
{	if(on)obj.style.border = "1px solid Silver";
	else obj.style.border = "1px solid white"
}
//----------------------------------------------------------------------------------------------
function ValidatePhong()
{
	if(frmName.TenPhong.value==""){
		alert(txtErrMsg.value);
		frmName.TenPhong.focus();	    
		return false;
	}
	return true;
}
//----------------------------------------------------------------------------------------------
function ValidateLyDo()
{
	if(frmName.TenLyDo.value==""){
	    alert(txtErrMsg.value);
	    frmName.TenLyDo.focus();	    
	    return false;
	}
    return true;
}
//----------------------------------------------------------------------------------------------
function ValidateGiaoVien()
{
	if(frmName.TenGiaoVien.value==""){
		document.all["strGiaoVien"].innerHTML = "Hãy nhập tên giáo viên !!!";
		frmName.TenGiaoVien.focus();
		return false;
	}
	return true;
}
//----------------------------------------------------------------------------------------------
function onMouse(obj){
	obj.style.border="1px solid #8C9EC4"
	obj.style.background="#F2F4F8"	
}

function outMouse(obj){
	obj.style.border="1px solid White"
	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 _onKeyPress(e, obj)
{
	var charCode=(navigator.appName=="Netscape")?e.which:e.keyCode
	status=charCode
    if(charCode==10)
    {
      	frmName.submit();
    } 	
}
//----------------------------------------------------------------------------------------------
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 CheckNULLMonHoc()
{    
	if(document.frmName.txtTenMH.value=="")
	{
		document.all["strMH"].innerHTML = "Hãy nhập tên môn học !!!"
		document.frmName.txtTenMH.focus()
		return false
	}		
	return true
}
//----------------------------------------------------------------------------------------------
function CheckNULLCoSo()
{    
    if(document.frmName.TenCS.value=="")
    {
        alert("Hãy nhập tên cơ sở !!!")
        document.frmName.TenCS.focus()
        return false
    }
    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 SetInput(obj){
	var old=document.all["Nhap" + Nhap.value]
	old.style.border="1px solid #c0c0c0"
	old.style.background=""
	old.style.color=""
	old.style.font="13px Arial;"
				
	obj.style.border="1px inset #c0c0c0"
	obj.style.background="#EEEFF0"
	obj.style.color="#0843BC"
	obj.style.font="bold 13px Arial;"
	Nhap.value = obj.value
}
//-------------------------------------------------------------------------------------------------------------------------------------------
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);
}