﻿
function KhaoSat()
{
    var kq=false;
    var i;
    for(i=1;i<=5;i++)
        if(document.getElementById('chk' + i).checked==true)
        {
            kq=true;
            openWin('frmXacNhanKhaoSat.aspx')
            
        }
    if(kq==false)
        alert('Hãy chọn một trong các mục trước khi biểu quyết');
}

function printit()
{
    if (!window.print){
	    alert("You need NS4.x or IE5 to use this print button!")
	    return;
    }
    window.print()
}

function onLoad(id1,value1)
{ 
    document.getElementById(id1).value=value1;
}

//Ham Load ngay
function LoadDay(MaxDate)
{
  var Chuoi="<select id='Day' name='Day' onchange='TestMonthDay()'>";
  Chuoi+="<option value='-1'>-Ngày-</option>";
  for(var i=1;i<MaxDate;i++)
  {
   var item="<option value='" + i + "' id='Day" + i + "'>" + i + "</option>";
   Chuoi+=item;
  }
  Chuoi+="</select>";
  document.getElementById('idDay').innerHTML=Chuoi;
}

//Ham kiem tra ngay thang duoc chon co hop le khong 
function TestMonthDay()
{
    var D=document.getElementById('Day').value;
    var Month=document.getElementById('Month');
    var M= Month[Month.selectedIndex].value;
    var Y=parseInt(document.getElementById('Year').value);
    if(M!=-1 && D!=-1)
    {
       if(isDate(Y,M,D)==true)
            document.getElementById('KTNgayThang').innerHTML=''
        else
        {
            document.getElementById('KTNgayThang').innerHTML='Ngày,tháng sai!';
            document.getElementById('KTNgayThang').style.color="#FF0000";
        }
    }
}
//Xu ly tien luong
function changesalary(val)
{
    
    var text="";
    if(val==0)
    {
	    text +="&nbsp;<select name='salary'  style='font-family:Verdana;font-size:11.5px;width:130px'>";
	    text +="<option value='1~2'>1 - 2 triệu</option>";
	    text +="<option value='2~3'>2 - 3 triệu</option>";
	    text +="<option value='3~4'>3 - 4 triệu</option>";
	    text +="<option value='4~5'>4 - 5 triệu</option>";
	    text +="<option value='5~8'>5 - 8 triệu</option>";
	    text +="<option value='8~-1'>Trên 8 triệu</option>";
	    text +="<option value='-1~-1'>Thỏa thuận</option>";
	    text +="</select>";
    }
    else if(val==1)
    {
	    text +="<select name='salary' style='font-family:Verdana;font-size:11.5px;width:130px'>";
	    text +="<option value='100~150'>100 - 150 USD</option>";
	    text +="<option value='150~200'>150 - 200 USD</option>";
	    text +="<option value='200~250'>200 - 250 USD</option>";
	    text +="<option value='250~300'>250 - 300 USD</option>";
	    text +="<option value='300~500'>300 - 500 USD</option>";
	    text +="<option value='500~-1'>trên 500 USD</option>";
	    text +="<option value='-1~-1'>Thỏa thuận</option>";
	    text +="</select>";
    }
    SaveCookie("MucLuongTien",val);
    document.getElementById('expectsalary').innerHTML=text;
}


//xu ly check
function DoiMau(id)
{
    var  idTrangChon=getCookie("idTrangChon");
    idTrangChon="idTrang"+id;
    document.getElementById(idTrangChon).style.color="#000000";
    SaveCookie('idTrangChon',idTrangChon);//Luu Gia Tri Trang Chon
}
function CheckAll(chkid,cookiename)
{
   
   var arr=new Array();
   var chkid;
   arr=strcode.split('~');
   if(arr.length>0)
   {
       
       if(document.getElementById(chkid).checked==true)
       {
            
            for(var i=0;i<arr.length;i++)
            {
                chkid='chk'+arr[i];
                document.getElementById(chkid).checked=true;
            }
                
       }
       else
       {
            for(var i=0;i<arr.length;i++)
            {
                chkid='chk'+arr[i];
                document.getElementById(chkid).checked=false;
            }
       }
     }
     
}


function openWin(href) 
{ 
    window.open(href,"mywindow","location=1,status=1,scrollbars=0,width=618,height=270"); 
} 
function openWin1(href) 
{ 
    window.open(href,"mywindow","location=1,status=1,scrollbars=0,width=700,height=350"); 
} 
function openWinInfoDetail(href) 
{ 

    var myWindow=window.open(href,"mywindow","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes,location=1,width=700,height=400"); 
    if(href!='')
        myWindow.focus();
} 

function doimautable(id,trangthai,mau)
{
    if(trangthai=='1')
        document.getElementById(id).style.backgroundColor="#FFFCE7"
    else
        document.getElementById(id).style.backgroundColor=mau;
}
function changcolorlink(id,state,defaulcolor,changcolor)
{
    if(state=='1')
        document.getElementById(id).style.color=changcolor;
    else
        document.getElementById(id).style.color=defaulcolor;
}

function SendNews()
{
    var CapThuMuc="";
    ///var CapThuMuc="../../../../";
    window.open(CapThuMuc+'frmSendNews.aspx?SendJob=1',"mywindow","location=1,status=1,scrollbars=1,width=525,height=400"); 
}

function LoadDMTinh(id,width)
{
    loadXML("DanhMucTinh.xml");
    var chuoi = "<select style='font-family:Verdana;font-size:11.5px;height:20px;width:" + width + "px' id='" + id + "' name='" + id + "'>";
    var root=xmlDoc.documentElement;
    var length=root.childNodes.length;
    for(var i=0;i<length;i++)
    {
        var id=root.childNodes(i).getAttribute("Id");
        var tengoi=root.childNodes(i).getAttribute("TenGoi");
        chuoi = chuoi + "<option value='" + id+ "'>" + tengoi + "</option>";
    }
    chuoi=chuoi+"</select>";
    document.writeln(chuoi);
    
}
function LoadNghanhNghe(id,width)
{
    loadXML("DanhSachViecLamTheoNghanh.xml");
    var chuoi = "<select style='font-family:Verdana;font-size:11.5px;height:20px;width:" + width + "px' id='" + id + "' name='" + id + "'>";
   
     var root=xmlDoc.documentElement;
     var lenght=root.childNodes.length;
        for (var i = 0; i < lenght;)
        {
            var MaNghanh=root.childNodes(i).getAttribute("MaNghanh");
            var TenGoi=root.childNodes(i).getAttribute("TenNghanh");
           chuoi = chuoi + "<option value='" + id+ "'>" + tengoi + "</option>";
    }
    chuoi=chuoi+"</select>";
    document.writeln(chuoi);
}
/*********************************************************************/




 function Reset()//Set lai form LienHe
{
    document.getElementById("cmdReset").src="images/ bt_lamlai_press.jpg";
    document.getElementById("txtEmail").value="";
    document.getElementById("txtHoTen").value="";
    document.getElementById("txtTieuDe").value="";
    document.getElementById("txtDienThoai").value="";
    document.getElementById("txtNoidung").value="";
    document.getElementById("cmdReset").src="images/bt_lamlai.jpg";
}












