/* core.js
 * CBE v4.20, Cross-Browser DHTML API from Cross-Browser.com
 * Copyright (c) 2002 Michael Foster (mike@cross-browser.com)
 * Distributed under the terms of the GNU LGPL from gnu.org
 *
 * Adapted and optimized by Juerg Lehni for Lineto.com, 2003-2005
*/
var cbeDocumentId='idDocument', cbeWindowId='idWindow', cbeAll=[];
window.onload=function(){cbeInitialize("div"); if (window.windowOnload) window.windowOnload();}
window.onunload=function(){if(window.windowOnunload){window.windowOnunload();}if(window.cbeDebugObj){window.cbeDebugObj=null;}for(var i=0; i<cbeAll.length; i++){if(cbeAll[i]){if(cbeAll[i].ele){if(cbeAll[i].ele.cbe){cbeAll[i].ele.cbe=null;}cbeAll[i].ele=null;}cbeAll[i]=null;}}}
function CrossBrowserElement(){
	 this.childNodes=0; this.parentNode=this.firstChild=this.lastChild=this.previousSibling=this.nextSibling=null;
	if (cbeAll.length < 2){this.width=cbeInnerWidth; this.height=cbeInnerHeight; this.scrollLeft=cbePageXOffset; this.scrollTop=cbePageYOffset;}
	this.id=""; this.index=cbeAll.length; cbeAll[this.index]=this;
	if (window.cbeEventJsLoaded) this.listeners=[];
}
var __cbe=CrossBrowserElement.prototype;
__cbe.left=__cbe.top=__cbe.offsetLeft=__cbe.offsetTop=__cbe.pageX=__cbe.pageY=__cbe.zIndex=__cbe.width=__cbe.height=__cbe.scrollLeft=__cbe.scrollTop=function(){return 0;};
__cbe.visibility=__cbe.color=__cbe.background=__cbe.clip=__cbe.innerHtml=function(){return "";};
var _cbeBind = true;
function cbeBindElement(ele, cbe, parent){
	if (!ele) return null;
	if (!cbe) cbe = new CrossBrowserElement();
	cbe.ele=ele; cbe.ele.cbe=cbe; cbe.parentElement=parent ? parent : cbeGetParentElement(ele);
	if (ele==window){cbe.id=ele.id=cbeWindowId; return;} else if (ele==document){cbe.id=ele.id=cbeDocumentId; return;} else{cbe.id=ele.id;}
	if (_cbeBind) {
		// left, top
		var css=_def(ele.style);
		if (css && _def(ele.style.left, ele.style.top) && typeof(ele.style.left)=="string"){__cbe.left=_domLeft; __cbe.top=_domTop;}else if (css && _def(ele.style.pixelLeft, ele.style.pixelTop)){__cbe.left=_ieLeft; __cbe.top=_ieTop;}else if (_def(ele.left, ele.top)){__cbe.left=_nnLeft; __cbe.top=_nnTop;}else{_sup(false,"left","top","moveTo","moveBy");}
		// width, height
		if (css && _def(ele.style.width, ele.style.height, ele.offsetWidth, ele.offsetHeight) && typeof(ele.style.width)=="string"){__cbe.width=_domWidth; __cbe.height=_domHeight;}else if (css && _def(ele.style.pixelWidth, ele.style.pixelHeight)){__cbe.width=_ieWidth; __cbe.height=_ieHeight;}else if (_def(ele.clip) && _def(ele.clip.width, ele.clip.height)){__cbe.width=_nnWidth; __cbe.height=_nnHeight;}else{_sup(false, "width","height","sizeTo","sizeBy","resizeTo","resizeBy");}
		// zIndex
		if (css && _def(ele.style.zIndex)){__cbe.zIndex=_domZIndex;} else if (_def(ele.zIndex)){__cbe.zIndex=_nnZIndex;} else{_sup(false,"zIndex");}
		// visibility
		if (css && _def(ele.style.visibility)){__cbe.visibility=_domVisibility;} else if (_def(ele.visibility)){__cbe.visibility=_nnVisibility;} else{_sup(false,"visibility","show");}
		// background
		if (css && _def(ele.style.backgroundColor, ele.style.backgroundImage)){__cbe.background=_domBackground;} else if (_def(ele.bgColor, ele.background)){__cbe.background=_nnBackground;} else{_sup(false,"background");}
		// color
		if (css && _def(ele.style.color)){__cbe.color=_domColor;} else{_sup(false,"color");}
		// clip
		if (css && _def(ele.style.clip)){__cbe.clip=_domClip;} else if (_def(ele.clip)){__cbe.clip=_nnClip;} else{_sup(false,"clip");}
		// offsetLeft, offsetTop
		if (_def(ele.offsetLeft, ele.offsetTop, ele.offsetParent)){__cbe.offsetLeft=_ieOffsetLeft; __cbe.offsetTop=_ieOffsetTop;}else if (_def(ele.pageX, ele.pageY)){__cbe.offsetLeft=_nnOffsetLeft; __cbe.offsetTop=_nnOffsetTop;}else{_sup(false,"offsetLeft","offsetTop");}
		// pageX, pageY
		if (_def(ele.pageX, ele.pageY)){__cbe.pageX=_nnPageX; __cbe.pageY=_nnPageY;}else if (document.cbe.isSupported("offsetLeft")){__cbe.pageX=_cbePageX; __cbe.pageY=_cbePageY;}else{_sup(false,"pageX","pageY","contains");}
		// innerHtml
		if (_def(ele.innerHTML)){__cbe.innerHtml=(is.mac && is.ie) ?_ieMacInnerHtml:_ieInnerHtml; } else if (_def(ele.document) && _def(ele.document.write)){__cbe.innerHtml=_nnInnerHtml;} else{_sup(false,"innerHtml");}
		// scrollLeft, scrollTop
		if (_def(ele.scrollLeft, ele.scrollTop)){__cbe.scrollLeft=_cbeScrollLeft; __cbe.scrollTop=_cbeScrollTop;}else{_sup(false,"scrollLeft","scrollTop");}
		// createElement, appendChild, removeChild (these need more work)
		if (!_def(document.createElement) && !document.layers){_sup(false,"createElement","appendChild","removeChild");}else{if (!_def(ele.appendChild)){_sup(false,"appendChild");} if (!_def(ele.removeChild)){_sup(false,"removeChild");}}
		_cbeBind = false;
	}
	return cbe;
}
function cbeInitialize(sTagNames){
	var t,i,ele,eleList;
	cbeBindElement(window, new CrossBrowserElement(window));
	cbeBindElement(document, new CrossBrowserElement(document));
	if (!document.getElementById) document.getElementById=cbeGetElementById;
	if (document.createElement || document.layers) document.cbe.createElement=_cbeCreateElement;
	document.cbe.isSupported=_cbeIsSupported;
	document.cbe.supported={};
	_sup(true,"left","top","width","height","zIndex","show","visibility","background","color","clip","offsetLeft","offsetTop","pageX","pageY","innerHtml","scrollLeft","scrollTop","createElement","appendChild","removeChild","moveTo","moveBy","sizeTo","sizeBy","resizeTo","resizeBy","contains");
	for (t=0; t < arguments.length; ++t){
		eleList=cbeGetElementsByTagName(arguments[t]);
		for (i=0; i < eleList.length; ++i){
			ele=eleList[i];
			if ( ele.id && ele.id !=""){
				cbeBindElement(ele);
			}
		}
		if (document.layers) break;
	}
	_cbeCreateTree();
}
function _def(){var i; for (i=0; i<arguments.length; ++i){var t = typeof(arguments[i]); if (t=="" || t=="undefined") return false;}return true;}
function _cbeIsSupported(sMethods){var i; for (i=0; i<arguments.length; ++i){if (!document.cbe.supported[arguments[i]]) return false;}return true;}
function _sup(bValue, sMethods){var i; for (i=1; i<arguments.length; ++i) document.cbe.supported[arguments[i]]=bValue;}
function _cbeCreateTree(){var parent; for (var i=1; i < cbeAll.length; ++i){parent=cbeAll[i].parentElement; if (!parent.cbe){while (parent && !parent.cbe){parent=cbeGetParentElement(parent);}if (!parent) parent=document;}parent.cbe.appendNode(cbeAll[i]);}}
function cbeGetElementById(id){
	var ele=null;
	if (id==window.cbeWindowId) ele=window;
	else if (id==window.cbeDocumentId) ele=document;
	else if (is.dom1getbyid) ele=document.getElementById(id);
	else if (document.all) ele=document.all[id];
	else if (document.layers) for (var i=0; i < cbeAll.length; i++){if (cbeAll[i].id==id) { ele =  cbeAll[i].ele; break; }}
	if (!ele && window.cbeUtilJsLoaded){ele=cbeGetImageByName(id);
	if (!ele){ele=cbeGetFormByName(id);}} return ele;
}
function cbeGetElementsByTagName(tagName){
	var eleList;
	if (document.getElementsByTagName) eleList=(is.ie55 && tagName == "*") ? document.all : document.getElementsByTagName(tagName); // standard
	else if (document.body && document.body.getElementsByTagName) eleList=document.body.getElementsByTagName(tagName); // opera5or6
	else if (document.all && document.all.tags) eleList=document.all.tags(tagName); // ie4
	else if (document.layers){eleList=[]; _nnGetAllLayers(window, eleList, 0);}// nn4
	return eleList;
}
function _nnGetAllLayers(parent, layerArray, nextIndex){
	var i, layer;
	for (i=0; i < parent.document.layers.length; i++){
		layer=parent.document.layers[i];
		layerArray[nextIndex++]=layer;
		if (layer.document.layers.length) nextIndex=_nnGetAllLayers(layer, layerArray, nextIndex);
	}
	return nextIndex;
}
function cbeGetParentElement(child){
	var parent=document;
	if (child==window) parent=null;
	else if (child==document) parent=window;
	else if (child.parentLayer){if (child.parentLayer !=window) parent=child.parentLayer;}
	else{
		if (child.parentNode) parent=child.parentNode;
		else if (child.offsetParent) parent=child.offsetParent;
		else if (child.parentElement) parent=child.parentElement;
	}
	return parent;
}
function _cbeCreateElement(type){// returns an Element object
	var ele=null;
	if (document.createElement && type.length){
		ele=document.createElement(type);
		if (ele && ele.style) ele.style.position="absolute";
	}
	else if (document.layers) ele={};
	return ele;
}
__cbe.appendNode=function(ch) {
	if (ch) {
		if (!this.firstChild) this.firstChild=ch;
		else {
			ch.previousSibling=this.lastChild;
			this.lastChild.nextSibling=ch;
		}
		ch.parentNode=this;
		this.lastChild=ch;
		++this.childNodes;
	}
	return ch;
}
__cbe.appendChild=function(ch){// returns the appended Element object on success
	var cbe, ele, rv=null;
	if (document.layers){
		var thisEle;
		if (this.index < 2) thisEle=window;
		else thisEle=this.ele;
		ele=new Layer(100000, thisEle);
		if (ele){
			if (ch.id) ele.id=ele.name=ch.id;
			cbe=cbeBindElement(ele, null, this);
			this.appendNode(ele.cbe);
			ch.cbe=cbe;
			rv=ele;
		}
	} else {
		if (this.index < 2) ele=document.body;
		else ele=this.ele;
		if (ele.appendChild){
			ele.appendChild(ch);
			cbe=cbeBindElement(ch, null, this);
			this.appendNode(ch.cbe);
			rv=ch;
		}
	}
	return rv;
}
__cbe.removeChild=function(ch){
	var ele, rv=null;
	if (this.index < 2) ele=document.body;
	else ele=this.ele;
	if (ele && ele.removeChild || document.layers){
		--this.childNodes;
		var prevSib=ch.cbe.previousSibling;
		var nextSib=ch.cbe.nextSibling;
		with (ch.cbe){
			parentNode=null;
			previousSibling=null;
			nextSibling=null;
		}
		if (prevSib) prevSib.nextSibling=nextSib;
		else this.firstChild=nextSib;
		if (nextSib) nextSib.previousSibling=prevSib;
		else this.lastChild=prevSib;
		if (document.layers) ch.visibility='hide';
		else ele.removeChild(ch);
		rv=ch;
	}
	return rv;
}
__cbe.moveTo=function(x, y){this.left(x); this.top(y);}
__cbe.moveBy=function(dx, dy){if (dx){this.left(this.left() + dx);} if (dy){this.top(this.top() + dy);}}
__cbe.sizeTo=function(w, h){this.width(w); this.height(h);}
__cbe.sizeBy=function(dw, dh){this.width(this.width() + dw); this.height(this.height() + dh);}
__cbe.resizeTo=function(w, h){this.sizeTo(w, h); this.clip(0, w, h, 0);}
__cbe.resizeBy=function(dw, dh){this.sizeBy(dw, dh); this.clip(0, this.width(), this.height(), 0);}
__cbe.show=function(){this.visibility(1);}
__cbe.hide=function(){this.visibility(0);}
__cbe.contains=function(iLeft, iTop, iClipTop, iClipRight, iClipBottom, iClipLeft){if (arguments.length==2){iClipTop=iClipRight=iClipBottom=iClipLeft=0;} else if (arguments.length==3){iClipRight=iClipBottom=iClipLeft=iClipTop;} else if (arguments.length==4){iClipLeft=iClipRight; iClipBottom=iClipTop;} var thisX=this.pageX(), thisY=this.pageY(); return ( iLeft >=thisX + iClipLeft && iLeft <=thisX + this.width() - iClipRight && iTop >=thisY + iClipTop && iTop <=thisY + this.height() - iClipBottom );}
function _domLeft(x){if (arguments.length){this.ele.style.left=x + "px";} else{x=parseInt(this.ele.style.left); if (isNaN(x)) x=0;}return x;}
function _domTop(y){if (arguments.length){this.ele.style.top=y + "px";} else{y=parseInt(this.ele.style.top); if (isNaN(y)) y=0;}return y;}
function _ieLeft(x){if (arguments.length){this.ele.style.pixelLeft=x;} else{x=this.ele.style.pixelLeft;} return x;}
function _ieTop(y){if (arguments.length){this.ele.style.pixelTop=y;} else{y=this.ele.style.pixelTop;} return y;}
function _nnLeft(x){if (arguments.length){this.ele.left=x;} else{x=this.ele.left;} return x;}
function _nnTop(y){if (arguments.length){this.ele.top=y;} else{y=this.ele.top;} return y;}
function _nnOffsetLeft(){var ol=this.ele.pageX - this.parentElement.pageX; if (isNaN(ol)){ol=this.ele.pageX;} return ol;}
function _nnOffsetTop(){var ot=this.ele.pageY - this.parentElement.pageY; if (isNaN(ot)){ot=this.ele.pageY;} return ot;}
function _ieOffsetLeft(){var x=this.ele.offsetLeft, parent=this.ele.offsetParent; while(parent && !parent.cbe){x +=parent.offsetLeft; parent=parent.offsetParent;}return x;}
function _ieOffsetTop(){var y=this.ele.offsetTop, parent=this.ele.offsetParent; while(parent && !parent.cbe){y +=parent.offsetTop; parent=parent.offsetParent;}return y;}
function _nnPageX(){return this.ele.pageX;}
function _nnPageY(){return this.ele.pageY;}
function _cbePageX(){var x=this.offsetLeft(), parent=this.parentNode; if (parent){while(parent.index > 1){x +=parent.offsetLeft(); parent=parent.parentNode;}} return x;}
function _cbePageY(){var y=this.offsetTop(), parent=this.parentNode; if (parent){while(parent.index > 1){y +=parent.offsetTop(); parent=parent.parentNode;}} return y;}
function _domWidth(w){if (arguments.length){this.w=Math.round(w); this.ele.style.width=this.w+"px";}return this.w?this.w:this.ele.offsetWidth;}
function _domHeight(h){if (arguments.length){this.h=Math.round(h);this.ele.style.height=this.h+"px";}return this.h?this.h:this.ele.offsetHeight;}
function _ieWidth(w){if (arguments.length){this.w=Math.round(w); this.ele.style.pixelWidth=this.w;}return this.w?this.w:this.ele.style.pixelWidth;}
function _ieHeight(h){if (arguments.length){this.h=Math.round(h); this.ele.style.pixelHeight=this.h;}return this.h?this.h:this.ele.style.pixelHeight;}
function _nnWidth(w){if (arguments.length){this.w=Math.round(w); this.ele.clip.right=this.w;}return this.w?this.w:this.ele.document.width;}
function _nnHeight(h){if (arguments.length){this.h=Math.round(h); this.ele.clip.bottom=this.h;}return this.h?this.h:this.ele.document.height;}
function _cbeScrollLeft(){return this.ele.scrollLeft;}
function _cbeScrollTop(){return this.ele.scrollTop;}
function _domVisibility(vis){if (arguments.length){this.ele.style.visibility=vis?'inherit':'hidden';}else return (this.ele.style.visibility=='visible' || this.ele.style.visibility=='inherit' || this.ele.style.visibility=='inherited' || this.ele.style.visibility=='');}
function _nnVisibility(vis){if (arguments.length){this.ele.visibility=vis?'inherit':'hide';}else return (this.ele.visibility=='show' || this.ele.visibility=='inherit' || this.ele.visibility=='');}
function _domZIndex(z){if (arguments.length){this.ele.style.zIndex=z;} else{z=parseInt(this.ele.style.zIndex); if (isNaN(z)) z=0;}return z;}
function _nnZIndex(z){if (arguments.length) this.ele.zIndex=z; return this.ele.zIndex;}
function _domBackground(sColor, sImage){if (arguments.length){if (!sColor){sColor='transparent';} this.ele.style.backgroundColor=sColor; if (arguments.length==2){this.ele.style.backgroundImage="url(" + sImage + ")";}}else return this.ele.style.backgroundColor;}
function _nnBackground(sColor, sImage){if (arguments.length){if (sColor=='transparent'){sColor=null;} this.ele.bgColor=sColor; if (arguments.length==2){this.ele.background.src=sImage || null;}}else{var bg=this.ele.bgColor; if (window.cbeUtilJsLoaded){bg=cbeHexString(bg,6,'#');} return bg;}}
function _domColor(newColor){if (arguments.length){this.ele.style.color=newColor;}else return this.ele.style.color;}
function _domClip(iTop, iRight, iBottom, iLeft){this.ele.style.clip="rect(" + iTop + "px " + iRight + "px " + iBottom + "px " + iLeft + "px" + ")";}
function _nnClip(iTop, iRight, iBottom, iLeft){this.ele.clip.top=iTop; this.ele.clip.right=iRight; this.ele.clip.bottom=iBottom; this.ele.clip.left=iLeft;}
function _ieInnerHtml(sHtml){if (arguments.length){this.ele.innerHTML=sHtml;}else return this.ele.innerHTML;}
function _ieMacInnerHtml(sHtml){if (arguments.length){this.ele.innerHTML="<!---->"+sHtml+"<!---->";}else return this.ele.innerHTML;}
function _nnInnerHtml(sHtml){if (arguments.length){if (sHtml==""){sHtml=" ";} with(this.ele.document) {open(); write("<body>"); write(sHtml); write("</body>"); close();}}else return "";}
function cbeInnerWidth(){
	var w=0;
	if (is.opera5or6){w=window.innerWidth;}
	else if (is.ie && document.documentElement && document.documentElement.clientWidth) w=document.documentElement.clientWidth; // ie6 compat mode
	else if (document.body && document.body.clientWidth) w=document.body.clientWidth; // ie4up, gecko, and opera7
	else if (_def(window.innerWidth,window.innerHeight,document.height)){// nn4
		w=window.innerWidth;
		if (document.height > window.innerHeight) w-=16;
	}
	return w;
}
function cbeInnerHeight(){
	var h=0;
	if (is.opera5or6){h=window.innerHeight;}
	else if (is.ie && document.documentElement && document.documentElement.clientHeight) h=document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) h=document.body.clientHeight;
	else if (_def(window.innerWidth,window.innerHeight,document.width)){
		h=window.innerHeight;
		if (document.width > window.innerWidth) h-=16;
	}
	return h;
}
function cbePageXOffset(){
	var offset=0;
	if (_def(window.pageXOffset)) offset=window.pageXOffset; // gecko, nn4, opera
	else if (document.documentElement && document.documentElement.scrollLeft) offset=document.documentElement.scrollLeft; // ie6 compat mode
	else if (document.body && _def(document.body.scrollLeft)) offset=document.body.scrollLeft; // ie4up
	return offset;
}
function cbePageYOffset(){
	var offset=0;
	if (_def(window.pageYOffset)) offset=window.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop) offset=document.documentElement.scrollTop;
	else if (document.body && _def(document.body.scrollTop)) offset=document.body.scrollTop;
	return offset;
}
function cbeEval(e) {
	var a = arguments;
	var t = typeof(e);
	if (t == "function") return e(a[1],a[2],a[3],a[4],a[5],a[6]);
	else if (t == "object" && typeof(a[1]) == "function") {
		e.__f = a[1];
		var r = e.__f(a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12]);
		delete e.__f;
		return r;
	}	
	else if (t == "string") eval(e);
}
function ClientSnifferJr(){
	this.ua=navigator.userAgent.toLowerCase();
	this.mac=this.ua.indexOf('mac')!=-1;
	this.win=this.ua.indexOf('win')!=-1;
	this.major=parseInt(navigator.appVersion);
	this.minor=parseFloat(navigator.appVersion);
	if (document.addEventListener && document.removeEventListener) this.dom2events=true;
	if (document.getElementById) this.dom1getbyid=true;
	if (window.opera){
		this.opera=true;
		this.opera5=(this.ua.indexOf("opera 5") !=-1 || this.ua.indexOf("opera/5")!=-1);
		this.opera6=(this.ua.indexOf("opera 6") !=-1 || this.ua.indexOf("opera/6")!=-1);
		this.opera5or6=this.opera5 || this.opera6;
		this.opera7=(this.ua.indexOf("opera 7") !=-1 || this.ua.indexOf("opera/7")!=-1);
		return;
	}
	this.konq=this.ua.indexOf('konqueror')!=-1;
	this.sfr=this.ua.indexOf('safari')!=-1;
	this.ie=this.ua.indexOf('msie')!=-1;
	if (this.ie){
		this.ie3=this.major<4;
		this.ie4=(this.major==4 && this.ua.indexOf('msie 5')==-1 && this.ua.indexOf('msie 6')==-1);
		this.ie4up=this.major>=4;
		this.ie5=(this.major==4 && this.ua.indexOf('msie 5.0')!=-1);
		this.ie55=this.ua.indexOf("msie 5.5")!=-1;
		this.ie5up=!this.ie3 && !this.ie4;
		this.ie6=(this.major==4 && this.ua.indexOf('msie 6.0')!=-1);
		this.ie6up=(!this.ie3 && !this.ie4 && !this.ie5 && !this.ie55);
		return;
	}
	this.hotjava=this.ua.indexOf('hotjava')!=-1;
	this.webtv=this.ua.indexOf('webtv')!=-1;
	this.aol=this.ua.indexOf('aol')!=-1;
	if (this.hotjava || this.webtv || this.aol) return;
	// Gecko, NN4, and NS6
	this.gecko=this.ua.indexOf('gecko')!=-1;
	this.nav=(this.ua.indexOf('mozilla')!=-1 && this.ua.indexOf('spoofer')==-1 && this.ua.indexOf('compatible')==-1);
	if (this.nav){
		this.nav4=this.major==4;
		this.nav4up=this.major>=4;
		this.nav5up=this.major>=5;
		this.nav6=this.major==5;
		this.nav6up=this.nav5up;
	}
}
window.is=new ClientSnifferJr();