﻿var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
function MM_openBrWindow(theURL,winName,features) { //v2.0 跳出pop   
  win = window.open(theURL,winName,features);
  win.focus();
}
function Pop_Dialog(theURL,winName,features)  {//跳出強迫widows
  if(ie) {
      window.showModalDialog(theURL,winName,features);
  }  
  else if(w3) {
      MM_openBrWindow(theURL,winName,features) 
  }
  else {
  }
}

function chknull(obj, msg)
{
	if (obj.value == "")
	{
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}

function chkemailformat(obj, msg)
{
	
	var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
	if (!pattern.test(obj.value))  {
	    alert(msg);
	    obj.focus();
	    return false;
	}
        
	return true;
}

function chkinteger(obj, msg)
{
	var re = /^[^a-z|^A-Z]+$/;

	if (!re.test(obj.value))
	{
	
		return false;
	}
	return true;
}
function chkcheckbox(obj, msg)
{
	if (! obj.checked)
	{
	
		return false;
	}
	return true;
}
function chklength(obj,length,msg)
{
	if (obj.value.length > length)
	{
	    alert(msg);
		obj.focus();
		return false;		
	}
	return true;
}

function chkMin(obj,value) 	
{    
	if (parseInt(obj) < value)
	{		
		
		return false;
	}
	return true;
}
