/* ----------------------------------------------------------------------------------------------------- */
/* All intellectual property rights relating to this code are owned by Jared Newbold (jared@newbold.net) */
/* ----------------------------------------------------------------------------------------------------- */

document.js = true;

var NS4=(document.layers)?1:0; var IE=(document.all)?1:0;
var NS6=((document.getElementById)&&(navigator.appName=='Netscape'))?1:0;
var DHTML=(IE||NS4||NS6)?1:0;
var Mac=(navigator.userAgent.indexOf('Mac')!=-1)?1:0;
var IEMac=(Mac&&IE)?1:0;
var IE4Mac=(IEMac&&(navigator.appVersion.indexOf('4.',4)!=-1))?1:0;
var IE5Mac=(IEMac&&(navigator.appVersion.indexOf('5.')!=-1))?1:0;

//******* Rollover Functions ********//
var cacheArray=new Array(0);
function imageGroup() {  if (this.total==null) { this.add=imageGroup; this.hasLoaded=hasLoaded; this.loadList=new Object(); if (!document.images) return; this.total=this.cached=this.rollovers=0; this.names=new Array(0); this.urls=new Array(0); this.count=new Array(0); this.i=new Object(); this.index=cacheArray.length; cacheArray[this.index]=this; this.defURL=''; } var a,j,k,args=arguments; for (j=0; j<args.length; j++) { k=this.total; a=args[j].split('|'); this.names[k]=a[0]; this.urls[k]=this.defURL+a[1]; this.total++; } }
function hasLoaded(who) { return(this.loadList[who]?true:false); }
function loadImages() { if (document.images) { var j,c=cacheArray; for (j=0; j<c.length; j++) loadGroup(c[j]); } }
function loadGroup(obj,pre) { if (obj.loaded) return; obj.loaded=1; var k,img,stuff=''; for (k=0; k<obj.total; k++) { img=obj.i[obj.names[k]]=new Image(); if (!NS4) { img.group=obj.index; img.num=k; img.onload=countImg; } if (NS4) { stuff+='<IMG SRC="'+ obj.urls[k] +'" BORDER="0" ONLOAD="countImg('+obj.index+','+k+');"><BR>'; } img.src=obj.urls[k]; } if (NS4) { if (pre) { document.newLayer('cacher'+obj.index,stuff,0); } else { var cacher=new Layer(0),c=cacher.document; c.write(stuff); c.close(); } } }
function countImg(n,k) { if (!NS4) {n=this.group; k=this.num;} var obj=cacheArray[n]; if (obj.count[k]!=1) { obj.count[k]=1; obj.loadList[obj.names[k]]=1; obj.cached++; if (obj.cached==obj.total) {obj.rollovers=1; if (obj.onload) eval(obj.onload);} } }
function swapImg(obj,who,n) { var img=document[who+'_bttn']; if ((obj.rollovers)&&(img)) {img.src = obj.i[who+((n)?'_on':'_off')].src;} }
//***********************************//

//******* DHTML Functions ********// 

layers = new Object(); layers.EQ=new Array();
hidden=(NS4)?'hide':'hidden'; visible=(NS4)?'show':'visible';
ymargin=0; xmargin=0;

var ns6FixObj=new Object(); 
function ns6Fix() { var l,i; for (i in ns6FixObj) { l=layers[i]; if (l) { l.style.visibility=hidden; l.style.left=ns6FixObj[i].left; } } ns6FixObj=new Object();  }

function getLayer(spec,base) { if (!NS4) return getIt(spec); var j=0,temp=null; if (!base) base=document; if (base.layers[spec]) return base.layers[spec]; for (j=0; j<base.layers.length; j++) { temp=getLayer(spec,base.layers[j].document); if (temp) return temp; } return null; }
function equalizeLayers(n) { var k,l; var list=(n==null)?layers.EQ:arguments; var a=new Array(); for (k=0; k<list.length; k++) {l=getLayer(list[k]); if(l) { equalize(l); } else { a[a.length]=list[k]; } } if (n==null) layers.EQ=a; }
function getIt(id) { if (IE) return document.all[id]; if (NS6) return document.getElementById(id); }
function getIy(img) {if (IE4Mac) return(parseXY(img)); return(img[(NS4)?'y':'offsetTop']+((NS6)?NS6offY:(IE5Mac)?ymargin:0));}
function getIx(img) {if (IE4Mac) return(parseXY(img,'X')); return(img[(NS4)?'x':'offsetLeft']+((NS6)?NS6offX:(IE5Mac)?xmargin:0));}
function parseXY(who,n) {var val=0; var num=who[(n=='X')?'offsetLeft':'offsetTop']; if(num)val+=num;  var oP=who.parentElement; if (oP) val+=parseXY(oP,n); return(val); }
var NS6offX=0, NS6offY=0;

function equalize(layer) { if (layers[layer.id]) return;
  layer.getTop = new Function("return(parseInt(this.style.top))");
  layer.getLeft = new Function("return(parseInt(this.style.left))");
  layer.getHeight = new Function("if (IE) return this.scrollHeight; if (NS4) return this.document.height; if (NS6) return this.offsetHeight;");
  layer.getWidth = new Function("if (IE) return this.scrollWidth; if (NS4) return this.document.width; if (NS6) return this.offsetWidth;");
  layer.fade = new Function("o","if (IE) {this.style.filter='alpha(opacity='+o+')';} return(this);");
  layer.setClip = new Function ("l","t","r","b","if (NS4) {this.clip.left=l; this.clip.top=t; this.clip.right=r; this.clip.bottom=b;} else { this.style.clip='rect('+t+' '+r+' '+b+' '+l+')'; } /*this.style.overflow='hidden';*/  return(this);");
  layer.rewrite = new Function ("html","if (IE||NS6) this.innerHTML=html; if (NS4) {this.document.write(html); this.document.close();}  return(this);");
  layer.vis = new Function("n","if (n!=null) { this.style.visibility=(n)?visible:hidden; if (NS6) {this.style.zIndex=(n)?this.z:eval(this.z)-1;} } return((this.style.visibility==visible)?1:0);");
  layers[layer.id]=layer; if (NS4)layer.style=layer; if (NS6) { layer.z=layer.style.zIndex; if(layer.style.visibility==hidden)layer.vis(0); } }

function layerTag(id,content,vis,z,l,t,w,h,extra,es) { if (!DHTML) return(''); layers.EQ[layers.EQ.length]=id; if(w==0)w=1; if(!t)t=0; if(!l)l=0; if ((vis==null)||(vis==1))vis=visible; if(vis==0)vis=hidden; if(!z)z=10; if(!extra)extra=''; if(!es)es='';  if ((NS6)&&(vis==hidden)) { ns6FixObj[id]=new Object(); ns6FixObj[id].left=l; l=l-1000; vis=visible; }
  if (!NS4) {var stuff = '<DIV ID="'+id+'" STYLE="position:absolute; left:'+l+'px; top:'+t+'px;'+((w)?(' width:'+w+((isNaN(w))?'':'px')+';'):'')+((h)?(' height:'+h+((isNaN(h))?'':'px')+';'):'')+' visibility:'+vis+'; z-index:'+z+'; '+es+'" '+extra+'>'; }
  if (NS4)  {var stuff = '<LAYER NAME="'+id+'" left="'+l+'" top="'+t+'"'+((w)?(' width="'+w+'"'):'')+((h)?(' height="'+h+'"'):'')+' visibility="'+vis+'" z-index="'+z+'" '+extra+'>'; } return (stuff+content+((NS4)?'</LAYER>':'</DIV>')); }

function writeLayer(id,content,vis,z,l,t,w,h,extra,es) { this.writeln(layerTag(id,content,vis,z,l,t,w,h,extra,es)); equalizeLayers(); return(layers[id]); }
if (DHTML) document.newLayer=writeLayer;

function IMG(url,w,h,ex) { return('<IMG SRC="'+'/_app/i/'+url+'" WIDTH="'+((w)?w:1)+'" HEIGHT="'+((h)?h:1)+'" BORDER="0"'+((ex)?' '+ex:'')+'>'); }
function spacer(w,h,ex) {return(IMG('spacer.gif',w,h,ex));}

//*******************************// 

var menus=new Array(); var curMenu=null; var defButton=''; var curButton=defButton;
function addMenu(id) { var o=new Object(); o.id=id; o.links=new Array(); var j,a; for (j=1; j<arguments.length; j++) {a=arguments[j].split('|'); var l=o.links[o.links.length]=new Object(); l.name=a[0]; l.url=a[1]; l.submenu=a[2]; } menus[menus.length]=o; }
function addSubMenu(id) { var o=new Object(); o.id=id; o.SM=1; o.links=new Array(); var j,a; for (j=1; j<arguments.length; j++) {a=arguments[j].split('|'); var l=o.links[o.links.length]=new Object(); l.name=a[0]; l.url=a[1]; l.submenu=a[2]; } menus[menus.length]=o; }

var menuTimer=setTimeout('',10); var menuOn=0; var navOn=0; var navReady=0;
var submenuTimer=setTimeout('',10); var curSubMenu=null
function showMenu(id,left) { if (!navReady)return; swapButton(id); clearTimeout(menuTimer); if (navOn) { showMenu2(id,left); return; } menuTimer=setTimeout('showMenu2(\''+id+'\','+left+')',250); }
function swapButton(id) { return;
  if (id==curButton)return;
  if (curButton) document.images['nav_'+curButton].src=navPics.i[curButton].src; curButton=null;
  var img=document.images['nav_'+id]; if (!img)return;
  if (img) img.src=navPics.i[id+'_on'].src
  curButton=id;
}
function showMenu2(id,left,d) {
  if (id==curMenu)return;
  showSubMenu2('');
  if (curMenu) { var M=layers['menu_'+curMenu]; M.vis(0); M.bg.vis(0); curMenu=null; menuOn=0; if (d)swapButton(''); }
  var M=layers['menu_'+id]; if (!M)return;
  M.style.left=left; M.bg.style.left=left;
  M.bg.vis(1); M.vis(1);
  curMenu=id; menuOn=1; navOn=1;
}
function hideMenu() { if (!navReady)return; if (!menuOn)swapButton(''); clearTimeout(menuTimer); menuTimer=setTimeout('navOn=0; showMenu2(\'\',0,0,1)',1000); }

function showSubMenu(id) { if (!navReady)return; clearTimeout(menuTimer); clearTimeout(submenuTimer); submenuTimer=setTimeout('showSubMenu2(\''+id+'\')',250); }
function showSubMenu2(id) {
  if (id==curSubMenu)return;
  if (!curMenu)return;
  if (curSubMenu) { var M=layers['menu_'+curSubMenu]; M.vis(0); M.bg.vis(0); curSubMenu=null; }
  var M=layers['menu_'+id]; if (!M)return;
  var PM=layers['menu_'+curMenu];
  M.style.left=PM.getLeft()+100; M.bg.style.left=PM.getLeft()+100;
  M.bg.vis(1); M.vis(1);
  curSubMenu=id;
}
function hideSubMenu() { clearTimeout(submenuTimer); submenuTimer=setTimeout('showSubMenu2(\'\',0,0,1)',1000); }


function highlight(lid) { /*document.all['bgcell_'+lid].bgColor='#000000';*/ document.all['link_'+lid].className='dmenuon'; }
function unhighlight(lid) { /*document.all['bgcell_'+lid].bgColor='';*/  document.all['link_'+lid].className='dmenu'; }


function genMenu(M,bg) {
  var k,L;
  var build=''
  + '<table border="0" cellpadding="0" cellspacing="0" width="95">'
  + '<tr><td height="6"></td></tr>'

  for (k=0; k<M.links.length; k++) { L=M.links[k]; var lid=M.id+'_'+k; 
    build+=''
    + '<tr><td '+((bg)?'id="bgcell_'+lid+'"':'onmouseover="highlight(\''+lid+'\');'+((L.submenu)?' showSubMenu(\''+L.submenu+'\',0);':'')+'" onmouseout="unhighlight(\''+lid+'\');'+((L.submenu)?' hideSubMenu();':'')+'" class="hand" '+((L.url=='*')?'':'onclick="top.location=\''+L.url+'\'"'))+'>'
    + '<table border="0" cellpadding="0" cellspacing="0">'
    + '<tr><td height="2"></td></tr>'
    + '<tr><td><img src="/i/s.gif" width="10" height="1" alt=""/></td><td width="100%" class="dmenu'+((bg)?'bg':'')+'"><a '+((bg)?'':'id="link_'+lid+'" ')+'href="'+((L.url=='*')?'javascript://':L.url)+'" class="dmenu">'+L.name+'</a></td>'+((L.submenu)?'<td><img src="/i/header/navarrow.gif" width="9" height="9" alt=""/></td>':'')+'<td><img src="/i/s.gif" width="5" height="1" alt=""/><td></tr>'
    + '<tr><td height="2"></td></tr>'
    + '</table>'
    + '</td></tr>'
  }

  build+=''
  + '<tr><td height="6"></td></tr>'
  + '</table>'

  if (bg) { build='<table border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#000000">'+build+'</td></tr></table>'; }

  return(build);

}

function buildMenus() {
  var menuY=88;
  var j,M;
  for (j=0; j<menus.length; j++) { M=menus[j];
    var Menu=document.newLayer('menu_'+M.id, genMenu(M) ,0,2,0,menuY+((M.SM)?5:0),null,null,'onmouseover="'+((M.SM)?'showSubMenu':'showMenu')+'(\''+M.id+'\')" onmouseout="'+((M.SM)?'hideSubMenu(); ':'')+'hideMenu()"');
    var Menubg=document.newLayer('menubg_'+M.id, genMenu(M,1) ,0,1,0,menuY+((M.SM)?5:0)).fade(75);
    Menu.SM=M.SM;
    Menu.bg=Menubg;
  }

  navReady=1;
}


function viewLarger(url,name,w,h) {
  var win=window.open(null,name,'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+'');
  var build=''
  + '<html>'
  + '<head><title>View Larger</title></head>'
  + '<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">'
  + '<table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="'+url+'" width="'+w+'" height="'+h+'"/></td></tr></table>'
  + '</body>'
  + '</html>'
  win.document.write(build)
  win.document.close();
}

function popWin(url,name,w,h,s) {
  var win=window.open(url,name,'toolbar=0,scrollbars='+s+',location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+'');
  if (window.focus)win.focus();
  //win.resizeTo(w,h);
}

function sizingChart() {
  var win=window.open('/chart.asp','sizingChart','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=680,height=535');
  if (window.focus)win.focus();
}

function BYOA() {
  var win=window.open('/byoa/index.asp?rnd='+((new Date()).getTime()),'byoa','toolbar=1,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=460');
  if (window.focus)win.focus();
}


