function chkRadio(x,y)
{
	var flag;
	
	for (i=0;i<x.length;i++){
		if (x[i].checked){
			flag=1;
			break;
		}
	}
	
	if (flag==1){
		return true;
	} else {
		alert(y);
		return false;
	}
}

function chkSelect0(x,desc)
{
	if(x.options[x.selectedIndex].value!=""){
		return true;
	} else {
		alert(desc);
		return false;
	}
}

function chkSelect(x,desc)
{
	if(x.options[x.selectedIndex].value>0){
		return true;
	} else {
		alert(desc);
		return false;
	}
}
function takeCheck(x){
	var flag;
	
	for (i=0;i<x.length;i++){
		if (x[i].checked){
			flag=i;
			break;
		}
	}
	
	return x[flag].value;
}

function checkField(ff){
	if (ff.length==0){
		return false;
	}
	else{
		return true;
	}
}

function validate_email(field,alerttxt)
{
	var apos=field.indexOf("@")
	var dotpos=field.lastIndexOf(".")
	
	if (apos<1||dotpos-apos<2) 
	  {alert(alerttxt);return false}
	else {return true}

} 


function isEmail(string) {

   if (!string) return false;
   var iChars = "*|,\":<>[]{}`\';()&$#%";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}                      
function isProper(string) {

   if (!string) return false;
   var iChars = "*|,\":<>[]{}`\';()@&$#%";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}

function isSuggest(string) {

   if (!string) return false;
   var iChars = "\"<>\';%&$";
   
   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}

function trim() { //去字串空白
	return this.replace(/^\s+|\s+$/g, "");
}