// JScript source code

//跳出式視窗
function PopWin(File,WinWidth,WinHeight,scroll){
 if (WinHeight< 200) WinHeight=200;
 now=new Date();
num=(now.getSeconds())%10;
num=num+1;

 if(window.innerWidth){
	LeftPosition =(window.innerWidth-WinWidth)/2;
	TopPosition =((window.innerHeight-WinHeight)/4)-50;
			}
	else{
	LeftPosition =(parseInt(window.screen.width)-	WinWidth)/2;
	TopPosition=((parseInt(window.screen.height)-WinHeight)/2)-50;
			}
	attr = 'resizable=no,scrollbars='+scroll+',width=' + WinWidth + ',height=' +
	WinHeight + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
	TopPosition + '';
	window.open(File, 'nw'+num, attr);
	}

function PopWin3(File,WinWidth,WinHeight,scroll){
 if (WinHeight< 200) WinHeight=200;
 
 if(window.innerWidth){
	LeftPosition =(window.innerWidth-WinWidth)/2;
	TopPosition =((window.innerHeight-WinHeight)/4)-50;
			}
	else{
	LeftPosition =(parseInt(window.screen.width)-	WinWidth)/2;
	TopPosition=((parseInt(window.screen.height)-WinHeight)/2)-50;
			}
	attr = 'resizable=no,scrollbars='+scroll+',width=' + WinWidth + ',height=' +
	WinHeight + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
	TopPosition + '';
	popWin1=open(File, 'new_window', attr);
	}
	
function PopWin2(File,WinWidth,WinHeight,scroll) {
rsult=window.showModalDialog(File, '','resizable: no; help: no; status: no; scroll: yes;dialogHeight: '+WinHeight+'px; dialogWidth: '+WinWidth+'px;');	
//if (rsult==true) window.location.reload();
}	


function showdiv(obj,item){
		//判斷CheckBox是否被勾選 若是則顯示區塊 反之則隱藏
		document.getElementById(item).style.display = obj.checked?"block":"none";
}

function showtbldiv(num) {
for (i=1;i<=num;i++) 
document.getElementById('tbldiv'+i).style.display ="block";	

for (j=i;j<=10;j++)
document.getElementById('tbldiv'+j).style.display ="none";	
}

function showdiv2(item){
		//判斷CheckBox是否被勾選 若是則顯示區塊 反之則隱藏
		document.getElementById(item).style.display = (document.getElementById(item).style.display=="block") ? "none":"block";
}




function ChkNUM(NUM) 
{ 
var i,j,strTemp; 
strTemp="0123456789"; 
if ( NUM.length== 0) 
return 0 
for (i=0;i<NUM.length;i++) 
{ 
j=strTemp.indexOf(NUM.charAt(i)); 
if (j==-1) 
{ 
//說明有字符不是數字 
return 0; 
} 
} 
//說明是數字 

if (parseInt(NUM)>=0) 
 {
 return 1
 }
else
{  
return 0
} 
}

//全選CheckBox
function CheckAll(obj,field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = obj.checked ;
}

//全不選CheckBox
function UnCheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}


function CheckForm(obj,FieldAry){
for (i=0;i<FieldAry.length;i++) {
if (obj(FieldAry[i]).value==''){
				alert(' * 欄位不能空白');
				obj(FieldAry[i]).focus();
				return false;
  }
 }
return true;
} 

function ObjBgColor(Obj,Colors) 
         {
         Obj.style.backgroundColor=Colors;
         }
         
function SltCheck(obj,FieldAry){
for (i=0;i<FieldAry.length;i++) {
if (obj(FieldAry[i]).checked==true){
		return true
  }
 }
alert('至少需選擇一種查詢條件！');
return false;
} 
