<!--
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 $$() {
  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 hide(obj){
	var all_obj=obj.split(',');
	for(ndx in all_obj){
		if(window.$(all_obj[ndx])){
			$(all_obj[ndx]).style.display="none";
		}
	}
}
function show(obj){
	var all_obj=obj.split(',');
	for(ndx in all_obj){
		if(window.$(all_obj[ndx])){
			$(all_obj[ndx]).style.display="block";
		}
	}
}
//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 autotab(obj,nxt,frm){
	var f=null;
	if (frm) {
		f=$(frm);
	} else {
		f=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 load_run(){
	var bpos=[];
	bpos['home']='18';
	bpos['about']='-85';
	bpos['services']='-202';
	bpos['contact']='-309';
	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;
//-->
