/*
 * DynClick
 * Copyright 2002 AgênciaClick - http://www.agenciaclick.com.br
 * $Author: vagner $
 * $Date: 2003/03/28 20:48:21 $
 */
var dynclickV = '$Revision: 1.10 $'.match(/[\d.]+/);
d = document
// Basics

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 toId(S){
	var S=S.toLowerCase();
	S=S.replace(/\xE0|\xE1|\xE1|\xE2|\xE3|\xE4/g,'a');
	S=S.replace(/\xE7/g,'c');
	S=S.replace(/\xE8|\xE9|\xEA|\xEB|\x26/g,'e');
	S=S.replace(/\xEC|\xED|\xEE|\xEF/g,'i');
	S=S.replace(/\xF1/g,'n');
	S=S.replace(/\xF2|\xF3|\xF4|\xF5|\xF6/g,'o');
	S=S.replace(/\xF9|\xFA|\xFB|\xFC/g,'u');
	S=S.replace(/[^\w]/g,'');
	return S;
}

function openPopup(url,n,w,h,other,c){
	l=t=18;
	if(c){l=(screen.availWidth-w)/2;t=(screen.availHeight-h)/2;}
	url=url.replace(/[ ]/g,'%20');
	popup=window.open(url,'pop_'+n,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars=1'+((other)?','+other:''));
	other=other||'';
	if(is.ie&&other.indexOf('fullscreen')!=-1){popup.moveTo(0,0);popup.resizeTo(screen.width,screen.height);}
	popup.focus();
}

function openBlank(url){window.open(url);}

function checkBrowser(){
	var T=this;
	var b=navigator.appName;
	var v=navigator.appVersion;
	var u=navigator.userAgent;
	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();


// Page Dimensions

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:document.innerWidth);}
function winH(){return(is.ie?document.body.clientHeight:window.innerHeight);}

// Images

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,lyr){
	if(isDef(id)&&isDef('i'+obj))eval('document.images[\''+id+'\']').src=eval('i'+obj).src;
}


// Objects Constructor
var DOA=new Array()
function DO(parent){this.arguments=DO.caller.arguments;this.newDO=newDO;this.parent=parent;this.itens=new Array();}
function newDO(){return (this.itens)?this.itens[this.itens.length]=new DO(this):DOA[DOA.length]=new DO();}


// Adiciona statements em uma funcao
function DWF(obj,newStatements,event){
	// Esta funcao re-escreve uma funcao dinamicamente. O ultimo parametro eh opcional, que eh o evento a ser atribuido a funcao
	if (isDef(obj)) {
		var thisFunc = eval(obj).toString();
		var re = /function[\t\s]+(\w+)\(/;
		re.exec(thisFunc);
		var thisFuncName = RegExp.$1;
		thisFunc = thisFunc.substr(0,thisFunc.lastIndexOf('}'));
		thisFunc += '\t' + newStatements + '\n}';
		eval(thisFunc);
		if (event) eval(event+'='+thisFuncName);
	}
}


// DynLayer (Thanks Dan Steinman)

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;
	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;}


// Add-ons para o DL


// Resposiciona em caso de resize (Basta chamar esta funcao no init, apos a criacao dos DLs
function DLresposDLs(){
	window.onresize=DLresposDLs;
	for (var i in DLarray) DLarray[i].newPos();
}

function DLnewPos() {
	var tamW = winW();
	var deltaNs = ((tamW!=docW()&&is.ns6)||is.ns4)?7:0;
	var posX = ((tamW<=780)?this.lIni:((tamW-780)/2)+this.lIni-deltaNs);
	this.mTo(posX,null);	
}

/**/
