var m;
m=new Object();
m.titles=new Array(0,0,0);
m.title_on=0;
active=new Array();

function collapseMenu(){
	len=active.length;
	if(len==1)
		return;
		
	out=active.pop();
	
	fader('menu_block_'+out,-1,0,100,1);
	fader('menu_block_'+active[len-2],1,100,0,1);

	//m.collapse=setTimeout('collapseMenu()',1000);
}

function showHideMenu(id,parent_id,depth){

	len=active.length;

	fader('menu_block_'+active[len-1],-1,0,100,1);
	fader('menu_block_'+id,1,100,0,1);

	active[len]=id;
	
}

function initTitle(n){
	
	if(n==0)
		{
		setTimeout("fader('title_2',0.15,50,0,0)",3000);
		setTimeout("initTitle(1)",3000);
		}

	if(n==1)
		{
		m.title_on=1;
		}
}

function titleOver(d,n){

	if(m.titles[n]!=0)
		{
		clearTimeout(m.titles[n]);
		m.titles[n]=0;
		}
	
	if(n!=2 || (n==2 && m.title_on==1))
		fader('title_'+n,d*0.5,75+(25*d),50,0);

	if(n!=2)
		m.titles[n+1]=setTimeout('titleOver('+d+','+(n+1)+')',200);	
				
}

function nospam(ad,domain,subject){
	window.location='mailto:'+ad+'@'+domain+'?subject='+subject;
}

function formFocus(obj,on){
	obj.style.backgroundColor='#ceeded';
}

function formBlur(obj){
	obj.style.backgroundColor='#ffffff';
}

function formSubmit(frm){
	findObj(frm).submit();
}

function findObj(obj){
	return document.getElementById(obj);
}

function fade(obj,d,target,f){

	lyr=document.getElementById(obj);
	lyr.fade+=(d*20);

	if((d>0 && lyr.fade>=target) || (d<0 && lyr.fade<=target))
		{
		lyr.fade=target*0.9999999;
		clearInterval(lyr.fade_on);
		lyr.fade_on=0;
		if(f==1 && d>0)
			{
			lyr.style.visibility='visible';
			lyr.focus();
			}
		}

	if(f>0)
		{
		if(lyr.fade==0)
			lyr.style.visibility='hidden';
		else
			lyr.style.visibility='visible';
		}

	lyr.style.opacity=lyr.fade/100;
	lyr.style.filter="Alpha(Opacity="+lyr.fade+")";
}

function fader(lyr,d,target,init,f){
	obj=findObj(lyr);
	
	if(obj.fade_on==null)
		{
		obj.fade_on=0;
		obj.fade=init;
		}

	if(obj.fade_on!=0)
		{
		clearInterval(obj.fade_on);
		obj.fade_on=0;
		}
	
	obj.fade_on=setInterval("fade('"+lyr+"',"+(d/2)+","+target+","+f+")",50);
}
