var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;
var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;
var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;

var gx={switchers:{}};var g;(g=function(o)
{
	if(o.$e==undefined)o.$e='';
	if(typeof((h={
		init:function(){},
		_init:function()
		{
			g.onload=(typeof(t=window.onload)=='function')?t:function(){};
			window.onload=function(){g.onload();g({$:'init'})};
		},
		_cd:function(id)
		{
			o=document.createElement('div');
			o.id=id;
			return o;
		},
		_gc:function(s)
		{
			var arr=new Array()
			var els=(s.i==undefined?document:g(s.i)).getElementsByTagName("*");
			for(var i=0;i<els.length;i++ )if(g({$:'_hc',$e:{c:els[i].className,s:s.cn}}))arr.push(els[i]);
			return arr;
		},
		_hc:function(v)
		{
			var exp=new RegExp("^(.* )?"+v.s+"( .*)?$", "g");
			return exp.test(v.c)
		},
		_switcher:function(v)
		{
			r='';
			ps=g({$:'_gc',$e:{cn:'page',i:v.id}});
			navi=g(document.createElement('DIV')).css({height:25,position:'relative',top:15});
			navi.className='snav';
			ih='<table class="snavi" id="tl-'+v.id+'" cellspacing=0><tr>';
			timer=g({$:'_gc',$e:{cn:'timer',i:v.id}});
			gx.switchers[v.id]={actual:1,items:{},timer:Math.max(((timer[0]!=undefined)?((isNaN(tmp=timer[0].innerHTML)?0:tmp)*1000):5000),1000)};
			eli=0;
			for(el in ps)if(gpsel=(g(ps[el])))
			{

				tmp=gpsel.getElementsByTagName('h6');
				tdc='active';
				if(g({$:'_hc',$e:{c:ps[el].className,s:'page_dn'}}))
				{
					ps[el].css({visibility:'hidden',position:'absolute'});
					tdc='inactive';
				}
				eli++;
				ih+='<td onclick="g({$:\'_switch\',$e:{id:\''+ps[el].id+'\',sn:\''+v.id+'\',ct:'+eli+'}})" id="bt-'+ps[el].id+'" class="'+tdc+'"><a href="javascript://'+tmp[0].innerHTML+'">'+tmp[0].innerHTML+'</a><br><b></b></td>';
				gx.switchers[v.id].items[eli]=ps[el].id;
			}
			gx.switchers[v.id].count=eli;
			ih+='</tr></table>';
			navi.innerHTML=ih;
			g(v.id).appendChild(navi);
			sum=0;
			for(el in ps)if(gpsel=(g(ps[el])))
			{
				tmp=g('bt-'+ps[el].id).getElementsByTagName('a');
				sum+=wd=tmp[0].offsetWidth+19;
				g('bt-'+ps[el].id).css({width:wd});
			}
			g('tl-'+v.id).css({marginLeft:Math.floor((228-sum)/2)-2})
			g({$:'_switchLoop',$e:{id:v.id}})
		},
		_switchLoop:function(v)
		{
			if((tmp=gx.switchers[v.id].actual+1)>gx.switchers[v.id].count)tmp=1;
			gx.switchers[v.id].timeout=setTimeout("g({$:'_switch',$e:{id:'"+gx.switchers[v.id].items[tmp]+"',sn:'"+v.id+"',ct:"+tmp+"}})",gx.switchers[v.id].timer);
		},
		_switch:function(v)
		{
			a=v.id
			gx.switchers[v.sn].actual=v.ct;
			clearTimeout(gx.switchers[v.sn].timeout);
			g({$:'_switchLoop',$e:{id:v.sn}})
			do{v=g(v.id).parentNode}
			while(!(g({$:'_hc',$e:{c:g(v.id).className,s:'switcher'}})));
			ps=g({$:'_gc',$e:{cn:'page',i:v.id}});
			for(el in ps)if(gpsel=(g(ps[el])))
			{
				if(gpsel.id==a)
				{
					gpsel.style.position='static';
					gpsel.style.visibility='visible';
					//gpsel.style.display='block';
					g('bt-'+gpsel.id).className='active';
				}
				else
				{
					gpsel.style.position='absolute';
					gpsel.style.visibility='hidden';
					//gpsel.style.display='none';
					g('bt-'+gpsel.id).className='inactive';
				}
			}
		}
	})[o.$])=='function')return h[o.$](o.$e);
	else {
		o=(typeof(o)=='object'?o:document.getElementById(o));
		if((o)&&(!o.vget))
			for(e in f={
			vget:{init:true,opacity:1,lastHeight:0,version:0.1},
			vset:function(v)
			{
				for(e in v)this.vget[e]=v[e];
				return this;
			},
			hide:function()
			{
				return this.vset({display:(t=this.style.display)=='none'?this.vget.display:t}).css({display:'none',opacity:0});
			},
			show:function()
			{
				return this.css({display:((u=this.style.display)=='none'?(t=this.vget.display)==undefined?'':t:u)});
			},
			fadein:function(r)
			{
				if(r==undefined)
				{
					this.show();
					clearTimeout(this.vget.fadetimeout);
				}
				op=Math.min(this.style.opacity*1+0.05,1);
				if(op<1)this.vset({fadetimeout:setTimeout("g('"+this.id+"').fadein(1)",15)});
				this.css({opacity:op});
				return this;
			},
			fadeout:function(r)
			{
				if(r==undefined)clearTimeout(this.vget.fadetimeout);
				op=Math.max(this.style.opacity*1-0.15,0);
				if(op>0)this.vset({fadetimeout:setTimeout("g('"+this.id+"').fadeout(1)",15)});
				if(op==0)this.hide();
				this.css({opacity:op});
				return this;
			},
			css:function(s)
			{
				for(e in s)
				{
					if(e=='opacity')
					{
						this.vset({opacity:s[e]});
						this.style.opacity=s[e];
						this.style.filter='alpha(opacity='+Math.round(s[e]*100)+')';
					}
					else this.style[e]=s[e];
				}
				return this;
			}
		}){o[e]=f[e];};
	}
	if((o)&&(!o.id))o.id='ID-'+Math.random(1000);
	return o?o:false;
})({$:'_init'});

function iDump(v) {
	var t='';
	for(e in v) {
		x=v[e]
		if (typeof(x)=='function')
			{}//t+=e+'=[function]; ';
		else if (typeof(x)=='object')
			t+=e+"=[object];\n";
		else if (typeof(x)=='string')
			t+=e+"="+x+";\n";
		else
			t+=e+'='+x+";\n";
	}
	alert(t);
}


