function chk(sender, args) 
{ 
	if(Form1.jobcatelog.length<=0) 
	{ 
		for(i=0;i<Form1.jobcatelog.length;i++)
		{
			if( !Form1.jobcatelog.options[i].selected )
			Form1.jobcatelog.options[i].selected= true;
		}
		args.IsValid = false; 
	}
	else
	{ 
		args.IsValid = true; 
	} 
} 

function SelectAll()
{

        for(i=0;i<Form1.jobcatelog.length;i++)
        {
            if( !Form1.jobcatelog.options[i].selected )
               Form1.jobcatelog.options[i].selected= true;
       }

}

//添加工作崗位
//mbox資料源的母集物件
//fbox資料源物件
//tbox目標物件
function move(mbox,fbox,tbox) {

	if(typeof(fbox.options[fbox.selectedIndex])=="unknown"){
        alert("系統提示:請選擇您想要添加的資料項!");
        fbox.focus();
		return;
    }
	
	if(tbox.length==3){
		alert("最多只能選擇3個工作崗位");
		return;
	}
//-----------------------確定選中是否為大類
	var isMainCatelog=false;
	var s=fbox.options[fbox.selectedIndex].value;
	var ss=s.substr(2,3);
	if(ss=="000"){
		isMainCatelog=true;
	}
//==
	var no = new Option();
	no.value = fbox.options[fbox.selectedIndex].value;
	no.text = fbox.options[fbox.selectedIndex].text;
	if(isMainCatelog)
	{
		no.text=mbox.options[mbox.selectedIndex].text;
	}
	
	if(tbox.length!=0)
	{
		for (var j=0; j<tbox.options.length; j++)//檢查是否有重複選項
		{
			if((tbox.options[j].value==no.value) && (tbox.options[j].text==no.text)){
			alert("您已經選擇該選項了，不能重選！");
			return;
			}
		}
	}
	
	tbox.add(new Option(no.text, no.value));
}
// End -->

//移除核取方塊中選中的選項函數
function multiSelect_removeitem(Object){
    
    if(typeof(Object.options[Object.selectedIndex])=="unknown"){
        alert("系統提示:請選擇您想要移除的資料項!");
        Object.focus();
    }
	
    if(Object.selectedIndex>-1){
        Object.remove(Object.selectedIndex);
    }
}
