/*
 * DynClick
 * Copyright 2003 AgenciaClick - http://www.agenciaclick.com.br
 * interface.spo@agenciaclick.com.br
 * $Date: 2009/06/22 20:04:27 $
 * $Revision: 1.1 $
 */
function Navigation()
{
	var _language;
	var _languageTitle;
	var _section;
	var _sectionTitle;
	var T=this;
	T.mkNav=MkNav;
	T.addSection=AddSection;
	T.addSectionTitle=AddSectionTitle;
	T.getLanguage=GetLanguage;
	T.getLanguageTitle=GetLanguageTitle;
	T.getSection=GetSection;
	T.getSectionTitle=GetSectionTitle;
	T.getLevel=GetLevel;
	
	function MkNav(_nav)
	{
		var st=_nav.match(/\[([^\]]+)\]/g);
		var re=/\[([a-z0-9]+)##(.+)\]/;
		var st2;
		
		for(var i=0;i<st.length;i++)
			{
			st2=st[i].match(re);
			key=((st2!=null)? st2[1]:'');
			value=((st2!=null)? st2[2]:'');
				if(i==0)
				{
					_language=key;
					_languageTitle=value;
				}
				else
				{
					T.addSection(key);
					T.addSectionTitle(value);
				}
		}
	}

	function AddSection(section)
	{
		if(_section==null)
		{
			_section=new Array();
		}
		_section[_section.length]=section;
	}

	function AddSectionTitle(sectionTitle)
	{
		if(_sectionTitle==null)
		{
			_sectionTitle=new Array();
		}
		_sectionTitle[_sectionTitle.length]=sectionTitle;
	}

	function GetLanguage()
	{
		return _language;
	}

	function GetLanguageTitle()
	{
		return _languageTitle;
	}

	function GetSection(index)
	{
		return _section[index];
	}

	function GetSectionTitle(index)
	{
		return _sectionTitle[index];
	}

	function GetLevel()
	{
		if(_section!=null)
		{
			return _section.length;
		}
		else
		{
			return 0;
		}
	}
}

function isDef(S)
{
	return(eval('typeof('+S+')')!='undefined'&&eval('typeof('+S+')')!='unknown');
}

function getElm(id)
{
	return(is.ie4)?document.all[id]:document.getElementById(id);
}

function checkBrowser()
{
	var T=this;
	var b=navigator.appName;
	var v=navigator.appVersion;
	var u=navigator.userAgent;
	
	if(u==null)return;
	if(b=='Netscape')T.b='ns';
	else if(b=='Microsoft Internet Explorer')T.b='ie';
	else T.b=b;
	
	T.v=parseInt(v);
	T.ns=(T.b=='ns'&&T.v>=4);
	T.ns4=(T.b=='ns'&&T.v==4);
	T.ns5=(T.b=='ns'&&T.v==5);
	T.ns6=(T.b=='ns'&&T.v==5);
	T.ie=(T.b=='ie'&&T.v>=4);
	T.ie4=(u.indexOf('MSIE 4')>0);
	T.ie5=(u.indexOf('MSIE 5.0')>0);
	T.ie55=(u.indexOf('MSIE 5.5')>0);
	T.ie6=(u.indexOf('MSIE 6.0')>0);
	
	if(T.ie5)T.v=5;
	if(T.ie55)T.v=5.5;
	if(T.ie6)T.v=6;
	
	T.min=(T.ns||T.ie);
	T.dom=(T.v>=5);
	T.win=(u.indexOf('Win')>0);
	T.mac=(u.indexOf('Mac')>0);
}

is=new checkBrowser();

function docW()
{
	return(is.ie?document.body.scrollWidth:document.width);
}

function docH()
{
	return(is.ie?document.body.scrollHeight:document.height);
}

function winW()
{
	return(is.ie?document.body.clientWidth:window.innerWidth);
}

function winH()
{
	return(is.ie?document.body.clientHeight:window.innerHeight);
}

var DOA=new Array();

function DO(arguments,parent)
{
	this.arguments=arguments;
	this.parent=parent;
	this.newDO=newDO;
	this.itens=new Array();
}

function newDO()
{
	return(this.itens)? this.itens[this.itens.length]=new DO(newDO.arguments,this):DOA[DOA.length]=new DO(newDO.arguments);
}

var DLarray=new Array();

function DL(id,n1,n2)
{
	var T=this;
	T.elm=T.event=(is.ie4)? document.all[id]:document.getElementById(id);
	T.css=T.elm.style;
	T.doc=document;
	T.l=T.elm.offsetLeft;
	T.t=T.elm.offsetTop;
	T.w=T.elm.offsetWidth;
	T.h=T.elm.offsetHeight;
	
	if(!T.w)T.w=T.css.pixelWidth;
	if(!T.h)T.h=T.css.pixelHeight;
	
	T.obj=((id.lastIndexOf('Div'))? id.substring(0,id.lastIndexOf('Div')):id)+'DL';
	T.lIni=T.l;
	T.newPos=DLnewPos;
	T.sh=DLsh;
	T.hd=DLhd;
	T.mTo=DLmTo;
	T.mBy=DLmBy;
	T.rTo=DLrTo;
	T.rBy=DLrBy;
	T.write=DLwrite;
	
	if(!n1&&!n2)DLarray[DLarray.length]=T;
}

function DLsh()
{
	this.css.visibility='visible';
}

function DLhd()
{
	this.css.visibility='hidden';
}

function DLmTo(l,t)
{
	if(l!=null)
	{
		this.l=l;
		
		if(!is.ie)this.css.left=this.l;
		else this.css.pixelLeft=this.l;
	}
	
	if(t!=null)
	{
		this.t=t;
		
		if(!is.ie)this.css.top=this.t;
		else this.css.pixelTop=this.t;
	}
}

function DLmBy(l,t)
{
	this.mTo(this.l+l,this.t+t);
}

function DLrTo(w,h)
{
	if(w!=null)this.w , this.css.width=w;
	if(h!=null)this.h , this.css.width=h;
}

function DLrBy(w,h)
{
	this.rTo(this.w+w,this.h+h);
}

function DLwrite(S)
{
	this.elm.innerHTML=S;
}

function DLresposDLs()
{
	window.onresize=DLresposDLs;
	
	for(var i in DLarray)DLarray[i].newPos();
}

function DLnewPos()
{
	var tamW=winW();
	var deltaNs=((tamW!=docW()&&is.ns6))?7:0;
	var posX=((tamW<=780)? this.lIni:((tamW-780)/2)+this.lIni-deltaNs);
	this.mTo(posX,null);
}

function openPopup(u,n,w,h,o,c)
{
	var l=t=18;
	
	if(c)
	{
	l=(screen.availWidth-w)/2;
	t=(screen.availHeight-h)/2;
	}
	
	p=window.open(u,'pop_'+n,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars=1'+((o)?','+o:''));

}

function pI(src)
{
	obj=src.substring(src.lastIndexOf('/')+1,src.lastIndexOf('.'));
	eval('i'+obj+'=new Image()');
	eval('i'+obj+'.src="'+src+'"');
}

function cI(id,obj)
{
	var tId='document.images[\''+id+'\']';
	if(isDef(tId)&&isDef('i'+obj))eval(tId).src=eval('i'+obj).src;
}

