

<!--

/************************************************
/		global variables
/	
************************************************/

var blank = "", n = "none", b = "block", h = "hidden", v = "visible", ds = "display", vs = "visibility";
var intro, error, main, tableLen, zipContainer, understand, newField, show, example1, example2, label, top, est, proj, con, btn, foot;

var tables = new Array;
var fields = new Array;
var list = new Array;
var fieldsToRemember = new Array;
var skippedListIndex = new Array;
var bShowContacts = true;
var bLookup = false;
var bCookies = false;
var bVerifying = false;
var bExample = false;
var digits = "1234567890";

var currURL = window.location.href;
var bLighting = (currURL.indexOf('l_bid.htm') != -1) ? true : false;

var messages = new Array;
messages[0] = "We are having trouble validating your zipcode.  Please try again.";
messages[1] = "We're sorry, your zipcode in not located within our service area. We apoligize for any inconvenience.";
messages[2] = " is a required field.";
messages[3] = "Please provide a response.";
messages[4] = " radio buttons are required fields.";
messages[5] = "You may select only one.";
messages[6] = " checkboxes are required fields.";
messages[7] = "You may select more than one.";
messages[8] = " checkbox is a required field.";
messages[9] = "You must check the box to continue.";
messages[10] = " combobox is a required field.";
messages[11] = "You may select only one.";
messages[12] = "";


/************************************************
/		function init()
/	
************************************************/

function init(){
	cookieCheck();
	fillTablesArray();
	initDocVariables();
	fillFieldsArray();
	setUpPage();
	
}

/************************************************
/		function cookieCheck()
/	
************************************************/

function cookieCheck(){

	if(!COOKIES) {return bCookies = false;}
	if(is.COOKIE) {return bCookies = true;}
	if(isString(document.cookie)){
		if(document.cookie.length == 0){
			document.cookie = 'test';
			bCookies = (document.cookie == 'test');
			document.cookie = "";
		}
		else {bCookies = true;}
	}

}

/************************************************
/		function	initDocVariables()
/	
************************************************/

function	initDocVariables(){

	intro = document.getElementById('intro');
	error = document.getElementById('error');
	main = document.getElementById('main');
	top = document.getElementById('top');
	est = document.getElementById('estimateinfo');
	proj = document.getElementById('projectinfo');
	con = document.getElementById('contactinfo');
	btn = document.getElementById('buttonmailto');
	foot = document.getElementById('footer');	
	newfield = new Field();
	
	/***************************************
	/	browserCheck() additions
	/**************************************/
	
	is.W3C	= (document.images && document.body && document.body.style && document.getElementById) ? true:false;
	is.CSS	= (document.images && document.body && document.body.style) ? true:false;
	is.IE4	= (document.all && !document.getElementById && document.body.style && !window.opera) ? true:false;
	
}

function fillTablesArray(){	// get all tables & tbody references for each table into arrays

	if(document.getElementsByTagName){
		var y = document.getElementsByTagName('TABLE');
		tableLen = y.length;
		for(var i=0;i<y.length;i++){
			if(y[i].getAttribute('id')=='waitingRoom') {continue;}
			var z = y[i].getElementsByTagName('TBODY')
			y[i].tbodys = new Array();
			for(var j=0;j<z.length;j++){
				if(z[j].getAttribute('id')) {y[i].tbodys.push(z[j]);}
			}
			tables.push(y[i]);
		}
	}

}


/************************************************
/		function setUpPage()
/		hide all tables, zipcode error display and set focus on zipcode
/	
************************************************/
	
function setUpPage(){
				
	intro.style[ds] = n;
	setFocus('zipcode');

}

/************************************************
/		function lookup(zip)
/	
************************************************/

function lookup(zip){

	var goodZips = ["91941", "91942", "91945", "91950", "92014", "92037", "92064", "92071", "92093", "92101", "92102", "92103", "92104", "92105", "92106", "92108", "92109", "92110", "92111", "92113", "92115", "92116", "92117", "92118", "92119", "92120", "92121", "92122", "92123", "92124", "92126", "92127", "92128", "92129", "92130", "92131", "92133", "92134", "92135", "92140", "92145", "92161", "92182"]

	var field = Field.form[zip].value.trim();;
	if(!checkAgainstConstraint(field.trim(),'uszip')) {showError(0);}
	else{
		for(var i=0;i<goodZips.length;i++){
			if(field == goodZips[i]){ 
				foot.style[ds] = n;
				main.style[ds] = b;
				intro.style[vs] = v; 
				intro.style[ds] = n; 
				if(!compatible) {preparePlanB();}
				else{
					prepareForm();
					intoMainForm('showButtons');	
				}
				main.style[vs] = v;
				foot.style[ds] = b;
				zipContainer = field;
				scrollTo(0,300);
				setFocus('_wfu1');
				bLookup = true;
				return;
			}
		}
		showError(1); 
	}
}

/************************************************
/		function showError(index)
/	
************************************************/

function showError(index){

	if(isNaN(index)) return;
	intro.style[ds] = b;
	intro.style[vs] = v;
	intro.innerHTML = "";
	intro.innerHTML = messages[index];
	setFocus('zipcode');
}

/************************************************
/		function resetZip(form)
/	
************************************************/

function resetZip(form){

	form.zipcode.value="";
	intro.innerHTML = "";
	intro.style.display="none";
	setFocus('zipcode');
}


/************************************************
/		Field constructor
/	
************************************************/

function Field(field, name, type){

	Field.form = document.forms['frmStep2'].elements;
	this.obj = field;																			// object - dom object reference
	this.name = name;																		// string - name and object reference for form collections
	this.type = type;																		// string- form type
	if(this.obj) this.group = (this.obj[1]) ? true : false;						// boolean - if a form element group															
	this.required = false;																	// boolean - can object value be empty(null)						
	this.relevent = false;																	// boolean - if not empty, validate
	this.fieldset = null;																		// object - is object contained within a fieldset 
	this.constraint = false;																// string - validation standard								
	this.parent = null;																		// object - if dependent == true id of parent
	this.parentStatus = false;															// boolean - indicating condition for dependent validation
	this.dependent = false;																// boolean - is this object dependant on another for its validation status
	Field.ParentStatus = getParentStatus;											// function - returns boolean if parent.value == checked or !blank
	
	this.txt = (/text\b/i.test(this.type)) ? true : false;							// boolean - true if type = text
	this.btn = (/[mbs]{1}[ieu]{1}t{1}/i.test(this.type)) ? true : false;	// boolean - true if type = submit || reset || button
	this.hdn = (/hidden/i.test(this.type)) ? true : false;						// boolean - true if type = text
	this.img = (/image/i.test(this.type)) ? true : false;							// boolean - true if type = image
	this.rad = (/radio/i.test(this.type)) ? true : false;							// boolean - true if type = radio
	this.cbx = (/checkbox/i.test(this.type)) ? true : false;					// boolean - true if type = checkbox
	this.sel = (/select/i.test(this.type)) ? true : false;							// boolean - true if type = select-one || select-multiple
	this.area = (/area/i.test(this.type)) ? true : false;							// boolean - true if type = textarea
	this.roc = (this.rad || this.cbx) ? true : false;								// boolean - true if type = radio or checkbox
}

/************************************************
/		function fillFieldsArray()
/	
************************************************/

function fillFieldsArray(){

	var q = Field.form;
	var fs = new Array;
	var re = new RegExp('','');
	var field,r,d,c,t,name,id,x;
	for(var i=0; i<q.length;i++){
		field = q[i];
		if(field.getAttribute('required')){
			r = field.getAttribute('required');
			d = field.getAttribute('dependent');
			c = field.getAttribute('constraint');
			t = field.type.toLowerCase();
			if((!r || r == 'none') || (!t || (t == 'button' || t == 'file'))) {continue;}
			else{	
				name = field.name;
				id = field.id;
				if( (t == 'checkbox' || t == 'radio') && q[name][1] ){ //[0]
					field = q[name];
					if(!isObject(field) || duplicateName(name)) {continue;} 			
				}
				x = new Field(field, name, t);
				if(!isNull(d)){
					x.dependent = true;
					if(isString(d) && d == 'true'){
						x.parentException = true;
						x.exceptionValue = false;
						x.parent = null;
					}
					else{				
						field = Field.form[d];
						if(isObject(field) && field[1]) {x.parent = field;}
						else {x.parent = document.getElementById(d);}
					}
				}
				if(!isNull(c)) {x.constraint = c;}	
				x.required = (r == 'required') ? true : false;
				x.relevent = (r == 'relevent') ? true : false;		
				for(var j in fs){
					re.compile(fs[j].id,'');
					if(re.test(id)) {x.fieldset = fs[j];}
				}
				fields.push(x);
			}
		}  
		else if(field.tagName.toLowerCase() == 'fieldset') {fs.push(field);}
	}
	for(i=0;i<fields.length;i++) {fields[fields[i].name] = fields[i];}
}

/************************************************
/		repairObjRef()
/	
************************************************/

function repairObjRef(){

	var x,y;
	for(var i=0;i<fields.length;i++){
		x = fields[i];
		if(x.group && !x.txt){
			if(x.obj[1] || !Field.form[x.name]) {continue;}
			else {x.obj = Field.form[x.name];}
		}
		y = fields[i].parent;
		if((!y) || !Field.form[y.id]) {continue;}
		if(y[1]) {y = Field.form[y.name];}
		else {y = document.getElementById(y.id);}		
	}

}

/************************************************
/		getParentStatus()
/	
************************************************/

function getParentStatus(){

	var x;
	for(var i=0; i<fields.length; i++){
		x = fields[i];
		if(!x.dependent) {continue;}
		if(x.parentException) {x.parentStatus = x.exceptionValue; continue;}
		x.parentStatus = false;
		if(x.parent.type == 'text' && !isBlank(x.parent.value)) {x.parentStatus = true; continue;}
		else if(isSelectedGroup(x.parent)) {x.parentStatus = true; continue;}
	}
	
}

/************************************************
/		duplicateName(s)
/	
************************************************/

var duplicates = new Array;
function duplicateName(s){

	if(duplicates.length > 0){
		for(var i=0; i<duplicates.length;i++){
			if(s == duplicates[i]) return true;}
			duplicates.push(s); return false;
	}
	else {duplicates.push(s); return false;}
}

/************************************************
/		function verifyFields()
/	
************************************************/

function verifyFields(){

	intro.style[ds] = n;
	invalid.reset();
	repairObjRef();
	getParentStatus();
	
	var v,w,x,obj,value,checked,code,turf = 0,submit = false;
	for(var i=0;i<fields.length;i++){
		x = fields[i]; 
		checked = (x.constraint == 'checked' || (!x.constraint)) ? true : false;
		if(x.required || (x.parentStatus && x.relevent && x.dependent)){
			if(x.roc){
				w = isSelectedGroup(x.obj);
				if(!w){
					v = new Invalid(i); 
					list.push(v); continue;
				}
			}
			else if(x.sel || x.txt){
				value = x.obj.value;
				if(isBlank(value)){
					v = new Invalid(i); 
					list.push(v); continue;
				}
				else if(VALIDATE && x.txt && x.constraint){
					if(!checkAgainstConstraint(value,x.constraint)){
						v = new Invalid(i,x.constraint); 
						list.push(v); continue;
					}
					else if(NORMALIZE) {x.obj.value = format(value,x.constraint)}				
				}
			}
		}
	}
	for(i=0;i<list.length;i++) {list[list[i].name] = list[i];}
	if(invalid.total() > 0){
		invalid.display();
		invalid.locate();
		setErrorFocus(list[0]);
	}
	submit = (invalid.total() == 0) ? true : false;
	if(submit){
		getReferrer();
		document.frmStep2.submit();
	}
											
}


/************************************************
/		Error constructor
/		Invalid constructor
/	
************************************************/

function Error(){
	
	this.total = function(){
		return (list.length);
		};
	this.reset = function(){
		list.length = 0;
		skippedListIndex.length = 0;
		bVerifying = true;	// for usableforms to start reflowing error message boxes
		};
	this.display = displayError;	
	this.focus = setErrorFocus;
	this.locate = setErrMsgCoords;
}

function Invalid(index,constraint){

	this.index = index;											//fields[index]
	this.fieldset = fields[index].fieldset;
	this.field = fields[index];
	this.group = fields[index].group;
	this.blank = (Invalid.arguments.length == 1) ? true : false;
	this.msg = (this.blank) ? null : errorCodes[constraint].msg;
	this.name = (this.field[0]) ? this.field[0].name : this.field.name;

}

var invalid = new Error();
Invalid.prototype = new Error();

/***************************************************
/		function displayError()
/
/**************************************************/

function displayError(){
	
	var x, field, prev, curr, next, title, msg = "", heading = "", total = "";
	var box =  "<div class=\"display\" id=\"list_";
	var len = list.length;

	for(var i=0,j=1;i<len;i++,j++){
		x = list[i];
		field = x.field;
		prev = curr;
		curr = x.fieldset.id; 
		title = (field.obj.title) ? "<span>" + field.obj.title + "</span>" : "";
		next = (j<len) ? list[j].fieldset.id : "";
		heading = "<span class='header'>" + x.fieldset.title + "</span>";		
		
		if(prev != curr) {msg = "";}
		if(curr == next) {skippedListIndex.push(i);} //keeps track of skipped 'list_#' when two or more errors are combined into one display
		msg += "<p>" + title;
		if(x.blank) {msg += (field.rad) ? messages[4] : ((field.group && field.cbx) ? messages[6] : ((field.sel) ? messages[10] : ((field.cbx) ? messages[8] :  messages[2])));} 
		else {msg += x.msg;}
		msg += "</p>";
		if(j == len || curr != next) {total += box + i + "\">" + heading + msg + "</div>";}
	}
	error.innerHTML = total;
	
}	

/***************************************************
/		function setErrMsgCoords(obj)
/
/**************************************************/

function setErrMsgCoords(obj){

	var pos = 0, id, ref, fs, adj; 
	var reIsInContactinfo = /rsn|rsp|con|cpn|cnt|sla|ead/i;
	var offset = (!is.NS6 || !is.MOZ) ? 14 : ((bExample) ? -2 : 12);
	for(var i=0,j=0;i<list.length;i++){
		// see displayError
		if(i == skippedListIndex[j]) {j++; continue;}
		adj = -89;
		id = "list_" + i;
		fs = list[i].fieldset;

		// if change request_type indexes, clears all error displays in contactinfo
		if((obj) && (obj.name == 'request_type' && reIsInContactinfo.test(fs.id))) {document.getElementById(id).style[vs] = h; continue;}	
	
		// if one of the 'others', pixel alignment adjustment
		adj += (list[i].name == 'wfu_other') ? 100 : ((list[i].name == 'spn_other') ? 205 : ((list[i].name == 'tds_other') ? 79 : 0));
		pos = parseInt(getObjPosition(fs));
		shiftTo(id,0,(pos + offset + adj));
		// if an tbody has been removed from the DOM, this hides the error display
		if(pos == 0) {document.getElementById(id).style[vs] = h;}
	}

}

/***************************************************
/		checkAgainstConstraint(value, constraint)
/
/**************************************************/

function checkAgainstConstraint(value, constraint){

	var x = new String(value);
	var c = errorCodes[constraint].re;
	x = x.trim();
	var re = new RegExp(c,"i") 
	return re.test(x); 
}

/***************************************************
/		function setErrorFocus(v)
/
/**************************************************/

function setErrorFocus(v){

	if(!isObject(v)) {return;}
	var focusObj = v.field;
	if(!v.group){
		if(focusObj.focus) {focusObj.focus()}
		if(focusObj.type == 'text') {if(focusObj.select) focusObj.select();}
	}
	
	var scrollObj = v.fieldset;
	var p = getObjPosition(scrollObj)
	var h = getInsideWindowHeight() / 2;
	var position = (p - h <= 0) ? 0 : (p - h);
	self.scrollTo(0,position)

}



/************************************************
/		function getReferrer()		
/	
************************************************/

function getReferrer(){

	document.getElementById('referrer').value = currURL;
	
}

/************************************************
/		validation functions
/	
************************************************/

var errorCodes = new Array();
errorCodes[0] = {constraint : "name" , re : "^[a-z]+(([\\'\\,\\.\\- ][a-z\\s])?[a-z]*)*$" , msg: " may only contain letters, (-), ('), (,) and (.).", format: "initcap" } //may only contain letters,  dashes(-), apostrophes(') and periods(.)."}
errorCodes[1] = {constraint : "cname" , re : "^[0-9a-z\\-\\.\\'\\s\\,\\&\\:]+$" , msg: " may only contain letters, numbers, (-), ('), (,), (&), (:) and (.).", format: "initcap" }
errorCodes[2] = {constraint : "usphone" , re : "^\\(?[2-9]\\d{2}[\\)\\s\\.-]?\\s?\\d{3}[\\s\\.-]?\\d{4}$" , msg: " may only be a US phone number<br /><span>&nbsp;e.g. (###) ###-####</span>", format: "usphone" }
errorCodes[3] = {constraint : "uszip" , re : "^\\d{5}(-?\\d{4})?$" , msg: " may only be a US zipcode<br /><span>&nbsp;e.g. #####-#### or #####</span>", format: "uszip" }
errorCodes[4] = {constraint : "address" , re : "^([0-9]{0,5}|[a-z])+[a-z\\d\\'\\.\\s\\/]*$" , msg: " may only contain letters and numbers.", format: "initcap" }
errorCodes[5] = {constraint : "city" , re : "^[a-zA-Z\\s]+$" , msg: " may only contain letters.", format: "initcap" }
errorCodes[6] = {constraint : "usstate" , re : "^(AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NB|NC|ND|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VT|WA|WI|WV|WY)$" , msg: " may only be a US state<br /><span>&nbsp;e.g. CA, NY, etc.</span>", format: "ucase" }
errorCodes[7] = {constraint : "email" , re : "^[a-z0-9]([a-z0-9_\\-\\.]*)@([a-z0-9_\\-\\.]*)(\\.[a-z]{2,3}(\\.[a-z]{2}){0,2})$" , msg: " may only be a valid email address<br /><span>&nbsp;e.g. john@foo.com</span>", format: "lcase" }
errorCodes[8] = {constraint : "checked" , re : "\\w" , msg: " is required field.  Please enter a value."}
errorCodes[9] = {constraint : "url" , re : "^([http|https|ftp]\\:\/\/)?((([a-z_0-9\\-]+)+(([\\:]?)+([a-z_0-9\\-]+))?)(\\@+)?)?(((((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))))|((([a-z0-9\-])+\\.)+([a-z]{2}\\.[a-z]{2}|[a-z]{2,4})))(([\\:])(([1-9]{1}[0-9]{1,3})|([1-5]{1}[0-9]{2,4})|(6[0-5]{2}[0-3][0-6])))?$" , msg: " may only be a valid URL.", format : "lcase"}
errorCodes[10] = {constraint : "numeric" , re : "^-?\\d\\d*\\.\\d*$)|(^-?\\d\\d*$)|(^-?\\.\\d\\d*$" , msg: " may only contain numbers."}
errorCodes[11] = {constraint : "integer" , re : "^-?\\d\\d*$" , msg: " may only contain numbers."}
errorCodes[12] = {constraint : "alphabetic" , re : "^[a-zA-Z]+$" , msg: " may only contain letters."}
errorCodes[13] = {constraint : "alphanumeric" , re : "^[a-zA-Z]+$" , msg: " may contain only letters and numbers."}

for(var i=0;i<errorCodes.length;i++){
	errorCodes[errorCodes[i].constraint] = errorCodes[i];
}

/************************************************
/		function isBlank(v)
/	
************************************************/

function isBlank(v){

	if(v.match(/^s+$/) || v == "") {return true;} return false;
	
}

/************************************************
/		function isSelectedGroup(obj, x)
/	
************************************************/

function isSelectedGroup(obj, x){

	var a = new Array;
	if(obj[0]){ // if not a group
		for(var i=0;i<obj.length;i++){
			if(obj[i].checked) {a.push(i);} 
		}
		if(a.length) {return a;} // returns array of checked indexes
		else {return false;}
	}
	else if(obj.checked) 
		{a.push(0); return a;}
	return false;
}




/************************************************
/		function copyFields(e)
/	
************************************************/

function copyFields(e){

	e = (e) ? e: event;
	var elem = (e.target) ? e.target : e.srcElement;
	if(elem.checked) {var checked = (elem.checked) ? true : false;}
	if(elem.id == 'click_mla'){
		if(isString(gObj('sla_address'))) {return;}
		if(checked){
			document.getElementById('mla_address').value = document.getElementById('sla_address').value;
			document.getElementById('mla_city').value = document.getElementById('sla_city').value;
			document.getElementById('mla_state').value = document.getElementById('sla_state').value;
			document.getElementById('mla_zip').value = document.getElementById('sla_zip').value;
		}
		else{
			document.getElementById('mla_address').value = "";
			document.getElementById('mla_city').value = "";
			document.getElementById('mla_state').value = "";
			document.getElementById('mla_zip').value = "";
		}	
	}
	if(elem.id == 'click_fax'){
		var pm = (document.getElementById('_dss3').checked) ? true : false;
		var fax = (pm) ? gObj('pmn_fphone') : gObj('cpn_fphone');
		if(fax && checked){
			document.getElementById('fax_fphone').value = fax.value;
		}
	}

}

/************************************************
/		allowEnter(e)
/	
************************************************/

function allowEnter(e){

	e = (e) ? e: event;
	var target = (e.target) ? e.target : e.srcElement;
	var charCode = (e.charCode) ? e.charCode : ((e.which) ? e.which : e.keyCode);
	if(charCode == 13 || charCode == 3){
		lookup('zipcode');
		return false;
	}
	
}

/************************************************
/		blockEnter(e)
/	
************************************************/

function blockEnter(e){

	e = (e) ? e: event;
	var charCode = (e.charCode) ? e.charCode : ((e.which) ? e.which : e.keyCode);
	if(charCode == 13 || charCode == 3){
		return false;
	}
	else{
		return true;
	}

}


/************************************************
/		formatting functions	
************************************************/

/************************************************
/		function format(value,constraint)
/	
************************************************/

function format(value,constraint){

	var formatted, f = (errorCodes[constraint].format) ? errorCodes[constraint].format : null;
	if(!f) {return;}
	var x = new String(value);
	x = x.trim();
	formatted = (f == 'initcap') ? formatInitCap(x) : ((f == 'usphone') ? formatUSPhone(x) : ((f == 'uszip') ? formatUSZip(x) : ((f == 'ucase') ? formatUpperCase(x) : ((f == 'lcase') ? formatLowerCase(x) : x))));
	return formatted;
	
}


/************************************************
/		function reformat(s)
/	
************************************************/

function reformat(s){ 

	var arg, pos=0, result="";
	for(var i=1; i<reformat.arguments.length; i++){
		arg = reformat.arguments[i]; 
		if(i%2==1) {result += arg;} 
		else{
			result += s.substring(pos, pos+arg); 
			pos += arg;
		} 
	} 
	return result;
	
}

/************************************************
/		function formatInitCap(s)
/	
************************************************/

function formatInitCap(s){

	var left, right, temp, temp2, i = 0, j = 1; len = s.length;
	while(i < s.length){
		temp = s.charAt(i); 
		temp2 = s.charAt(j)
		if(i == 0){
			temp = temp.toUpperCase(); 
			right = s.substring(j); 
			s = temp + right;
		}
		if(/^[\-\s\.]$/.test(temp) || (((j+1) < len) && /^[\']$/.test(temp) && /^[a-z]$/.test(temp2) &&  /^[\B]$/.test(s.charAt(j+1)))){
			temp2 = temp2.toUpperCase();
			left = s.substring(0,i); 
			right = s.substring(j + 1, len); 
			s = left + temp + temp2 + right;
		}
		 i++; 
		 j++;
	} 
	return s;
}



/************************************************
/		function formatLowerCase(s)
/	
************************************************/

function formatLowerCase(s){

	var tmp = s; 
	return tmp.toLowerCase();
	
}

/************************************************
/		function formatUpperCase(s)
/	
************************************************/

function formatUpperCase(s){

	var tmp = s; 
	return tmp.toUpperCase();
	
}

/************************************************
/		function formatUSZip(s)
/	
************************************************/

var bFiveOK = true; // if false, add "-0000" to 5-digit zip
function formatUSZip(s){
   
	var tmp = s.replace(/[^\d]/g,"");
	if(tmp.length == 5){
		return tmp = (bFiveOK) ? tmp : tmp + "-0000";
	}
	else if(tmp.length == 9){
		return reformat(tmp,"",5,"-",4);
	}
	else{
		return s;
	}
		
}

/************************************************
/		function formatUSPhone(s)
/	
************************************************/

function formatUSPhone(s){   

	var tmp = s.replace(/[^\d]/g,"");
	if(tmp.length == 10){
		return reformat(tmp,"(",3,") ",3,"-",4)
	} 
	else{
		return s;
	}
}

//-->