//BlaTek Cascading Menu v3.0 beta
//Written by Bogdan Blaszczak/BlaTek
//blatek@25.pl
//this script is free for non-commercial use
function BlaTekCSMenu(){
	function B(o,m,b,a){
		for(k in m)
			o[k]=b?(b[k]!=a?b[k]:m[k]):m[k];
		return o
	}
	function S(n,x,y,b,c,jP){
		function M(){
			var wi=0,t,w1=up5?n.getElementsByTagName('div')[0]:n.all.tags('div')[0],w2=up5?w1.childNodes:w1.children
			for(k=0;k<w2.length;k++){
				t=up5?w2[k].getElementsByTagName('table')[0]:w2[k].all.tags('table')[0]
				if(t.offsetWidth>wi)
					wi=t.offsetWidth
			}
			for(k=0;k<w2.length;k++){
				w2[k].o=l.i[k];w2[k].onmouseover=w2[k].onmouseout=w2[k].onclick=Ev
			}
			w1.style.width=wi+"px"
			n.style.width=wi+2*mH+(ie?n.offsetWidth:0)+"px"
			n.style.height=w1.offsetHeight+mV+(ie?n.offsetHeight:0)+"px"
		}
		function W(){
			with(n.layers[0]){
				var w=layers,b,bo='class='+l.borderClass
				with(w[0].document){
					write("<layer "+bo+"><img width=1 height=1></layer>");
					close()
				}
				b=w[0].layers[0].document.images[0];
				if(b)
					b=b.x;
				if(b)
					b-=3
				var w1=clip.width,w2=w1-(b?6:0)+mH*2
				for(k=1;k<w.length;k++){
					w[k].left=b+mH
					if(k==1)
						w[k].top=b+mV;
					else
						w[k].top=w[k-1].top+w[k-1].clip.height+mV
					w[k].layers[0].o=l.i[k-1]
					with(w[k].layers[0].document){
						write('<layer width='+w1+'>'+l.i[k-1].no+'</layer>');
						close()
					}
					var h=w[k].layers[1];
					h.clip.width=clip.width;
					h.clip.height=w[k].clip.height
					h.captureEvents(Event.CLICK);
					h.onclick=h.onmouseover=h.onmouseout=Ev
				}
				h=w[w.length-1].y+w[w.length-1].clip.height-(b?6:0)-b+mV
				with(w[0].document){
					write('<layer '+bo+'><table width="'+w2+'" height="'+h+'"><tr><td>&nbsp;</td></tr></table></layer>');
					close()
				}
			}
		}
		with(BlaTek){
			l=p[n];
			n=E(n);
			n.style.display='block'
			var mH=~~l.marginH,mV=~~l.marginV;
			if(!l.fi)
				ns4?W():M();
			l.fi=1
			if(!jP){
				D=1;cT(O);H(1)
				R=b?!(b%2):0;
				B=b>2;
				if(c){
					x=R?C.L()+C.P()-pW(n)-x:x+C.L();
					y=B?C.Too()+C.THiN()-pH(n)-y:y+C.Too()
				}
				if(parseInt(n.style.top)==y&&parseInt(n.style.left)==x&&l.v)
					return
				if(!isHidden)hide(1);
				else if(BlaTek.onbeforeshow)
					onbeforeshow()
			}
			y-=jP&&B?pH(n)-l.marginV:jP?l.marginV:0;
			x-=jP&&R?pW(n):0
			P[P.length]=n.ID
			if(APC){
				var x0=C.L(),y0=C.Too(),x1=x0+C.P(),y1=y0+C.THiN();
				x=x<x0?(R?x+pW(jP)+pW(n):x0):x;
				y=y<y0?y0:y
				var x2=x+pW(n),y2=y+pH(n),oX=jP?pW(jP)+pW(n):x2-x1
				x1=x1<x2?(x-oX<x0?x0:x-oX):x;
				y1=y1<y2?(y-(y2-y1)<y0?y0:y-(y2-y1)):y;
				x=x1;
				y=y1
			}
			n.style.left=x;
			n.style.top=y
			n.style.zIndex=++I
			k=0;
			var T,Er
			if(!ns4)
				eval(up5?'try{k=n.filters}catch(Er){}':'k=n.filters')
			if(k)
				for(T in k)
					if(~T.indexOf('Trans'))
						eval(up5?'try{k[T].Apply()}catch(Er){}':'k[T].Apply()')
					n.style.visibility='visible'
					if(k)
						for(T in k)
							if(~T.indexOf('Trans'))
								eval(up5?'try{k[T].Play()}catch(Er){}':'k[T].Play()')
					l.v=1;
					isHidden=0
		}
	}
	function cM(){
		if(!ie){
			with(cL("bltnss",ns4?1:"100%")){
				if(ns4){
					document.write('<table height=100%><tr><td></td></tr></table>');
					document.close()
				}
				with(style){
					top=left=0;
					height=1;
					visibility="hidden"
				}
			}
		}
		with(BlaTek){
			I=zIndex
			for(k in p){
				l=p[k]
				var c=l.bgColor?l.bgColor:'',w=l.width?l.width:1
				var X;
				with(X=cL(k,ns6?999:op7?'':0)){
					with(style){
						left=top=op7?9999:-999;
						visibility="hidden";
						if(ie&&up5)
							display="none"
						cursor="default";
						backgroundColor=c;
						backgroundImage="url("+l.bgImage+")"
						if(!op7&&l.opacity<100){
							if(ns6)
								MozOpacity=l.opacity/100;
							if(ie)
								filter='alpha(opacity='+l.opacity+')'
						}
					}
					className=l.borderClass
					var s=ns4?"<layer bgcolor=\""+c+"\" background=\""+l.bgImage+"\" width="+w+"><layer></layer>":
					"<div style='position:absolute;width:"+w+"px;left:"+l.marginH+"px;top:"+l.marginV+"px'>"
					for(c in l.i)
						s+=kx(l.i[c]);
					s+=ns4?"</layer>":"</div>";
					innerHTML=s
					if(ns4){
						document.write(s);
						document.close()
					}
					if(ie&&l.filterIE)
						style.filter+=l.filterIE
					X.onmouseout=H;
					X.onmouseover=Ov
				}
			}
		}
	}
	function cT(t){
		clearTimeout(t)
	}
	function sT(s,T){
		return setTimeout('with(bMenu)'+s+'hide()',T)
	}
	function H(t){
		with(BlaTek){
			if(t==1) 
				O=sT('',waitDelay);
			else
				U=sT('if(!D)',hideDelay)
		}
	}
	function Ov(){
		with(BlaTek){
			cT(O);
			cT(U);
			D=0
		}
	}
	function kx(p){
		var c=!p.bgColor?'':ns4?'bgColor='+p.bgColor:';background-color:'+p.bgColor,
		g=!p.bgImage?'':ns4?'background=\"'+p.bgImage+'\"':';background-image:url('+p.bgImage+')',
		C=p.cursor?';cursor:'+p.cursor:'',F=p.filterIE?';filter:'+p.filterIE:'',
		h=p.height?'height:'+p.height+'px;':''
		if(ns4)
			h=p.height?p.height:1
		if(p.bgImage){
			p.In=new Image();
			p.In.src=p.bgImage
		}
		if(p.bgImageOver){
			p.Io=new Image();
			p.Io.src=p.bgImageOver
		}
		if(!ns4)
			return "<div style='position:relative;width:100%;"+h+"margin-bottom:"+BlaTek.p[k].marginV+"px"+c+g+C+F+"'>"+"<div style='position:absolute;width:100%;height:100%'></div>"+"<table class='"+p.borderClass+"' border=0 cellspacing=0 cellpadding="+(op7?0:2)+" width=100% height=100%><tr>"+"<td width=100% height=100% align="+p.align+" valign="+p.valign+" class=\""+p.fontClass+"\">"+(op7?"<divop style='display:block;padding:2px'>"+p.t+"</divop>":p.t)+"</td></tr></table></div>"
		function t(p,m){
			return "<table border=0 width=100% height="+h+" cellspacing=0 cellpadding=2><tr><td align="+(m?p.alignOver:p.align)+" valign="+(m?p.valignOver:p.valign)+">"+"<font class=\""+(m?p.fontClassOver:p.fontClass)+"\">"+(m?p.z?p.z:p.t:p.t)+"</font></td></tr></table>"
		}
		p.no=t(p,0)
		p.ov=t(p,1)
		return "<layer><layer "+c+" "+g+"><layer>"+p.no+"</layer></layer><layer></layer></layer>"
	}
	function re(s){
		if(s.toLowerCase().indexOf('<hr')==0)
			return (ns4?'<img width=1 height=1>':'')+s
		k=new RegExp("<[^>]*>","gi");
		l=s.match(k);
		if(l){
			s=s.replace(k,"&mcbltt;");
			s=s.split("&mcbltt;")
			for(k=0;k<s.length;k++)
				s[k]=s[k].replace(/ /g,"&nbsp;")+(l[k]?l[k]:"")
			s=s.join("")
		}else
			s=s.replace(/ /g,"&nbsp;")
		return "&nbsp;"+s.replace(/<br>/gi,"&nbsp;<br>&nbsp;")+"&nbsp;"
	}
	function Ev(e){
		function M(o,u,s,e){
			var f,T,Er
			if(!ns4)
				eval(up5?'try{f=o.filters}catch(Er){}':'f=o.filters')
			with(o){
				if(f)
					for(T in f)
						if(~T.indexOf('Trans'))
							eval(up5?'try{f[T].Apply()}catch(Er){}':'f[T].Apply()')

				k=ns4?null:'transparent'
				s=o.In?o.In.src:0;
				e=o.Io?o.Io.src:0;
				if(!o.bgColor)
					o.bgColor=k
				if(!o.bgColorOver)
					o.bgColorOver=k
				if(ns4){
					resizeTo(clip.width,clip.height)
					bgColor=u?o.bgColorOver:o.bgColor
					if((s||e)&&s!=e)
						background.src=u?e:s
					layers[0].document.write(u?o.ov:o.no)
					layers[0].document.close();
					return
				}
				style.backgroundColor=u?o.bgColorOver:o.bgColor
				if((s||e)&&s!=e)
					style.backgroundImage='url('+(u?e:s)+')'
				k=up5?getElementsByTagName('td')[0]:all.tags('td')[0]
				k.className=u?o.fontClassOver:o.fontClass
				s=o.align;
				e=o.alignOver;
				if(s!=e)
					k.align=u?e:s
				s=o.valign;
				e=o.valignOver;
				if(s!=e)
					k.vAlign=u?e:s
				if(o.z)
					k.innerHTML=u?o.z:o.t
				k=up5?getElementsByTagName('table')[0]:all.tags('table')[0]
				s=o.borderClass;
				e=o.borderClassOver;
				if(s!=e)
					k.className=u?e:s
				if(f)
					for(T in f)
						if(~T.indexOf('Trans'))
							eval(up5?'try{f[T].Play()}catch(Er){}':'f[T].Play()')
			}
		}
		function U(o,m){
			o=ns4?o.parentLayer.parentLayer.parentLayer:up5?o.parentNode.parentNode:o.parentElement.parentElement
			with(BlaTek){
				for(k=P.length-1;k>=0;k--){
					if(P[k]==o.ID)
						break;
					if(P[k]!=m)
						h(P[k]);
					P=P.slice(0,-1)
				}
			}
		}
		function G(e,t){
			with(BlaTek){
				if(ns4){
					e=e.parentLayer;
					var o=e.parentLayer.parentLayer
					return t?o.left+e.left+(R?0:pW(e)):o.top+e.top+(B?pH(e):0)
				}
				var o=e,L=o.offsetLeft,T=o.offsetTop
				while(o.offsetParent){
					o=o.offsetParent;
					L+=o.offsetLeft;
					T+=o.offsetTop
				}
				return t?L+(R?0:pW(e)):T+(B?pH(e):0)
			}
		}
		e=e||event;
		var t=e.type!='mouseout',
		l=ns4?this.parentLayer.layers[0]:this
		if(e.type=='click'){
			if(l.o.u)
				location.href=l.o.u;
			return
		}
		if(!ns4){
			k=ns6?e.relatedTarget:t?e.fromElement:e.toElement
			while(k){
				if(k==l)
					return;
				k=up5?k.parentNode:k.parentElement
			}
		}
		M(l,t);
		if(t){
			U(l,l.o.p);
			if(l.o.p)
				S(l.o.p,G(l,1),G(l),0,0,l)
		}
	}
	doc=document;
	ie=doc.all;
	ns4=doc.layers;
	up5=doc.getElementById?doc.getElementsByTagName('div'):0;
	ns6=up5&&!ie;
	op7=window.opera
	function E(i,x){
		if(ns4)
			for(x=0;x<ns4.length;x++)
				if(ns4[x].ID==i)
					return ns4[x];
		return up5?up5[i]:ie[i]
	}
	function cL(v,w,x){
	if(ns4){
		x=new Layer(w,window);
		x.style=x
	}
	else{
		if(up5){
			x=doc.createElement('div');
			x.id=v;
			x.style.position='absolute';
			doc.body.appendChild(x)
		}
		else{
			doc.body.insertAdjacentHTML('BeforeEnd','<div id='+v+' style="position:absolute"></div>');
			x=ie[v]
		}
		x.style.width=w}x.ID=v;
		return x
	}
	function R(f){
		if(f==1){
			doc.dW=innerWidth;
			doc.dH=innerHeight;
			onresize=R
		}
		else
			if(innerWidth!=doc.dW||innerHeight!=doc.dH)
				location.reload()
	}
	if(ns4)R(1)
		if(ns4)
			doc.captureEvents(Event.MOUSEMOVE)
		doc.onmousemove=function(e){
			BlaTek.X=ie?event.clientX:e.pageX;
			BlaTek.Y=ie?event.clientY:e.pageY
		}

		var k,l,on,BlaTek={B:0,O:0,D:0,Z:0,I:0,U:0,globalItem:{},globalPanel:{},isHidden:1,hideDelay:300,waitDelay:4000,zIndex:1,APC:1,p:{},P:[],R:0,
		Panel:function(n,C){
			return B(this.p[n]={i:[],Item:function(U,T,C,Z){return B(this.i[this.i.length]={u:U,t:T?re(T):'',z:Z?re(Z):0,expand:function(P){this.p=P}},BlaTek.globalItem,C)}},this.globalPanel,C)},
		show:function(n,x,y,b){S(n,x,y,b)},showLT:function(n,x,y,b){S(n,x,y,b?b:1,1)},showRT:function(n,x,y,b){S(n,x,y,b?b:2,1)},showLB:function(n,x,y,b){S(n,x,y,b?b:3,1)},showRB:function(n,x,y,b){S(n,x,y,b?b:4,1)},
		showByElement:on=function(n,x,y,e,b){var L=ns4?e.x:e.offsetLeft,T=ns4?e.y:e.offsetTop;if(!ns4)while(e.offsetParent){e=e.offsetParent;L+=e.offsetLeft;T+=e.offsetTop};S(n,x+L,y+T,b)},
		showByImg:function(n,x,y,i,b){on(n,x,y,doc.images[i],b)},pW:function(p){return ns4?p.clip.width:p.offsetWidth},pH:function(p){return ns4?p.clip.height:p.offsetHeight},
		showByCursor:function(n,x,y,b){x+=this.X+(ie?this.C.L():0);y+=this.Y+(ie?this.C.Too():0);S(n,x,y,b)},
		block:function(n){this.p[n].b=1},unblock:function(n){this.p[n].b=0},
		h1:function(n,a){with(E(n).style){visibility='hidden';left=top=-999;if(!a&&ie&&up5)display='none'}this.p[n].v=0},
		h:function(n,a){with(this)if(p[n].fi&&!p[n].b&&p[n].v){h1(n,a);E(n).style.zIndex=zIndex}},
		hide:function(a){with(this){for(k in p)h(k,a);P=[];I=zIndex;isHidden=1;if(!a&&this.onafterhide)onafterhide()}},
		C:new function(){
		function A(){
			with(doc)
				return ns4?width:ie?body.scrollWidth:documentElement.offsetWidth
		}
		function L(){
			with(doc)
				return ns4?height:ie?body.scrollHeight:documentElement.offsetHeight
		}
		function l(){
			return ie?doc.body.scrollTop:pageYOffset
		}
		function a(){
			return ie?doc.body.scrollLeft:pageXOffset
		}
		function D(){
			return ns4?i()<A():ie?K()!=s():O()<A()
		}
		function Y(){
			return ns4?s()<L():O()!=i()
		}
		function N(){
			return E('bltnss')
		}
		function i(){
			return ie?doc.body.offsetWidth-(doc.body.clientLeft*2):innerWidth
		}
		function s(){
			return ie?doc.body.offsetHeight-(doc.body.clientTop*2):innerHeight
		}
		function O(){
			return ie?doc.body.clientWidth:ns4?Y()?i()-(s()-N().clip.height):i():N().offsetWidth
		}
		function K(){
			return ie?doc.body.clientHeight:ns4?D()?N().clip.height:s():s()-(D()?(Y()?i()-O():s()-L()):0)
		}

		return{THiN:K, Too:l, P:O,L:a,N:D}}
		};
		Declare_bMenu(BlaTek);
		cM();
		bMenu=BlaTek
}
function nool(){
}
bMenu={show:nool,showLT:nool,showRT:nool,showLB:nool,showRB:nool,showByElement:nool,showByImg:nool,showByCursor:nool,hide:nool}
