<!-- start hiding 
	function autoTabVal(field,maxlen,nextfield,fieldtype) {
		// will validate field and auto tab to the next field 
		if (validate(field,fieldtype)) {
			autoTab(field,maxlen,nextfield);
		}
	}
	function autoTab(field,maxlen,nextfield) {
                vKeyCode = window.event.keyCode
                if((field.value.length==maxlen) && (vKeyCode==9 || vKeyCode==16)){ return; }
		if (field.value.length == maxlen)
			nextfield.focus();
		
	}
	function validate(field,fieldtype) {
		// fieldtype 1 = zip code (12345-9090)
		// fieldtype 2 = phone number (123-456-7899)
		// fieldtype 3 = checks for numbers only
		// fieldtype 4 = checks for alpha only
		// fieldtype 5 = check for vaild email address (asb@asb.com)
		if (fieldtype == 1) {
			validchar = '1234567890-';
			// check for invalid characters
		 if (validchar.indexOf(field.value.substring(field.value.length - 1)) == -1) {
		 	alert("Sorry invalid character : "+ field.value.substring(field.value.length - 1));
			field.value = field.value.substring(0,field.value.length - 1);			
			field.focus();
			return false;
		 }
		 return true;
		}
		if (fieldtype== 3) {
			validchar = '1234567890';
			// check for invalid characters
			if (validchar.indexOf(field.value.substring(field.value.length - 1)) == -1) {
				alert("Sorry invalid character : "+ field.value.substring(field.value.length - 1));
				field.value = field.value.substring(0,field.value.length - 1);				
				field.focus();
				return false;
			}
			return true;
		}
		if (fieldtype== 4) {
			validchar = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
			// check for invalid characters
			if (validchar.indexOf(field.value.substring(field.value.length - 1)) == -1) {
				alert("Sorry invalid character : "+ field.value.substring(field.value.length - 1));
				field.value = field.value.substring(0,field.value.length - 1);
				field.focus();
				return false;
			}
			return true;
		}		
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openWin(url) {
        hiswin=open(url);
        hiswin.focus();
}

function change(id, newClass) {
	//change all style back to default
        document.getElementById('step1').className='step1';
	document.getElementById('contact').className='ContactInfo';
	document.getElementById('step2').className='step2';
	document.getElementById('delivery').className='DeliveryInfo';
	document.getElementById('step3').className='step3';
	document.getElementById('jobinstr').className='JobInstructions';
	document.getElementById('step4').className='step4';
	identity=document.getElementById(id);
	identity.className=newClass;
	if (id=='step1') {
            document.getElementById('contact').className='ContactInfohigh';
        }
	if (id=='step2') {
	   document.getElementById('delivery').className='DeliveryInfohigh';	
	}
	if (id=='step3') {
	   document.getElementById('jobinstr').className='JobInstructionshigh';
	}

}

function setDefault() {
    form = document.workorder;
    form.delcompany.value = trim(form.company.value);
    form.attention.value = trim(form.firstname.value)+" "+trim(form.lastname.value);
    form.deladdress.value = trim(form.address.value);
    form.delcity.value = trim(form.city.value);
    form.delstate.value = trim(form.state.value);
    form.delzip.value = trim(form.zip.value);
}

function selectDefault(radID,newClass) {
	setDefault();
	change(radID,newClass);
}

function clearDel(radID,newClass) {
    form = document.workorder;
    form.delcompany.value = "";
    form.attention.value = "";
    form.deladdress.value = "";
    form.delcity.value = "";
    form.delstate.value = "";
    form.delzip.value = "";
    change(radID,newClass);
}

function trim(str) {
	str = LTrim(str);
	str = RTrim(str);
	return str;
	
}
function LTrim(str)
{
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...
            var j=0, i = s.length;
            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;
            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }
        return s;
}

function RTrim(str)
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in whitespace
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...
            var i = s.length - 1;       // Get length of string
            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;
            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }
        return s;
}

// end hiding -->
