//function to validate by length
function lengthValid(field, len, text) {
    // text = Trim(text);
	if (field.value.length < len)
  	{
 	  	alert("."+"ара ома "+text);
		field.focus();
		return false;
	}else{
		return true;
	}
}

//function to validate numerical fields
function numberValid(field, text) {
    //text = Trim(text);
	if (isNaN(field.value))
  	{
 	  	alert("ара ома " + text + ".");
		field.focus();
		return false;
	}else{
		return true;
	}
}


//function to validate Zip Code fields
function zipValid(field,len, text) {
    //text = Trim(text);
	if (isNaN(field.value) || field.value.length < len)
  	{
 	  	alert("ара ома " + text + ".");
		field.focus();
		return false;
	}else{
		return true;
	}
}

//function to validate email
function emailValid(mailfield, len, text) {
   // text = Trim(text);
	if(mailfield.value.length < len || mailfield.value.indexOf("@") < 1 || mailfield.value.indexOf(".") < 2)
	{
	    alert("."+"ара ома " + text);
		mailfield.focus();
		return false;
	}else{
		return true;
	}
}

//function to validate select drop-downs
function selectValid(field, text) {
    //text = Trim(text);
	if (field[0].selected)
  	{
 	  	alert("ара ома " + text + ".");
		field.focus();
		return false;
	}else{
		return true;
	}
}

//function to check check-box
function chkbox(field, text) {
   // text = Trim(text);
	if(field.checked)
	{
		return true;
	}else{
		alert("ара ома " + text + " box.");
			field.focus();
			return false;
	}
}

function GoBack() {
			history.go(-1);
		}

 function ExitMenu() {
			window.location.href=("/icc/wc.dll?cpadmin~mainmenu");
		}

function irregularchar(field) {
	var string=field.value;
	var text="" ;
	for (var i=0; i < string.length; i=i+1) {
		switch(string.charAt(i)) {
		   case "'":
			text=text+"`";
			break;
		   case '"':
			text=text+"``";
			break;
		   default:
			text=text+string.charAt(i);
		}
	   }
	field.value=text;
   }


function irregularchar2(field) {
	var string=field.value;
	var text="" ;
	for (var i=0; i < string.length; i=i+1) {
		switch(string.charAt(i)) {
		   case "'":
			text=text;
			break;
		   case '"':
			text=text;
			break;
		   default:
			text=text+string.charAt(i);
		}
	   }
	field.value=text;
   }

