/*viewer check*/
function lib_bwcheck(){
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom=document.getElementById?1:0
    this.opera5=this.agent.indexOf("Opera 5")>-1
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    return this
}
var bw=new lib_bwcheck();
/*dom*/
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
  	
	  this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
  	this.obj = document.all[name];
  	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
  	this.obj = getObjNN4(document,name);
  	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

/*scrolling object*/
var clipTop = 0;
var clipWidth = 440;
var clipBottom = 0;
var topper = 0;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;
function MyScroll(){
  this.clipTop = 0;
  this.clipWidth = 440;
  this.clipBottom = 0;
  this.topper = 0;
  this.lyrheight = 0;
}
MyScroll.prototype.setWidth = function(w){
  this.clipWidth = w;
}
MyScroll.prototype.setHeight = function(h){
  this.clipBottom = h;
}
MyScroll.prototype.setId = function(id){
  this.idName = id;
}
MyScroll.prototype.setObjName = function(name){
  this.objectname=name;
}
MyScroll.prototype.initialize = function(){

  this.DHTML = (document.getElementById || document.all || document.layers)
	if (!this.DHTML) return;	
	var x = new getObj(this.idName);
	
	if (document.layers)
	{
	
		this.lyrheight = x.style.clip.bottom;
		this.lyrheight += 20;
		x.style.clip.top = this.clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = this.clipWidth;
		x.style.clip.bottom = this.clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		this.lyrheight = x.obj.offsetHeight;
		this.lyrheight += 20;
		x.style.clip = 'rect('+this.clipTop+'px,'+this.clipWidth+'px,'+this.clipBottom+'px,0)';
	}
	
}
MyScroll.prototype.srollLayer = function(layername,amt,tim){
  if (!this.DHTML) return;
	this.thelayer = new getObj(layername);
	if (!this.thelayer) return;
	this.amount = amt;
	this.theTime = tim;
	this.realscroll();
}
MyScroll.prototype.realscroll = function(){
  if (!this.DHTML) return;
  
	this.clipTop += this.amount;
	this.clipBottom += this.amount;
	this.topper -= this.amount;
	//alert(this.clipBottom);
	//alert(this.lyrheight);
	if (this.clipTop < 0 || this.clipBottom > (this.lyrheight+130))
	{
		this.clipTop -= this.amount;
		this.clipBottom -= this.amount;
		this.topper += this.amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		this.clipstring = 'rect('+this.clipTop+'px,'+this.clipWidth+'px,'+this.clipBottom+'px,0)';
		this.thelayer.style.clip = this.clipstring;
		this.thelayer.style.top = this.topper + 'px';
	}
	else if (document.layers)
	{
		this.thelayer.style.clip.top = this.clipTop;
		this.thelayer.style.clip.bottom = this.clipBottom;
		this.thelayer.style.top = this.topper;
	}
	this.time = setTimeout('callScroll('+this.objectname+')',this.theTime);
}

MyScroll.prototype.stopScroll = function(){
  if (this.time) clearTimeout(this.time);
}

function callScroll(scrlFnc){
  eval(scrlFnc.objectname+'.realscroll()');
}

/*--- support for no js viewers ---*/
function getHeader(pMclass,pSclass,pId){
  document.write('<div class="'+pMclass+'">');
  document.write('<div id="'+pId+'"  class="'+pSclass+'">');
}
function getFooter(){
  document.write('</div></div>');
}
function getArrows(pId,pObject){
  document.write('<div class="arrows">');
  document.write('<span class="arrdown"><a href="#">UP</a><a href="#" class="arrds" onmouseover="'+pObject+'.srollLayer(\''+pId+'\',10,50)" onmouseout="'+pObject+'.stopScroll()">&nbsp;</a></span>');
  document.write('<span class="arrup"><a href="#">DOWN</a><a href="#" class="arrus" onmouseover="'+pObject+'.srollLayer(\''+pId+'\',-10,50)" onmouseout="'+pObject+'.stopScroll()">&nbsp;</a></span>');
  document.write('</div>');
}
/*--- form js ---*/
function InputValue(paEl,paValue){
  if(paEl.value=="")
    paEl.value=paValue;
}
function ClearInputValue(paEl,paValue){
  if(paEl.value==paValue)
    paEl.value='';
}

