// JavaScript Document
function checkForm(f){
	
	var c = /[^\s^\n]/;
	var m = /^([a-zA-Z0-9])([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
	
		for(i=0;i<f.length;i++){
			var fg = f[i].getAttribute("chk");
			if((fg == "theText" || fg == "theMail") && f[i].value.match(c) == null){
				alert(f[i].getAttribute("err"));
				f[i].focus();
				return false;			
			 }else if(fg == "theMail" && f[i].value.match(m) == null){
				 alert("Email格式錯誤");
				 f[i].focus();
				 return false;				 
			 }
			
		}
		
		return confirm("填寫內容確定無誤嗎?");

}

function centerWindow(theURL,width,height) {
    var window_width = width;
    var window_height = height;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '','','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',scrollbars=yes');
    newWindow.focus();
}

