 /*function checkme(Key) {
	 if(Key==0){
		 alert("Key = 0!")
		}else if(Key==1){
		 alert("Key = 1!")
	}
 }*/

function newSize(datoY) {
	if(document.all && !document.getElementById) {
 		
 		document.all['MenuB'].style.pixelHeight = datoY+20;
	}else{
		document.getElementById('MenuB').style.height = datoY+20;
	}
}

function ChkDel(f,r,d) {
	if (confirm("Do you really want to delete this request !?"))	{
		f.run.value=r;
		f.del.value=d;
	}else{return false;}
}
function ChkAll(f) {
	if (noKeyIn(f.requestby, "Please input the Request Name !!")){return false;}
	/*
	if (noKeyIn(f.com_name, "Please fill the column == Company Name == !!")){return false;}
	if (noKeyIn(f.address, "Please fill the column == Address == !!")){return false;}
	if (noKeyIn(f.phone, "Please fill the column == Telephone == !!")){return false;}
	if (noKeyIn(f.contact, "Please fill the column == Contact == !!")){return false;}
	*/
	/*check Email*/
	if (chkEmail(f.email,'')){return false;}
	/*
	if (noKeyIn(f.product, "Please fill the column == Product Description == !!")){return false;}
	var cn=0;
	var fs=f.elements['productType[]'];
	for(i=0;i<fs.length;i++){if(fs[i].checked==true){cn++;}}
	if(cn==0){alert('Please select == Product Type == !!');return false;}
	var cn=0;
	var fs=f.elements['competitions[]'];
	for(i=0;i<fs.length;i++){if(fs[i].checked==true){cn++;}}
	if(cn==0){alert('Please select == Competition == !!');return false;}
	*/
	if (noKeyIn(f.capt, "Please input the Auth Code !!")){return false;}
}
function chkRMIF(f) {
	if (noKeyIn(f.requestby, "Please input the Request Name !!")){return false;}
	if (chkEmail(f.email,'')){return false;}
	if (noKeyIn(f.capt, "Please input the Auth Code !!")){return false;}
}
function trim(i){return i.replace(/^[\s]*$/gi,"");}
function noKeyIn(i, ErrorMsg){
	if (trim(i.value)==""){
		i.value="";
     	i.focus();
     	alert(ErrorMsg);
     	return true;
    }
	return false;
}
function chkEmail(i, ErrorMsg){
	if (noKeyIn(i, ErrorMsg+"Please input the Email !!")){return true;}
	else if(!CheckEmail(i)){i.focus();i.value='';alert(ErrorMsg+"Email format error, please check !!");return true;}
	else{return false;}
}
function chkNum(i, ErrorMsg){
	if (isNaN(i.value)){
     	i.focus();
     	alert(ErrorMsg);
     	return true;
    }
	return false;
}
function chkNumber(f,w){
	if(isNaN(w)){
		f.focus();
		alert("此欄位必須輸入數字");
		f.value='';
		return false;
 	}
 	if(w<0){
		f.focus();
		alert("此欄位必須大於0");
		f.value='';
		return false;
 	}
}
function chkChinese(f,w){
	if(is_big5(w)>0){
		f.focus();
		alert("此欄位必須輸入中文");
		f.value='';
		return false;
 	}
}
function chkNotChinese(f,w){
	if(is_big5(w)==0){
		f.focus();
		alert("此欄位不能輸入中文");
		return false;
 	}
}
function chkEnglish(f,w){
	if(is_big5(w)!=1){
		f.focus();
		alert("此欄位必須輸入英文");
		f.value='';
		return false;
 	}
}
function CheckEmail(f){
	var email = f.value;
	var rege = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
	if (email.length == 0 || rege.exec(email) == null){return false;}
	return true;
}
function clickMenu(url){location.href=url;}
//開新視窗
function openpopDF(popurl,na,wd,hg){
	wd=(wd)?wd:800;
	hg=(hg)?hg:500;
	na=(na)?na:"stmp";
	var str="width="+ wd +",height="+ hg +",toolbar=yes,location=yes,status=yes,scrollbars=yes,directories=yes,resizable=yes";
    var winpops=window.open(popurl,na,str);
}
//開新視窗有捲軸可縮放
function openpop(popurl,na,wd,hg){
	wd=(wd)?wd:800;
	hg=(hg)?hg:500;
	na=(na)?na:"stmp";
	var str="width="+ wd +",height="+ hg +",status,scrollbars,resizable";
    var winpops=window.open(popurl,na,str);
}
//開新視窗無捲軸不可縮放
function openpopLite(popurl,na,wd,hg){
	wd=(wd)?wd:800;
	hg=(hg)?hg:500;
	na=(na)?na:"stmp";
	var str="width="+ wd +",height="+ hg +",status=no,scrollbars=no";
    var winpops=window.open(popurl,na,str);
}
function is_big5(word){
	var cn=0;
	var en=0;
	if (word!=''){
		num=word.length;
		for(var i=0;i<num;i++){
			if(word.substr(i,1).charCodeAt(0)>127){cn++;}
			else{en++;}
		}
		if (cn<num){
			if(en==num){return 1;}//英文字
			else{return 2;}//中英混雜
		}else{return 0;}//中文字
	}
}