<!--
var browser=navigator.appName;
if(browser=="Microsoft Internet Explorer")browser="IE";
if(browser=="IE"){
	var browser_v=navigator.appVersion;
	var ver=browser_v.substring(browser_v.indexOf('MSIE')+5,browser_v.indexOf('MSIE')+6)
}
function $() {
  return document.getElementById(arguments[0]);
}
function $$() {
	if(arguments.length=='2') return $(arguments[1]).getElementsByTagName(arguments[0]);
	return document.getElementsByTagName(arguments[0]);
}
function c_el(typ,atr,txt){
	if(browser!="IE")ele=document.createElement(typ);
	for(ik in atr){
		if(browser!="IE"){
			ele.setAttribute(ik,atr[ik]);
		}else{
			typ+=' '+ik+'="'+atr[ik]+'"';
		}
	}
	if(browser=="IE")ele=document.createElement('<'+typ+'>');
	if(txt)ele.innerHTML=txt;
	return ele;
}
function win_pop(x){
	win_=window.open(x,'',"width=620,height=600,toolbar=no,status=yes,resizable=yes,scrollbars=yes,location=no");
	win_.focus();
}
function popUp(URL,w,h) {
	window.open(URL, 'pop', "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+ w +",height="+ h +",left = 420,top = 225');");
}
function hide(obj){
	ch_disp(obj,0);
}
function show(obj){
	ch_disp(obj,1);
}
function ch_disp(obj,x){
	if(typeof obj == 'string'){
		var obj=obj.split(',');
		for(sh in obj){ if(window.$(obj[sh]))$(obj[sh]).style.display=x?"block":"none"; }
	}else if(typeof obj == 'object' && obj.style){
		obj.style.display=x?"block":"none";
	}
}
//Key code for autotab to prevent usability issues with TAB key.
document.onkeydown=function(e){
	window.document.key_id=window.event ? event.keyCode : e.keyCode;
	if(window.timer<30) timer=30;
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
function empty(obj,min_,max_){
	obj.value=obj.value.trim();
	if(max_ && obj.maxLength!=obj.value.length)return 1;
	return min_ ? (obj.value.length<min_?1:0):obj.value.length?0:1;
}
function autotab(obj,nxt,frm){
	var f=frm?$(frm):document.forms[0];
	if(obj.value.length==obj.maxLength){
		if(window.document.key_id && window.document.key_id!=8 && window.document.key_id!=9 && window.document.key_id!=16){
			f[nxt].focus();
			return false;
		}
	}
}
function force_numeric(obj){
	obj.value=obj.value.replace(/[\D]/g,"");
}
function valid_email(addr) {
	var filter = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	return filter.test(addr);
}
window.onunload=function(){
	if(window.leaving_pop==true){
		window.open("/pop/leaving.html?pg="+window.location.href,'Leaving',"width=348,height=325,toolbar=no,status=no,resizable=no,scrollbars=no,location=no");
	}
}
function url_encode(val){
	var out='';
	var x=0;
	val=val.toString();
	var regex = /(^[a-zA-Z0-9\-_\.]*)/;
	while(x<val.length){
		var chr=regex.exec(val.substr(x));
		if(chr!= null && chr.length>1 && chr[1]!=''){//<
			out+=chr[1];
			x+=chr[1].length;
		}else	if(val[x]==' '){
			out+='+';
			x++;
		}else{
			var charCode=val.charCodeAt(x);
			var hexVal=charCode.toString(16);
			out+='%'+(hexVal.length<2 ? '0' : '')+hexVal.toUpperCase();
			x++;
		}
	}
	return out;
}
function setCookie(c_name,value,expiredays){
	//var exdate=new Date();
	//exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+"="+escape(value)+'; path=/';
}
function getCookie(c_name){
	if (document.cookie.length>0){//<
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){
			return true;
		}
	}
	return false;
}
function load_run(){
	var bpos=[];
	bpos['our_services']=bpos['become_an_affiliate']=bpos['oa_overview']='0';
	bpos['oa_become_an_affiliate']='-52';
	bpos['employment']='-71';
	bpos['refer_a_client']='-111';
	bpos['affiliates']='-139';
	bpos['oa_resource_center']='-163';
	bpos['contact_info']='-194';
	bpos['contact_us']='-191';
	bpos['oa_contact_us']='-256';
	var anch = document.getElementsByTagName('div');
	for(i in anch){
		var dv=anch[i];
		if(dv.className=='bounce' || dv.className=='bouncy'){
			var a=dv.getElementsByTagName('a')[0];
			a.b=dv.getElementsByTagName('b')[0];
			a.cname=dv.className;
			if(a.cname=='bouncy'){
				a.lpos=bpos[dv.id];
			}else{
				a.lpos=0;
			}
			a.btop=5;
			a.itop=0;
			a.pid=dv.id;
			a.bounce_it=a.b_state=a.bdir=a.pos=0;
			a.tmo=[5,4,3,2];
			a.wt=150;
			a.bounce_fun=function(){
				this.p_check=Math.abs(this.pos);
				if(this.bounce_it){
					if(this.p_check<this.tmo[0]){
						this.b_state=0;
						this.bdir=-1;
					}else{
						this.bdir=0;
					}
				}else if((this.b_state<this.tmo.length && this.bdir!=0) || this.pos){
					if(this.bdir==0)this.bdir=-1;
					if(this.p_check==this.tmo[this.b_state]){
						this.bdir*=-1;
					}
					if(this.pos==0){
						this.b_state++;
						this.bdir*=-1;
					}
				}
				if(this.b_state==this.tmo.length){
					this.pos=this.b_state=this.bdir=0;
					//this.stat='stupid';
				}
				this.pos+=this.bdir;
				this.bpos=this.btop+this.pos;
				this.ipos=this.itop+this.pos*-1;
				this.style.backgroundPosition=this.lpos+'px '+this.bpos+'px';
				this.b.style.backgroundPosition=this.lpos+'px '+this.ipos+'px';
				//$('status').innerHTML=this.stat;
				this.wt=Math.ceil(this.wt/(this.tmo[this.b_state]+1)*(Math.abs(this.pos)+1));//wait time
				setTimeout("$('"+this.pid+"').getElementsByTagName('a')[0].bounce_fun()",this.wt);
			}
			a.no_bounce=function(){
				this.bounce_it=0;
			}
			a.bounce=function(){
				this.bounce_it=1;
			}
			a.onmouseover=a.bounce;
			a.onmouseout=a.no_bounce;
			a.bounce_fun();
		}
	}
}

window.onload=load_run;
//-->
