/*##############################################################################*/
/* BROWSER/OS/SCREEN CHECK FUNCTIONS */
function bwcheck(){ 
	this.ver=navigator.appVersion;
	this.agent=navigator.userAgent;
	this.dom=document.getElementById?1:0;
	this.opera5=this.agent.indexOf("Opera 5")>-1;
	this.opera6=this.agent.indexOf("Opera 6")>-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.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie8=(this.ver.indexOf("MSIE 8")>-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.ie7||this.ie8;
	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.ie8||this.ie7||this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera6);
	return this;
}
function doc_size(){ 
	this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;
	this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;
	if(!this.x2||!this.y2) return _a('Document has no width or height') ;
	this.x50=this.x2/2;this.y50=this.y2/2;
	return this;
}
bw=new bwcheck()
var px=(bw.ns4 || bw.opera5 || bw.ie4)?'' : 'px';
/*##############################################################################*/
/* ONLOAD PARSE DOM FUNCTIONS */
window.onload=function(){
	if (window.windowOnload) window.windowOnload();
}
window.onunload=function(){
	for(var i=0;i<oLst.length;i++){
		var it=eval(oLst[i]);
		it=null;
	}
	oLst=null;
	if (window.windowOnUnload) window.windowOnUnload();
}
function Initialize(sTagNames){
	var t,i,ele,eleList,idList;
	idList=new Array();
	for (t=0; t < arguments.length; ++t){
		eleList=GetElementsByTagName(arguments[t]);		
		for (i=0; i < eleList.length; ++i){
			var cbe;
			ele=eleList[i];
			if (!ele.id || ele.id =="" || ele.id=="undefined"){
				ele.id = "_obj"+i;
			}
			idList[idList.length]=ele.id;				
			cbe=new OR(ele.id);
			cbe.par = gParId(cbe.elm);
		}		
		if (document.layers) break;
	}CreateTree();
}
function CreateTree(){
	var theObj,parObj;	
	for (var i=0;i < oLst.length;i++){
		theObj=eval(oLst[i]);
		parObj=eval(theObj.par);
		if(parObj && parObj!='undefined' && parObj.id && parObj.id!='undefined'){
			parObj.appendNode(theObj);
}}}
function GetElementsByTagName(sTagName){
	var eleList;
	if (document.getElementsByTagName) eleList=document.getElementsByTagName(sTagName);
	else if (document.body && document.body.getElementsByTagName) eleList=document.body.getElementsByTagName(sTagName);
	else if (document.all && document.all.tags) eleList=document.all.tags(sTagName);
	else if (document.layers){eleList=new Array(); nnGetAllLayers(window, eleList, 0);};
	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;
}
/*##############################################################################*/
var oLst=new Array();
function OR(objId,nest,cls,opac,inc){ 
	if(!bw.bw) return _a('Old browser');
	nest=(!nest) ? "":'document.'+nest+'.';
	this.eral=this.elm=bw.dom? document.getElementById(objId):bw.ie4?document.all[objId]:bw.ns4?eval(nest+"document.layers." +objId):0;	
	if(!this.elm){
		if(bw.ns4 || bw.opera5 || !bw.dom ) return _a('The layer cannot be referenced:'+objId+'\n\rIf your using Netscape please check the nesting of your tags!');
		else this.elm=document.createElement("DIV");
	}
	if(cls) this.elm.className = cls;
	this.css=bw.dom||bw.ie4?this.elm.style:this.elm; 
	this.ref=bw.dom||bw.ie4?document:this.css.document;
	this.id=objId;
	this.x=parseInt(this.css.left)||this.css.pixelLeft||this.elm.offsetLeft||0;
	this.y=parseInt(this.css.top)||this.css.pixelTop||this.elm.offsetTop||0;
	this.w=this.elm.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0; 
	this.h=this.elm.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0;
	this.c=0;
	if((bw.dom || bw.ie4) && this.css.clip) {
	this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 
	this.c=this.c.split(' ');
	for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}}
	this.ct=this.css.clip.top||this.c[0]||0; 
	this.cr=this.css.clip.right||this.c[1]||this.w||0;
	this.cb=this.css.clip.bottom||this.c[2]||this.h||0; 
	this.cl=this.css.clip.left||this.c[3]||0;
	this.inc=inc||20;
	this.al=(opac && opac>=0?opac:100);
	this.opac=this.al;
	if(this.eral && this.elm.filters){ if(this.css.filter.indexOf("alpha")==-1) this.css.filter+="alpha()";this.SOPAC(this.al)};
	this.obj = objId+ "Object";
	this.listeners=new Array();
	this.moves = new Array();
	if(oLst.indexOf(objId)==-1){
			this.oIndex=oLst.length;
			oLst[this.oIndex]=objId;
			var globalStr = 'window.'+objId+'=this;';
			eval(globalStr);
	}
	if(eval('window.'+objId)!='undefined') eval(this.obj + "=this");
	return this;
}
function oRnode(){
	this.parentNode=null;
	this.childNodes=0;
	this.firstChild=null;
	this.lastChild=null;
	this.previousSibling=null;
	this.nextSibling=null;
}
oRnode.prototype.appendNode=function(chld,where){
	if(chld){
		if(!this.children) this.children=new Array();
		this.childNodes++;
		var arrl=this.children.length;
		if(!this.firstChild && !this.lastChild){
			this.children.push(chld);
			this.firstChild=this.lastChild=chld;
			chld.nextSibling=chld.previousSibling=null;
		}else{
			if(where>=0){				
				chld.nextSibling=this.children[where];
				chld.previousSibling=this.children[where-1];
				if(where==0){
					this.firstChild=chld;
					this.children[where].previousSibling=chld;
					this.children.unshift(chld);
				}
				else{
					if(where==1) this.firstChild.nextSibling=chld;
					this.children[where-1].nextSibling=chld;
					this.children[where+1].previousSibling=chld;
					this.children.splice(where,0,chld);
				}
			}else{
				chld.previousSibling=this.lastChild;
				chld.nextSibling=null;
				this.lastChild.nextSibling=this.lastChild=chld;
				this.children.push(chld);
		}}chld.parentNode=this;		
	} return chld;
}
oRnode.prototype.removeNode=function(chld){
	this.childNodes--;
	if(chld){ 
		var indx=this.children.indexOf(chld);
		var arrl=this.children.length;
		if(indx>=0){
			if(indx==0){
				if(indx<arrl-1){
					this.firstChild.nextSibling.previousSibling=null;
					this.firstChild=this.firstChild.nextSibling;
				}else this.firstChild=this.lastChild=this.firstChild.nextSibling=this.lastChild.previousSibling=chld.previousSibling=chld.nextSibling=this.children=null;
			}else{
				if(indx<arrl-1){
					this.children[indx-1].nextSibling=this.children[indx+1];
					this.children[indx+1].previousSibling=this.children[indx-1];
				}else this.children[indx-1].nextSibling=null;
				this.children.splice(indx,1);				
	}}}else{
		this.lastChild=this.lastChild.previousSibling;
		this.children[arrl-2].nextSibling=null;
		this.children.splice(arrl-1,1);
}}
OR.prototype = new oRnode;
OR.prototype.appendChild=function(obj,where) { 
	this.elm.appendChild(obj.elm);
	if(where>=0) this.appendNode(obj,where);
	else this.appendNode(obj);
}
OR.prototype.removeChild=function(obj) {
	if(obj)	this.removeNode(obj);
	else 	this.removeNode();
	this.elm.removeChild(obj.elm);
}
OR.prototype.CE=function(type,id,cls,txt,ehdlrs,clr){
	type=type?type:'DIV';
	var txt=txt||'';
	var x=document.createElement(type);
	x.id=id;
	document.body.appendChild(x);
	x=new OR(id,null,cls);
	this.appendChild(x);
	x.WR(txt);
	if(ehdlrs){
		if(clr) x.sBut(0,clr);
		else x.sBut(0);
		for(var i=0;i<ehdlrs.length;i++){
			evntOs(x.obj,ehdlrs[i],ehdlrs[i+1]);
			i++;
	}} return x;
}
OR.prototype.RE=function(){	this.removeChild();}
OR.prototype.sBut=function(ehnd,clrs){
	if(bw.ie5||bw.ie6) this.css.cursor='hand';
	else this.css.cursor='pointer';
	if(!this.bclr) this.bclr = this.GBG();
	if(ehnd){
		for(var i=0;i<ehnd.length;i++){
			evntOs(this.obj,ehnd[i],ehnd[i+1]);
			i++;
	}}
	if(clrs) {
		this.ovrclr=clrs[0];
		this.dwnclr=clrs[1];
		this.dwnoclr=clrs[2];
	} else {
		var sc=this.GS('backgroundColor')||this.bclr||'#000000';
		this.ovrclr=color.alterColor(sc,10000);
		this.dwnclr=color.alterColor(sc,300);
		this.dwnoclr=color.alterColor(sc,18000);
}}
OR.prototype.GS=function(cssProp){
	var O=this.elm;
	var y=0;
	y=cssProp.indexOf("offset")==-1?this.GCS(cssProp):this.getOffset(cssProp);
	y=rStr(y,'px');
	return y;
}
OR.prototype.GCS=function(cssProp){
	var O=this.elm;
	var ret=0;
	if(cssProp.indexOf("background")==0) this.GBG(); 
	if (document.defaultView) ret = document.defaultView.getComputedStyle(O,null).getPropertyValue(cssProp);
	else if (O.currentStyle)  ret = eval('O.currentStyle.'+cssProp);
	return ret;
}
OR.prototype.GBG=function(){ 
	var c;
	if(bw.opera) c=this.css.background;
	else if(bw.ns4) c=this.css.BGColor;
	else if(bw.dom || bw.ie4) c=this.css.backgroundColor;
	return c;
}
OR.prototype.getOffset=function(ofs){
	var ret = eval("this.elm."+ofs);
	return ret;
}
OR.prototype.ABS = function(){this.css.position="absolute"}
OR.prototype.DISP = function(disp){if(arguments.length>0){this.css.display=disp}else{return this.css.display}}
OR.prototype.S = function(opac){this.css.visibility="visible";if(arguments.length>0){this.SOPAC(opac)}}
OR.prototype.H = function(){this.css.visibility="hidden"}
OR.prototype.SHOW = function(ef){this.S(100);this.DISP('block');if(ef)eval(ef);}
OR.prototype.HIDE = function(ef){this.H();this.DISP('none');if(ef)eval(ef);}
OR.prototype.CLS = function(cls){this.elm.className=cls}
OR.prototype.MARGPAD = function(){
	var evalstr="this.css.padding=";
	if(arguments[0]=='m') evalstr="this.css.margin=";
	if(arguments.length>1){
		var a = arguments;
		switch (arguments.length){
			case 2:
				evalstr+="'"+a[1]+px+"'";
				break;
			case 3:
				evalstr+="'"+a[1]+px+","+a[2]+px+","+a[1]+px+","+a[2]+px+"'";
				break;
			case 5:
				evalstr+="'"+a[1]+px+","+a[2]+px+","+a[3]+px+","+a[4]+px+"'";
				break;
		}

	}else evalstr+="'0px'";
	eval(evalstr);
}
OR.prototype.BG = function(color){ 
	if(bw.opera) this.css.background=color;
	else if(bw.dom || bw.ie4) this.css.backgroundColor=color;
	else if(bw.ns4) this.css.BGColor=color;  
}
OR.prototype.BORD = function(bstyle,bw,bc){
	this.css.borderStyle=bstyle;
	this.css.borderWidth=bw + px;
	this.css.borderColor=bc;
	if(bw>0) this.border=true;
	this.CT(this.ct,this.cr,this.cb,this.cl,0,1);
}
OR.prototype.WR = function(text,container,startHTML,endHTML){
	if(bw.ns4){
		if(!startHTML){startHTML=""; endHTML=""}
		this.ref.open("text/html"); 
		this.ref.write(startHTML+text+endHTML); 
		this.ref.close()
	}else{
		if(container) this.elm.firstChild.innerHTML=text;
		else this.elm.innerHTML=text;
}}
OR.prototype.MT = function(x,y){
	this.x=x;
	this.y=y; 
	this.css.left=x+"px";
	this.css.top=y+"px";
}
OR.prototype.MB = function(x,y){
	this.x+=x;
	this.y+=y;
	this.css.left=this.x+"px"; 
	this.css.top=this.y+"px";
}
OR.prototype.CNTR=function(parId,w,h){
	var dc=new doc_size();
	this.GPD();
	var w=w||0;
	var h=h||0;
	var pw= parId ? parseInt(eval(parId+".GS('width')")) : dc.x2;
	var ph= parId ? parseInt(eval(parId+".GS('height')")) : dc.y2;
	var nx= !w ? this.x : parseInt((pw-this.w)/2);
	var ny= !h ? this.y : parseInt((ph-this.h)/2);
	this.MT(nx,ny);
}
OR.prototype.CT = function(t,r,b,l,setwidth,bord){
	this.ct=t; this.cr=r; this.cb=b; this.cl=l;
	if(setwidth){
		this.css.pixelWidth=this.css.width=this.w=r; 
		this.css.pixelHeight=this.css.height=this.h=b;
	}
	if(bord || parseInt(this.GS('borderWidth'))>0){
		r=r+2;
		b=b+2;
	}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+","+r+","+b+","+l+")";
	}
	this.ct=t
	this.cr=r;
	this.cb=b;
	this.cl=l;
}
OR.prototype.CB = function(t,r,b,l,setwidth){ 
	this.CT(this.ct+t,this.cr+r,this.cb+b,this.cl+l,setwidth);
}
OR.prototype.ST=function(w,h,c)  { 
	this.w=w;this.h=h;
	this.css.width=w+px;
	this.css.height=h+px;
	this.brd=_int(this.GS('borderWidth'))*2*2||0;
	var ew=2+_int(this.w+this.brd);
	var eh=2+_int(this.h+this.brd);
	if(c)this.CT(this.ct,ew,eh,this.cl,0); 
}
OR.prototype.SB=function(ew,eh){ this.w=_int(this.GS('offsetWidth'))+ew;this.h=_int(this.GS('offsetHeight'))+eh;this.ST(this.w,this.h)}
OR.prototype.SOPAC=function(op){
	this.al=op;
	if(bw.ns6) this.css.MozOpacity = op/100;
	else if(this.elm.filters) this.elm.filters['alpha']['opacity'] = op;
}
OR.prototype.GOPAC=function(){
	var op;
	if(bw.ns6) op=parseInt(this.css.MozOpacity);
	else if(this.elm.filters && bw.ie5||bw.ie6) op=this.elm.filters['alpha']['opacity'];
	else op=100;
	return op;
}
function gT(event){
	var el;
	if(event.target) el=event.target;
	else if(event.currentTarget) el=event.currentTarget;
	else if(window.event.srcElement) el=window.event.srcElement;
	if(el) return el;
	else return false;
}
OR.prototype.addEventListener=function(evType,fn,useCapture){
	if(this.listeners.indexOf(evType)==-1){
		this.listeners[this.listeners.length]=[evType,fn,useCapture];
		if (evType.indexOf('mouse')==0) {
			if (this.elm.attachEvent) this.elm.attachEvent("on"+evType, fn);
			else this.elm.addEventListener(evType,fn,useCapture);
		} else eval(this["on"+evType]=fn);
		return true;
}}
OR.prototype.removeEventListener=function(evType,fn,useCapture){
	if(arguments.length){
		if (evType.indexOf('mouse')==0) {
			if (this.elm.detachEvent) this.elm.detachEvent("on"+evType,fn);
			else this.elm.removeEventListener(evType,fn,useCapture);
		} else eval(this["on"+evType]=null);
	}else{
		if(this.listeners.length){
			for(var i=0;i<this.listeners.length;i++){
				var listEv=this.listeners[i];
				if (listEv[0].indexOf('mouse')==0) {
					if (this.elm.detachEvent) this.elm.detachEvent("on"+listEv[0],listEv[1]);
					else this.elm.removeEventListener(listEv[0],listEv[1],listEv[2]);
				} else eval(this["on"+listEv[0]]=null);
	}}}
	this.listeners=[];
	return true;
}
function evntOs(){
	var oL = arguments.length-2;
	var cN = arguments[arguments.length-2];
	var fN = arguments[arguments.length-1];
	for(var i=0;i<oL;i++) eval(arguments[i]+'.addEventListener("'+cN+'",'+fN+',0)');	
}
/*##############################################################################*/
/* HELPER/MISC FUNCTIONS */
function _a(txt){alert(txt); return false}
function _w(txt){document.write(txt); return false}
function _sts(txt){window.status=txt;}
function _def(){var i; for (i=0; i<arguments.length; ++i){if (typeof(arguments[i])=="" || typeof(arguments[i])=="undefined") return false;}return true;}
function _int(str){return parseInt(str);}
function _abs(str){return Math.abs(_int(str));}
Array.prototype.indexOf = function(s){for(var a=0;a<this.length;a++)if(this[a]==s)return a;return -1};
Array.prototype.deleteItem  = function(i){
  if(i<0||i>(this.length-1))return; // out of range
  if(i==(this.length-1)){ // drop last item            
    this.length--;
    return;
  }
  for(var a=(i+1);a<this.length;a++) this[a-1]=this[a];
  this.length--;
}
function rStr(s,out,rstr){
	var sL=s.length;var tL=out.length;
	if(!rstr) var rstr='';
	for(var i=sL-tL;i>=0;i--) if(s.substring(i,s.length).indexOf(out)==0) s=s.substring(0,i)+rstr+s.substring(i+tL,sL);
	return s;
}
function fX(el){
	var curleft=0;
	if(document.getElementById||document.all){
		while(el.offsetParent){
			curleft+=el.offsetLeft;
			el=el.offsetParent;
	}}
	else if(document.layers) curleft+=el.x;
	return curleft;
}
function fY(el){
	var curtop=0;
	if(document.getElementById||document.all){
		while(el.offsetParent){
			curtop+=el.offsetTop;
			el=el.offsetParent;
	}}
	else if(document.layers) curtop+=el.y;
	return curtop;
}
function XScroll(){
	var offset=0;
	if (_def(window.pageXOffset)) offset=window.pageXOffset;
	else if (document.documentElement && document.documentElement.scrollLeft) offset=document.documentElement.scrollLeft;
	else if (document.body && _def(document.body.scrollLeft)) offset=document.body.scrollLeft;
	return offset;
}
function YScroll(){
	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 gPar(el){
	var parent=document;
	if(el==window) parent=null;
	else if(el==document) parent=window;
	else if(bw.ns4) if(el.parentLayer) if(el.parentLayer!=window) parent=el.parentLayer;
	else{
		if(el.offsetParent) parent=el.offsetParent;
		else if(el.parentNode) parent=el.parentNode;
		else if(el.parentElement) parent=el.parentElement;
	} return parent;
}
function gParId(el){
	var par;
	if(bw.ns4){ if(el.parentLayer) if(el.parentLayer!=window) par=el.parentLayer.id;}
	else{
		if(el.parentNode) par=el.parentNode.id;
		if(el.parentElement) par=el.parentElement.id;
	} return par;
}
function findObj(n, d){
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}
//######################################################################
var anav=0;
var onnav=0;
var onsnav=0;
function mov(elm){
	onnav=1;
	var _x = fX(elm);
	var _y = fY(elm);
	//_a(_x+" : "+_y)
	
	if(anav){
		var sn = new OR(anav);
		sn.DISP("none");
	}
	
	var sn_id = "sn"+elm.id.substring(1,elm.id.length);
	var sn = new OR(sn_id);
	sn.DISP("block");
	sn.MT(_x+115,_y-1);
	anav=sn_id;
}
function mov2(elm){
	onnav=1;
	var _x = fX(elm);
	var _y = fY(elm);	
	
	var sn_id = "sn"+elm.id.substring(1,elm.id.length);
	var sn = new OR(sn_id);
	sn.DISP("block");
	sn.MT(_x+115,_y-1);
	anav=sn_id;	
		
}
var _mnavtim=null;
function closeNav(){
	//_a("closeNav")
	if(anav && !onnav){
		var sn = new OR(anav);
		sn.DISP("none");

	}
}
function mot(elm){
	clearTimeout(_mnavtim);
	_mnavtim = setTimeout(closeNav,500);
	onnav=0;
}
function smov(elm){
	onnav=1;
}

function smot2(elm){
	clearTimeout(_mnavtim);
	_mnavtim = setTimeout(closeNav,500);
	onnav=0;	
	
	setTimeout( function() {
	
		var sn = new OR('sn3');
		sn.DISP("none");
 }, 1000 );
}

function smot(elm){
	clearTimeout(_mnavtim);
	_mnavtim = setTimeout(closeNav,500);
	onnav=0;	
	
}

//######################################################################
var _pop,_poptim;
function wopen(url,w,h,c,win,op,aot,tim){
	var sw=screen.width;
	var sh=screen.height;
	var _W=w?w:800;
	var _H=h?h:600;
	var _l=(sw-_W)/2;
	var _t=(sh-_H)/2;
	var _n=win||"nwin";
	var _o="location=0,directory=0,status=0,titlebar=0,menubar=0,resizable=1,copyhistory=0";
	var _p=",width="+_W+",height="+_H+",";
	if(c) _p+="left="+_l+",top="+_t+",screenX="+_l+",screenY="+_t;

	if(_pop&&!_pop.closed) { _pop.close(); _pop=null; clearTimeout(_poptim);}
	if(!op||op==null||op=='') _pop=window.open('about:blank',_n,_o+_p);
	else _pop=window.open('about:blank',_n,op+_p);
	
	_pop.location.href=url;
	if(_pop.focus()) _pop.focus();

	if(aot && !tim) _poptim=setTimeout('focPop()',1000);
	else if(tim) _poptim=setTimeout('_pop.close()',tim);
}
function focPop(){
	if(_pop&&!_pop.closed){
		_pop.focus();
		_poptim=setTimeout('focPop()',1500);
	}
}