// JavaScript Document
<!--
function Trim(s)
{
	var temp = " ";
	var i = 0;

	while ((temp == " ") && (i <= s.length)) {
		temp = s.charAt(i);
		i++;
	}
	s = s.substring(i - 1, s.length);

	i = s.length;
	temp = " ";
	while ((temp == " ") && (i >= 0)) {
		temp = s.charAt(i - 1);
		i = i - 1;
	}
	s = s.substring(0, i+1);
	return(s);
}

function IsSelected(s)
{
	if (s.options[s.selectedIndex].value == "NULL") {
		return(false);
	} else {
		return(true);
	}
}

function IsEmpty(s)
{
	if (Trim(s) == "") {
		return(true);
	} else {
		return(false);
	}
}


function IsNum(s){
	tmp = true;
	for (var i = 0; i < s.length; i++) {
		var ch = s.substring(i, i + 1);
		 if (ch < "0" || "9" < ch) {
			tmp = false;
			break;
		 }
		 if (tmp == false) {
			break;
		 }
	}
	return(tmp);
}

function IsDecimal(s){
	tmp = true;
	s.value = Trim(s.value);
	firstChar = s.substring(0, 1);
	if (firstChar < "0" || "9" < firstChar )  {
		return false;	
	}
	
	for (var i = 0; i < s.length; i++) {
		var ch = s.substring(i, i + 1);
		 if ((ch < "0" || "9" < ch ) && (ch != ".") && (ch != ",")) {
			tmp = false;
			break;
		 }
		 if (tmp == false) {
			break;
		 }
	}
	return(tmp);
}

function IsEmail(email) 
					{
						var pos, pos2;
						email = Trim(email);
						pos = email.indexOf("@");
						pos2 = email.indexOf("'");
						pos3 = email.indexOf(",");					
						if ((pos < 2) || (email.indexOf(".", pos + 1) == -1)) {
							return(false);
						} else if ( pos2 > 0 ) {
							return(false);
						} else if ( pos3 > 0 ) {
							return(false);
						} else if ( IsSpace(email) ) {
							return (false);
						} else if ( !IsEmailCharacter(email) ) {
							return (false);
						} else {
							return(true);
						}
					}

function IsSpace(s){
	var temp = " ";
	var i = 0;
	space	= false;
	s = Trim(s);
	while (i <= s.length) {
		temp = s.charAt(i);
		if (temp == " " ) {
			if ( i < s.length - 1 ) {
				space = true
			}
		}
		i++;
	}
	return (space);
}

function IsEmailCharacter(s) {
  for (var i = 0; i < s.length; i++) 
   {
   var ch = s.substring(i, i + 1);
   if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch != "@") && (ch != "." ) && (ch != "_" ) && (ch != "-" ) && (ch < "0" || "9" < ch) ) 
     {
     return false;
		 break;
     }
   }
  return true;
  }


function IsOption(s)
{
	Temp = false;
	for (i = 0; i < s.length; i++) {
		if (s[i].checked == true) {
			Temp = true;
			break;
		}
	}
	return(Temp);
}

function IsCheck(s)
{
	Temp = false;
		if (s.checked == true) {
			Temp = true;
		}
	return(Temp);
}


function IsFileEmpty(objField) {
	var WSPACE=' \t\n\r';
	var v = objField.value;
	if ((v == null) || (!v.length)) return true;
	for (var i = 0; i < v.length; i++) {
		if (WSPACE.indexOf(v.charAt(i)) == -1) return false;
	}
	return true;
}

function IsPassword(s) {
  for (var i = 0; i < s.length; i++) 
   {
   var ch = s.substring(i, i + 1);
   if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch != "_" ) && (ch != "-" ) && (ch < "0" || "9" < ch) ) 
     {
     return false;
		 break;
     }
   }
  return true;
 }


function Warning(obj, msg) {
	alert(msg);
	obj.focus();
}

function WarningAndSelect(obj, msg) {
	alert(msg);
	obj.select();
}


function fn_delete_confirm(n, url, msg) {
	var answer = confirm (msg);
	if (answer) {
		window.location = url;
	} else {
		return (false);
	}
}


//-->
