function error(elem, text) {
	if(true) window.alert(text);
	elem.focus();
	return false;
}

function isEmpty(str)
{
	if(str.length==0||str=="Null"){
		return true;
	}
	else{
		return false;
	}

}

function isAbsString(str)
{
	for(i=0;i<str.length;i++)
	{
		if(!isNaN(parseInt(str.charAt(i)))){
			return false;
		}
	}

	return true;
}


function isValidZip(str){
	for(i=0;i<str.length;i++)
	{
 	if( -1 == "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".indexOf(str.charAt(i)) )
	return false
	}
	return true;
}

function isAbsInt(str)
{
	if(isEmpty(str))return false;

	for(i=0;i<str.length;i++)
	{
		if(isNaN(parseInt(str.charAt(i)))){
			return false;
		}
	}
	return true;
}

function isVaildPhone(str)
{
	for(i=0;i<str.length;i++)
	{
		if(isNaN(parseInt(str.charAt(i)))){
			if(str.charAt(i)!='-' && str.charAt(i)!='(' && str.charAt(i)!=')' && str.charAt(i)!='*' && str.charAt(i)!=' ' )
			{
			    return false;
			}
		}

	}
	return true;
}

function isChecked(checkbox){
			for (i=0;i<checkbox.length;i++)
			{
				if( checkbox[i].checked ){
				   return true;
				   }
			}
			return false;
}

function isEmail(strEmail) {
 if( 0 == strEmail.length )
 return true;
 if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
  return true;
  return false;
}

function actConfirm(action,msg)
{

	ret=confirm(msg);

	if(ret!=0){

		window.navigate(action);

	}
	else{

		return false;

	}
}


function isVaildIP(ip){
	
	var seg=ip.split("/.");

	for(i=0;i<seg.length;i++){
		
		if(isNaN(parseInt(seg[i]))){
			return false;
		}else{
			if(parseInt(seg)>255 || parseInt(seg)<0){
				return false;
			}
		}
	
	}

	return true;

}
