function de(txt,element) {	// data error
	element.focus()
	element.select()
	alert(txt)
}

function de2(txt,element){
	element.focus()
	alert(txt)
}

function stripchar(str,character) {	// strips character from str
	s = str
	if (s != null) {
		while ((j=s.indexOf(character))>=0) {
			s = s.substring(0,j) + s.substring(j+1,s.length)
		}
	}
	return s
}

function stripbegspace(str) {	// strips whitespace from beginning of string
	t = str
	if (t != null) {
		for (i=0; i<t.length; i++) {
				if ( t.charAt(0)==' ' || t.charAt(0)=='	') {				//second IF is a tab
					t = t.substring(1,t.length)
					i=0;   									//restart the count 
				}else{
					return t;
				}
		}
	}
	return t;
}

function checknumeric(txt) {
	ok = true
	t = txt
	for (i=0; i<t.length; i++) {
		if (!isDigit(t.charAt(i)) && ok==true) { ok=false }
	}
	return ok
}

function checknumericcount(txt) {
	count=0;
	t = txt
	for (i=0; i<t.length; i++) {
		if (isDigit(t.charAt(i))){ count = count+1; }
	}
	return count;
}

function checkalphacount(txt) {
	ok = true
	count = 0;
	t = txt
	for (i=0; i<t.length; i++) {
		if ( (t.charAt(i) <= "z" && t.charAt(i) >= "a") || (t.charAt(i) <= "Z" && t.charAt(i) >= "A")) { count = count + 1; }
	}
	return count;
}

function isDigit(num) {
	if (num.length>1){return false;}
	var string="1234567890.";
	if (string.indexOf(num)!=-1){return true;}
	return false;
}


function validate_login(usrLen,pwdLen)
{ 
  
  if ((usrLen < 4)||(usrLen >8)){
    alert('Sorry, but your username must be between 4 and 8 characters. Please try again!');
    return false;
  }
  if ((pwdLen < 4)||(pwdLen >8)){
    alert('Sorry, but your password must be between 4 and 8 characters. Please try again!');
    return false;
  }
  
  return true;
}






