
function isNumeric(value){
    var returnValue = true;
	var re =  new RegExp("^([0-9]+)$");
	if(value.search(re) == -1)
	{
	   returnValue=false;
	}
	return returnValue;
}


function isValid(value){
    var returnValue = true;
	var re =  new RegExp("^[A-Za-z0-9_-]+$");
	if(value.search(re) == -1)
	{
	   returnValue=false;
	}
	return returnValue;
}


function trimAll(x)
   {
    rtn = x;
    while((rtn.length>0) && (rtn.charAt(0)==' '))
        rtn = rtn.substring(1,rtn.length);
    while((rtn.length>0) && (rtn.charAt(rtn.length-1)==' '))
        rtn = rtn.substring(0,rtn.length-1);
    return rtn;
  }

function isEmail(value){
    var returnValue = true;
    	var re = /^[0-9a-zA-Z\-\.\_]+@[0-9a-zA-Z\-]+\.[0-9a-zA-Z\-\.]+$/;
    	if (!value.match(re))
    	{
    		returnValue=false;
    	}
    	return returnValue;
}

    function checkRadio(object)
    {
    	for (var i=0; i<object.length; i++)
    	{
    		if (object[i].checked)
    			return true;
    	}
    	return false;
    }
	
function isTel(checkStr){
var checkOK = "0123456789 ";
var allValid = true;
if (checkStr.length<1)
 allValid=false;
  for (i=0;i<checkStr.length;i++)
  {
    ch=checkStr.charAt(i);
    for(j=0;j<checkOK.length;j++)
      if(ch==checkOK.charAt(j))
        break;
    if(j==checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  return allValid;
}



function newin(fname,w,h){
var win = null;
var myname="";
var scroll="yes";
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(fname,myname,settings)
}


