<!--
// JavaScript Document
String.prototype.trim = function() {

 // skip leading and trailing whitespace
 // and return everything in between
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}
function strTrim(item) {

  var s=item.value;
  if (s.check()){
	item.value=s.trim();
  }
  else {
	item.value=s.trim();	
	item.focus();
	}
}

function numTrim(item){
	var s=item.value;
	if (s.Number()){
		item.value=s.trim();
	}
	else {
		item.value=s.trim();
		item.focus();
	}		
}

function itemTrim(item){
	var s=item.value;
	item.value=s.trim();	
}

function TelephoneTrim(item){
	var s=item.value;
	if (s.Numbercheck()){
		item.value=s.trim();
	}
  else {
	item.value=s.trim();
	item.focus();
	}	
}

String.prototype.check=function() {

var checkFalse = "~`!@#$%^&*()=+|\/?.>,<" //"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. ";
var x=this;
var checkStr = x;
var allValid = true;
for (i = 0;  i < checkStr.length; i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkFalse.length; j++)
      if (ch == checkFalse.charAt(j))
       {
		alert("Special characters are not allowed");
		return (false);
		}
	}
    return (true);
}



String.prototype.Numbercheck=function() {

var checkOK = "0123456789()- ";
var x=this;
var checkStr = x;
var allValid = true;
for (i = 0;  i < checkStr.length; i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Only are numbers allowed");
    return (false);
  }
    return (true);
}

String.prototype.Number=function() {

var checkOK = "0123456789";
var x=this;
var checkStr = x;
var allValid = true;
for (i = 0;  i < checkStr.length; i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Only are numbers allowed");
    return (false);
  }
    return (true);
}


function checkSubmit() 
			{
				var numChecked = 0;
					for (i=0;i<document.forms[0].length;i++) 
					{						
						if(document.forms[0].elements[i].type && document.forms[0].elements[i].type == "checkbox")
						 {
							if(document.forms[0].elements[i].checked == true) 
							{
								//alert('got one');
								numChecked ++;
								return true;
							}
						 }	
					 }
					if(numChecked == 0) 
					{
						alert('Please select at least one position.');
						return false;
					}
					
				}	
				
function checkSubmitForDelete() 
			{
				var numChecked = 0;					
					for (i=0;i<document.forms[0].length;i++) 
					{						
						if(document.forms[0].elements[i].type && document.forms[0].elements[i].type == "checkbox")
						 {
							if(document.forms[0].elements[i].checked == true) 
							{
								//alert('got one');
								numChecked ++;
								document.Form1.txthdn.value="1";
								return true;
							}
						 }	
					 }
					if(numChecked == 0) 
					{
						alert('Please select at least one position.');
						return false;
					}
					
				}	
									
				
				
//var ie=document.all
//var dom=document.getElementById
//var ns4=document.layers
//var calunits=document.layers? "" : "px"

//var bouncelimit=32 //(must be divisible by 8)
//var direction="up"




