
var otxt = document.getElementsByName("optstxt");
var obox = document.getElementsByName("optsbox");
var optp = new Array();
var thul = new Array();
var thuh = new Array();
	optp[0] = 'assurance.asp';
	thul[0] = 'box_assu5er3.png';
	thuh[0] = 'box_assu5er3_hi.png';
	optp[1] = 'sec.asp';
	thul[1] = 'box_seccd7xz.png';
	thuh[1] = 'box_seccd7xz_hi.png';
	optp[2] = 'consulting.asp';
	thul[2] = 'box_busck4ac.png';
	thuh[2] = 'box_busck4ac_hi.png';
	optp[3] = 'accounting.asp';
	thul[3] = 'box_actghdoy.png';
	thuh[3] = 'box_actghdoy_hi.png';
	optp[4] = 'taxprep.asp';
	thul[4] = 'box_taxpjvc9.png';
	thuh[4] = 'box_taxpjvc9_hi.png';
	optp[5] = 'systems.asp';
	thul[5] = 'box_asysjkbx.png';
	thuh[5] = 'box_asysjkbx_hi.png';
	optp[6] = 'about.asp';
	thul[6] = 'box_aboupqw4.png';
	thuh[6] = 'box_aboupqw4_hi.png';
	
	optp[7] = 'function:login';
	optp[8] = 'careers.asp';

function makePage() {
	sw = document.body.clientWidth;
	sh = document.body.clientHeight;
	createInput('thispage',document.location);
	setTimeStamp();
	}

function optsHi(n) {
	otxt[n].className='optstexthi';
	if ( n < obox.length ) { 
		obox[n].src='./images/' + thuh[n];
		}
	}

function optsLo(n) {
	otxt[n].className='optstext';
	if ( n < obox.length ) { 
		obox[n].src='./images/' + thul[n];
		}
	}

function doOpt(n) {
	dn = optp[n]
	optsLo(n)
	if ( dn.indexOf("function:") == -1 ) {
		document.getElementById("mainForm").action = dn
		document.getElementById("mainForm").submit()
		}
	if ( dn.indexOf("function:") > -1 ) {
		nf = dn.substr(9)
		if ( nf == 'login' ) { doLogin() }
		}
	}
	
function doLogin() {
	document.getElementById("mainForm").action = 'login.asp'
	document.getElementById("mainForm").submit()
	}

function goHome() {
	document.getElementById("mainForm").action = 'home.asp'
	document.getElementById("mainForm").submit()
	}

function createInput(n,v,t,f) {
    if ( !v ) { v = ''; };
    if ( !t ) { t = 'hidden'; };
	if ( !f ) { f = 'mainForm'; };
	a = true;
	inp = document.getElementsByTagName('input');
		for (i=0; i<inp.length; i++ ) {
			if ( n == inp[i].name ) { a = false; inp[i].value = v; }
			}
	if ( a == true ) {
		cfo = document.getElementById(f);
		cel = document.createElement('input');
		cel.type = t; cel.name = n;	cel.id = n; cel.value = v;
		cfo.appendChild(cel);
		};
	};

function setTimeStamp() {
	tob = new Date();
	syr = padIt(tob.getFullYear(),4); smo = padIt(tob.getMonth()+1,2); sda = padIt(tob.getDate(),2);
	shr = padIt(tob.getHours(),2);    smi = padIt(tob.getMinutes(),2); sse = padIt(tob.getSeconds(),2); sms = tob.getMilliseconds();
	cfo = document.getElementById("mainForm");
	cel = document.createElement('input');	cel.type = 'hidden'; cel.name = 'timestmp';	cel.id = 'timestmp';
	cfo.appendChild(cel);
	cel = document.createElement('input');	cel.type = 'hidden'; cel.name = 'timeoffs';	cel.id = 'timeoffs';
	cfo.appendChild(cel);
	document.getElementById("timestmp").value = syr+smo+sda+shr+smi+sse;
	document.getElementById("timeoffs").value = tob.getTimezoneOffset();
	};

function trimIt(v) {
  while ( v.substr(v.length-1) == ' ' ) { v = v.substr(0, v.length-1) };
  while ( v.charAt(0) == ' ' ) { v = v.slice(1) };
  return v;
  }

function padIt(val,len) { v = val.toString(); while ( v.length < len ) { v = '0' + v }; return v };
