var Title = _getVariable('Title', 'About Us');
function _size(){
	SetWidth = _setWidth();
	SetHeight = _setHeight();
	addLeft = _addLeft();
}
function _move(newLocation){
	window.location = newLocation;
}
function _getVariable(name, other){
	var fileName = location.href;
	var reg = /\+/g;
	if (fileName.indexOf('?') != -1) {
		allVariables = fileName.substring(fileName.indexOf('?')+1, fileName.length);
		allVariables = allVariables.replace(reg, " ");
		if (allVariables.indexOf(name) != -1) {
			nameToEnd = allVariables.substring(allVariables.indexOf(name)+name.length+1, allVariables.length);
			end = (nameToEnd.indexOf('&') != -1) ? nameToEnd.indexOf('&') : nameToEnd.length;
			nameVariable = nameToEnd.substring(0, end);
			return nameVariable;
		}
		return other;
	}
	return other;
}


//   DHTML SCROLLER v3.5
//   by Angus Turnbull 
//   http://www.twinhelix.com
//   Visit for more scripts!

var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isIE4=isIE&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isWin=navigator.platform.indexOf('Win')!=-1?1:0;
var isDyn=isDOM||isIE||isNS4;

function getRef(id, par)
{
 par=!par?document:(par.navigator?par.document:par);
 return isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null));
}

function getSty(id, par)
{
 var r=getRef(id, par);
 return r?(isNS4?r:r.style):null;
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par',
 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
 LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; ' +
  'with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');
LyrFn('w','if (p) (isNS4?sty.clip:sty).width=p+px; ' +
 'else return (isNS4?ref.document.width:ref.offsetWidth)');
LyrFn('h','if (p) (isNS4?sty.clip:sty).height=p+px; ' +
 'else return (isNS4?ref.document.height:ref.offsetHeight)');
LyrFn('vis','sty.visibility=p');
LyrFn('clip','if (isNS4) with(sty.clip){left=a[0];top=a[1];right=a[2];bottom=a[3]} ' +
 'else sty.clip="rect("+a[1]+"px "+a[2]+"px "+a[3]+"px "+a[0]+"px)" ');

var CSSmode=document.compatMode;
CSSmode=(CSSmode&&CSSmode.indexOf('CSS')!=-1)||isDOM&&!isIE||isOp?1:0;

if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!isOp,
 db: CSSmode?'documentElement':'body' }

page.winW=function()
 { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function()
 { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }

page.scrollY=function()
 { with (this) return MS?win.document[db].scrollTop:win.pageYOffset }

function scrLoad(fName) { with (this)
{
 if (!fName || !loaded || !isDyn) return;

 loadingFile = fName;
 if (onbeforeload) onbeforeload();

 if (loadingFile != history[histPos])
 {
  histPos++;
  history[histPos] = loadingFile;
  history.length = histPos + 1;
 }

 if (isIE || isDOM) with (bufRef.document)
 {
  write('<html><body onload="parent.' + myName + '.fileLoaded()">' +
   '<iframe name="nestBuf" src="' + fName + '"></iframe></body></html>');
  close();
  if (!bufRef.nestBuf || (isIE4 && !isWin))
  {
   bufRef.location.href = fName;
   setTimeout(myName + '.fileLoaded()', 5000);
  }
 }
 else if (isNS4)
 {
  if (window.ns4LayerLoading)
  {
   setTimeout(myName + '.load("' + fName + '")', 100);
   return;
  }
  window.ns4LayerLoading = true;

  div.ref.onload = new Function(myName + '.fileLoaded()');
  div.ref.load(fName, cWidth);
 }
}}

function scrFileLoaded() { with (this)
{
 activeScr = null;

 if (isNS4) window.ns4LayerLoading = false;

 if ((isDOM || isIE) && loadingFile)
 {
  var bufDoc = bufRef.nestBuf ? bufRef.nestBuf.document : bufRef.document;
  if (bufDoc && bufDoc.body) div.ref.innerHTML = bufDoc.body.innerHTML;
  bufRef.location.replace('about:blank');
 }

 loadedFile = loadingFile;

 setTimeout('with(' + myName + ') { scrollTo(0); if (onload) onload() }', 1);
}}

function scrGo(dir) { with (this)
{
 histPos += dir;
 if (histPos < 0) { histPos = 0; return }
 if (histPos >= history.length) { histPos = history.length - 1; return }
 load(history[histPos]);
}}

function scrScrollTo(pos, isStick) { with (this)
{
 if (!isDyn || !loaded) return;

 cTop = pos;

 if (!isStick) stickTop = cTop;

 divHeight = div.h() + padTop + padBot;
 if (divHeight == 0) divHeight = 1;

 if (checkBounds)
 {
  if (cTop + cHeight > divHeight) cTop = divHeight - cHeight;
  if (cTop < 0) cTop = 0;
 }

 div.y(eval(divs[0].y) - cTop + padTop);
 div.clip(0, cTop - padTop, cWidth, cTop - padTop + cHeight);

 thmHeight = Math.ceil(barHeight * (cHeight / divHeight));

 if (thmHeight < minThmHeight) thmHeight = minThmHeight;
 if (thmHeight > barHeight) thmHeight = barHeight;

 thm.h(thmHeight);

 if (onscroll) onscroll();

 if (activeScr || isStick) return;

 var fracDivDown = (cTop / (divHeight - cHeight));
 thm.y(bar.y() + fracDivDown * (barHeight - thmHeight));
}}

function scrScrollBy(amount) { with (this)
{
 scrollTo(cTop + amount);
}}

function scrSetScroll(newSpeed, steps) { with (this)
{
 if (!loaded) return;

 stepsLeft = steps;

 if (timer) clearInterval(timer);
 timer = setInterval('with (' + myName + ') { ' +
  'if (stepsLeft > 0) { ySpeed += ' + ((newSpeed-ySpeed)/steps) + '; stepsLeft-- } ' +
  'else if (parseInt(ySpeed)==0) {clearInterval(timer);timer=null} scrollBy(ySpeed) }', 50);
}}

function scrThumbDown(evt) { with (this)
{
 var evt = evt?evt:window.event;

 activeScr = this;

 dragOffset = (isNS4 ? evt.layerY : page.scrollY() + evt.clientY - thm.y());

 if (onthumbdown) onthumbdown();

 if (timer) clearInterval(timer);
 timer = null;

 return false;
}}

function scrThumbMove(evt)
{
 var evt = evt?evt:window.event;

 if (!activeScr) return true;
 else with (activeScr)
 {
  if ((cTop + cHeight > divHeight) || (thmHeight == barHeight)) return true;

  var thmTop = (isNS4 ? evt.pageY : page.scrollY() + evt.clientY) - dragOffset - bar.y();

  if (thmTop < 0) thmTop = 0;
  if (thmTop + thmHeight > barHeight) thmTop = barHeight - thmHeight;
  thm.y(bar.y() + thmTop);

  stickTop = (divHeight - cHeight) * (thmTop / (barHeight - thmHeight));

  if (stick == 1) scrollTo(stickTop);
  else if (!timer) timer = setInterval(myName + '.stickScroll()', 40);

  return false;
 }
}

function scrStickScroll() { with (this)
{
 if (Math.abs(cTop - stickTop) > 1)
 {
  cTop += (stickTop - cTop) * stick;
  scrollTo(cTop, true);
 }
 else if (cTop != stickTop)
 {
  cTop = stickTop;
  scrollTo(cTop, true);
 }
}}

function scrThumbUp(evt)
{
 if (activeScr) with (activeScr) if (onthumbup) onthumbup();

 activeScr = null;
}

function scrBarClick(evt) { with (this)
{
 var evt = evt?evt:window.event;

 clickPos = isNS4 ? evt.pageY : page.scrollY() + evt.clientY;

 if (clickPos < thm.y()) scrollBy(0 - cHeight);
 if (clickPos > (thm.y() + thmHeight)) scrollBy(cHeight);

 if (isNS4) return document.routeEvent(evt);
}}

function scrLayout() { with (this)
{
 if (!isDyn || !loaded) return;

 for (var i = 0; i < divs.length; i++) with (divs[i].lyr)
 {
  x(eval(divs[i].x)); w(Math.max(0,eval(divs[i].w)));
  if (i) { y(eval(divs[i].y)); h(Math.max(0,eval(divs[i].h))) }
 }

 barHeight = eval(divs[1].h);
 cWidth = eval(divs[0].w);
 cHeight = eval(divs[0].h);

 if (onlayout) onlayout();

 scrollBy(0);
}}

function scrSetup(defaultFile) { with (this)
{
 if (!isDyn) return;

 for (var i = 0; i < divs.length; i++)
  divs[i].lyr = getLyr(divs[i].id, eval(divs[i].par));

 div = divs[0].lyr;
 bar = divs[1].lyr;
 thm = divs[2].lyr;

 if (!isNS4) bufRef = eval('window.' + myName + 'Buf');

 if (isNS4)
 {
  bar.ref.captureEvents(Event.CLICK);
  thm.ref.captureEvents(Event.MOUSEDOWN);
 }

 bar.ref.onclick = new Function('evt', 'return ' + myName + '.barClick(evt)');
 thm.ref.onmousedown = new Function('evt', 'return ' + myName + '.thumbDown(evt)');

 var noSel = new Function('if (activeScr) return false');
 if (isIE) document.onselectstart = noSel;
 else if (isDOM) document.onselect = noSel;

 loaded = true;
 layout();
 if (onsetup) onsetup();

 var fileName = ''
 var URL = location.search.substring(1);
 if (URL)
 {
  URL = URL.split('&');
  for (var i = 0; i < URL.length; i++)
   if (URL[i].split('=')[0] == myName) fileName = unescape(URL[i].split('=')[1]);
 }

 if (fileName) load(fileName)

 else if (defaultFile) load(defaultFile);
 else fileLoaded();
}}

function addProps(obj, data, names, addNull)
{
 for (var i = 0; i < names.length; i++) if(i < data.length || addNull) obj[names[i]] = data[i];
}

function DHTMLScroller()
{
 var names = ['myName', 'bufRef', 'div', 'bar', 'thm', 'loaded', 'timer',
 'divHeight', 'thmHeight', 'barHeight', 'cHeight', 'cWidth', 'dragOffset',
 'onbeforeload', 'onload', 'onscroll', 'onsetup', 'onlayout', 'onthumbdown', 'onthumbup'];
 addProps(this, arguments, names, true);

 this.cTop = 0;

 this.loadingFile = '';
 this.loadedFile = '';

 this.history = new Array();
 this.histPos = -1;

 this.divs = new Array();

 this.minThmHeight = 20;
 this.padTop = 0;
 this.padBot = 0;
 this.checkBounds = true;

 this.ySpeed = this.stepsLeft = 0;

 this.stick = 1;
 this.stickTop = 0;

 this.load = scrLoad;
 this.fileLoaded = scrFileLoaded;
 this.go = scrGo;
 this.scrollTo = scrScrollTo;
 this.scrollBy = scrScrollBy;
 this.setScroll = scrSetScroll;
 this.thumbDown = scrThumbDown;
 this.stickScroll = scrStickScroll;
 this.barClick = scrBarClick;
 this.setup = scrSetup;
 this.layout = scrLayout;
}

function ScrDiv()
{
 addProps(this, arguments, ['id','x','y','w','h','par','lyr'], true);
}

var activeScr = null;

var mainDiv = new DHTMLScroller('mainDiv');

with (mainDiv)
{
 divs[0] = new ScrDiv('mainDivContent', '260', '190', 'page.winW() - 335', 'page.winH() - 280');
 divs[1] = new ScrDiv('mainDivBar', 'page.winW() - 25', '190', '15', 'page.winH() - 280');
 divs[2] = new ScrDiv('mainDivThumb', 'page.winW() - 24', '', '13', '');

 divs[3] = new ScrDiv('mainDivUpArrows', 'page.winW() - 25', '154', '', '');
 divs[4] = new ScrDiv('mainDivDownArrows', 'page.winW() - 25', 'page.winH() - 87', '', '');

 divs[5] = new ScrDiv('logo', '40', '90', '', '');
 divs[6] = new ScrDiv('logo2', 'page.winW() - 140', 'page.winH() - 33', '', '');
 divs[7] = new ScrDiv('tag', '35', 'page.winH() - 60', '', '');

 divs[8] = new ScrDiv('legal', '20', 'page.winH() - 20', '', '');
 divs[9] = new ScrDiv('copyright', '110', 'page.winH() - 20', '', '');
 divs[10] = new ScrDiv('contact', 'page.winW() - 120', '3', '', '');

 divs[11] = new ScrDiv('box', '243', '73', '','');
 divs[12] = new ScrDiv('title1', '260', '70', '', '');

 divs[13] = new ScrDiv('bgLeft_Top', '0', '0', '200', '20');
 divs[14] = new ScrDiv('bgLeft_Middle', '0', '20', '200', 'page.winH() - 30');
 divs[15] = new ScrDiv('bgLeft_Bottom', '0', 'page.winH() - 30', '200', '30');

 divs[16] = new ScrDiv('bgRight_Top1', '200', '0', 'page.winW() - 200', '20');
 divs[17] = new ScrDiv('bgRight_Top2', '200', '20', 'page.winW() - 200', '27');
 divs[18] = new ScrDiv('bgRight_Content', '200', '47', 'page.winW() - 200', 'page.winH() - 47');

 divs[19] = new ScrDiv('menu1', '27', '220', '', '');
 divs[20] = new ScrDiv('menu2', '27', '249', '', '');
 divs[21] = new ScrDiv('menu3', '27', '269', '', '');
 divs[22] = new ScrDiv('menu4', '27', '345', '', '');

 divs[23] = new ScrDiv('qed', '266', '214', 'page.winW() - 337', '');
 divs[24] = new ScrDiv('intro', '(0.5 * page.winW()) - 110', '120', '', '');

 page.minW = 670;
 page.minH = 480;
 
 onload = loadFunction;

 onlayout = thumbVis;
}

function loadFunction() { with (this)
{
 getSty('loadMessage').visibility = 'hidden';
 for (var i = 0; i < divs.length; i++) if (i != 2) divs[i].lyr.vis('visible');
 onlayout();
}}

function thumbVis() { with (this)
{
 divs[2].lyr.vis(div.h() > cHeight ? 'visible' : 'hidden');
}}

window.onload = function()
{
 mainDiv.setup('content/About.html');
}

window.onresize = function()
{
 ns4BugCheck();
 mainDiv.layout();
}

if (isNS4) document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);

document.onmousemove = function(evt)
{
 var ret = scrThumbMove(evt);
 return (ret ? (isNS4?document.routeEvent(evt):true) : false);
}

document.onmouseup = function(evt)
{
 scrThumbUp(evt);
 if (isNS4) return document.routeEvent(evt);
}

var nsWinW = window.innerWidth, nsWinH = window.innerHeight;
function ns4BugCheck()
{
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight))
 {
  var fileName = location.href;

  if (fileName.indexOf('?') != -1) fileName = fileName.substring(0, fileName.indexOf('?'));
  location.href = fileName + '?mainDiv=' + mainDiv.loadedFile;
 }
}

if (isIE) document.onmousewheel = function()
{
 mainDiv.scrollBy(event.wheelDelta / -3);
 return false;
}

