/****************************************************************************   
DHTML library from DHTMLCentral.com
*   Copyright (C) 2001 Thomas Brattli 2001
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by Thomas Brattli 2001
***************************************************************************/

function cm_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.op5=this.agent.indexOf("opera 5")>-1 && window.opera
	this.op6=this.agent.indexOf("opera 6")>-1 && window.opera
	this.ie55 = (!this.op5 && !this.op6 && this.agent.indexOf("msie 5.5")>-1)
	this.ie5 = (!this.ie55 && !this.op5 && !this.op6 && this.agent.indexOf("msie 5")>-1)
	this.ie6 = (!this.op5 && !this.op6 && this.agent.indexOf("msie 6")>-1)
	this.ie4=(!this.op5 && !this.op6 && !this.ie5 && !this.ie55 && !this.ie6 && this.agent.indexOf("msie")>-1 && document.all)
	this.ie = (this.ie6 || this.ie55 || this.ie5 || this.ie4)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie6 || this.ie55 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
	this.usedom= this.ns6//Use dom creation
	this.reuse = this.ie||this.usedom //Reuse layers
	this.px=this.dom&&!this.op5?"px":""
    this.safari=(this.agent.indexOf("safari")>-1)
    return this
}
var bw=(bw?bw:(new cm_bwcheck()));

/***Creating layers**/
function cm_divCreate(id,cl,txt,w,c,app,ex,txt2,sty){
	if(bw.usedom){
		var div=document.createElement("DIV");
		if(sty) div.STYLE=sty;
		if(cl)	div.className=cl;
		div.id=id;
		if(txt) div.innerHTML=txt;
		if(app){
			app.appendChild(div);
			return div
		}
		if(w) document.body.appendChild(div);
		return div
	} else {
		var dstr='<div id="'+id+'"';
		if(sty) dstr+=' style="'+sty+'"';
		if(cl) dstr+=' class="'+cl+'"';
		if(ex&&bw.reuse) dstr+=" "+ex;
		dstr+=">"+txt;
		if(txt2) dstr+=txt2;
		if(c) dstr+='</div>';
		if(w) document.write(dstr);
		else return dstr
	}
	return ""
}

function _getPageOffsetLeft(objElement){
	var objLeft;
	if(bw.ns4){
		objLeft=objElement.pageX;
	} else {
		objLeft=objElement.offsetLeft;
		while((objElement=objElement.offsetParent)!=null){
			objLeft+=objElement.offsetLeft;
		}
	}
	return objLeft;
}

function _getPageOffsetTop(objElement){
	var objTop;
	if(bw.ns4){
		objTop=objElement.pageY;
	} else {
		objTop=objElement.offsetTop;
		while((objElement=objElement.offsetParent)!=null){
			objTop+=objElement.offsetTop;
		}
	}
	return objTop;
}
/***Pageobject **/
function cm_page(){
	this.x=0;
	this.x2 =(!bw.ie)?window.innerWidth:document.body.offsetWidth-24;
	this.y=0;
	this.orgy=this.y2= (!bw.ie)?window.innerHeight:document.body.offsetHeight-6;
	this.x50=this.x2/2;
	this.y50=this.y2/2;
	this.scrX=0;
	this.scrY=0;
	return this
}
cm_page.prototype.scrollX = function (set) {
	if (!bw.ie) var scrx=self.pageXOffset;
	else var scrx=document.body.scrollLeft;
	if(set) this.scrX=scrx;
	return scrx;
}
cm_page.prototype.scrollY = function (set) {
	if (!bw.ie) var scry=self.pageYOffset;
	else var scry=document.body.scrollTop;
	if(set) this.scrY=scry;
	return scry;
}
cm_page.prototype.scrolled = function () {
	var newy=this.scrollY();
	if(this.scrY!=newy){
		this.scrY=newy;
		return true;
	}else{
		var newx=this.scrollX();
		if(this.scrX!=newx){
			this.scrX=newx;
			return true;
		} else return false;
	}
}

var cmpage,cm_onresizeE,cm_posCheckE,cm_onscrollE,cm_onloadE,cm_vertw,cm_horih

function cm_makeObj(obj,nest,o) {
	if(bw.usedom&&o) this.evnt=o
	else {
		nest=(!nest) ? "":'document.layers.'+nest+'.'
		this.evnt=bw.dom? document.getElementById(obj):
		(bw.ie4||bw.ie5)? document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;
	}
	if(!this.evnt) return null;
	this.css=(bw.dom||bw.ie4||bw.ie5)?this.evnt.style:this.evnt;
	this.ok=0
	this.ref=(bw.dom||bw.ie4||bw.ie5)?document:this.css.document;
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	this.x=0;
	this.y=0;
	this.w=0;
	this.h=0;
	this.vis=0;
	return this
}

cm_makeObj.prototype.moveIt = function(x,y) {
	this.x=x;this.y=y; this.css.left=x+bw.px;this.css.top=y+bw.px
}

cm_makeObj.prototype.showIt = function(o) {
	if(bw.ns4){
		this.css.visibility="show"
	} else {
		this.css.visibility="visible";
	}
	this.vis=1;
	if(bw.op5&&this.arr) this.arr.showIt();
}

cm_makeObj.prototype.hideIt = function(no) {
	if(bw.ns4){
		this.css.visiblity="hide";
	} else {
		this.css.visibility="hidden";
	}
	this.vis=0;
}

cm_makeObj.prototype.clipTo = function(t,r,b,l,setwidth) {
	this.w=r;
	this.h=b;
	if(bw.ns4){
		this.css.clip.top=t;
		this.css.clip.right=r;
		this.css.clip.bottom=b;
		this.css.clip.left=l
	} else {
		if(t<0)t=0;
		if(r<0)r=0;
		if(b<0)b=0;
		if(b<0)b=0;
		this.css.clip="rect("+t+bw.px+","+r+bw.px+","+b+bw.px+","+l+bw.px+")";
		if(setwidth){
			if(bw.op5||bw.op6) {
				this.css.pixelWidth=r;
				this.css.pixelHeight=b;
			} else {
				this.css.width=r+bw.px;
				this.css.height=b+bw.px;
			}
		}
	}
}
cm_makeObj.prototype.getLeft = function() {
	if(bw.dom||bw.ns4){
		var left=this.css.left;
	} else {
		var left=this.css.pixelLeft
	}
	if(!left||left == ""){
		this.x=0;
	} else {
		this.x=parseInt(left);
	}
	return this.x;
}
cm_makeObj.prototype.getTop = function() {
	if(bw.dom||bw.ns4){
		var top=this.css.top;
	} else {
		var top=this.css.pixelTop;
	}
	if(!top||top == ""){
		this.y=0;
	} else {
		this.y=parseInt(top);
	}
	return this.y;
}
cm_makeObj.prototype.getWidth = function() {
	if(bw.dom){
		this.w=this.evnt.offsetWidth;
	} else if(bw.ns4){
		this.w=this.evnt.clip.width;
	} else {
		var borderL=parseInt(this.css.borderLeftWidth);
		var borderR=parseInt(this.css.borderRightWidth);
		return (this.evnt.clientWidth + borderL + borderR);
	}
	return this.w;
}
cm_makeObj.prototype.getHeight = function() {
	if(bw.dom){
		this.h=this.evnt.offsetHeight;
	} else if(bw.ns4){
		this.h=this.evnt.clip.height;
	} else {
		var borderT=parseInt(this.css.borderTopWidth);
		var borderB=parseInt(this.css.borderBottomWidth);
		return (this.evnt.clientHeight+borderT+borderB);
	}
	return this.h;
}
cm_makeObj.prototype.setWidth = function(width) {
	if(bw.ns4){
		if(width>-1){
			this.css.resizeTo(width,this.evnt.clip.height);
			this.w=width;
		}
	} else {
		if(width==1) {
			//this removes the width from the object for issue95796
			this.css.width=1;
			if(this.getWidth()==1){
				width=null;
			}else{
				this.w=width;
				width+=bw.px;
			}
		} else if(width>-1){
			this.w=width;
			width+=bw.px;
		}
		this.css.width=width;
	}
	// needs to set height in order to get the correct width in netscape
	if((bw.ns4||bw.ns6) && !this.getWidth() && !this.getHeight()) this.setHeight("1px");
}
cm_makeObj.prototype.setHeight = function(height) {
	if(bw.ns4){
		if (height>-1) {
			this.css.resizeTo(this.evnt.clip.width,height);
			this.h=height;
		}
	} else {
		if (height>-1) {
			this.h=height;
			height+=bw.px;
		}
		this.css.height=height;
	}
}
cm_makeObj.prototype.setTop = function(top) {
	this.css.top=top;
	this.y=top;
}
cm_makeObj.prototype.setLeft = function(left) {
	this.css.left=left;
	this.x=left;
}
cm_makeObj.prototype.setCssClass = function(classname) {
	this.evnt.className=classname;
}

IE = bw.ie

function appendToHandler(sHandler,sFunctions) {
	var srcObj = (IE) ? document.body : window;
  var evHandlerFunc = new Function(sFunctions); // create a function from the string of statements we were given
  if(typeof srcObj[sHandler] != "undefined" && srcObj[sHandler] != null ) {
    // need to wrap the existing function
    var existingFunc = srcObj[sHandler];
    
    
    srcObj[sHandler] = function() {
      existingFunc();
      evHandlerFunc();
    }
  } else {
    srcObj[sHandler] = evHandlerFunc;
  }
} 
