var OpC = new Array();
var ie,moz,css3; function startOpChange(elm,end,tim){
  ie = !!elm.filters;
  moz = elm.style.MozOpacity != undefined;
  css3 = elm.style.opacity != undefined;
  if (!ie && !moz && !css3)return;
  var idx = OpC.length;
  for(var i=0;idx>i;i++){
    if(OpC[i][0]==elm){
      clearInterval(OpC[i][4]);
      idx = i;
      break;
    }
    OpC[idx] = new Array();
  }
  if(idx==0)OpC[idx] = new Array();
  
  if(ie)actOp=elm.filters.alpha.opacity;
  else if(css3)actOp=(elm.style.opacity*100);
  else actOp=(elm.style.MozOpacity*100);
  if (actOp!=end){
    OpC[idx][0]=elm;
    OpC[idx][1]=actOp;
    OpC[idx][2]=end;
    OpC[idx][3]=(end>actOp)?1:-1;
    var delayTime = Math.floor((tim*100)/Math.abs((actOp-end)));
    OpC[idx][4]=setInterval("opChange("+idx+")",delayTime);
  }
}

function opChange(idx){
  OpC[idx][1]+=OpC[idx][3];
  if (ie)OpC[idx][0].filters.alpha.opacity=OpC[idx][1];
  else if(css3)OpC[idx][0].style.opacity=Math.min(0.99,OpC[idx][1]/100);
  else OpC[idx][0].style.MozOpacity=Math.min(0.99,OpC[idx][1]/100);
  if (OpC[idx][1]==OpC[idx][2]){
    clearInterval(OpC[idx][4]);
    return;
  }
}





	function verifyCompatibleBrowser(){
		this.ver = navigator.appVersion;
		this.dom = document.getElementById ? 1 : 0;
		this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0;
		this.ie4 = (document.all && !this.dom) ? 1 : 0;
		this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0;
		this.ns4 = (document.layers && !this.dom) ? 1 : 0;
		this.bw = (this.ie5 || this.ie4 || this.ns4 || this.ns5)
		return this
	}
	bw = new verifyCompatibleBrowser()
	var speed = 80
	var loop, timer
	function ConstructObject(obj, nest) {
		nest = (!nest) ? '' : 'document.' + nest + '.';
		this.el = bw.dom ? document.getElementById(obj) : bw.ie4 ? document.all[obj] : bw.ns4 ? eval(nest+'document.' + obj) : 0;
		this.css = bw.dom ? document.getElementById(obj).style : bw.ie4 ? document.all[obj].style : bw.ns4 ? eval(nest+'document.' + obj) : 0;
		this.scrollHeight = bw.ns4 ? this.css.document.height : this.el.offsetHeight;
		this.clipHeight = bw.ns4 ? this.css.clip.height : this.el.offsetHeight;
		this.up = MoveAreaUp;
		this.down = MoveAreaDown;
		this.MoveArea = MoveArea;
		this.x;
		this.y;
		this.obj = obj + "Object";
		eval(this.obj + " = this");
		return this;
	}
	function MoveArea(x,y) {
		this.x = x;
		this.y = y;
		this.css.left = this.x + 'px';
		this.css.top = this.y + 'px';
	}
	function MoveAreaDown(move) {
		if (this.y > ( (-1 * parseInt(this.scrollHeight)) + parseInt(objContainer.clipHeight) ) ) {
			this.MoveArea(0, this.y - move);
		if (loop)
			setTimeout(this.obj + ".down(" + move + ")", speed);
		}
	}
	function MoveAreaUp(move) {
		if (this.y < 0) {
			this.MoveArea(0, this.y - move);
			if (loop)
				setTimeout(this.obj + ".up(" + move + ")", speed);
		}
	}
	function PerformScroll(speed) {
		if(initialised) {
			loop = true;
			if (speed > 0)
				objScroller.down(speed);
			else
				objScroller.up(speed);
		}
	}
	function CeaseScroll() {
		loop = false;
		if (timer)
			clearTimeout(timer);
	}
	var initialised;
	function InitialiseScrollableArea() {
		objContainer = new ConstructObject('textholder');
		objScroller = new ConstructObject('text','textholder');
		objScroller.MoveArea(0,0);
		initialised = true;
		if (objScroller.y <= ( (-1 * parseInt(objScroller.scrollHeight)) + parseInt(objContainer.clipHeight) ) ) {
			if (bw.dom) {
				document.getElementById("textscrollup").style.visibility = 'hidden';
				document.getElementById("textscrolldown").style.visibility = 'hidden';
			}
			if (bw.ie4) {
				document.all["textscrollup"].style.visibility = 'hidden';
				document.all["textscrolldown"].style.visibility = 'hidden';
			}
			if (bw.ns4) {
				document.layers["textscrollup"].visibility = 'hidden';
				document.layers["textscrolldown"].visibility = 'hidden';
			}
		}
		else {
		}
		objContainer.css.visibility = 'visible';
		initialised = true;
	}
