// Original from Dynclick - Copyright by AgênciaClick
// Tanx to AgênciaClick´s Interface Team
// --------------------------------------------------
// Modified by Mauro Lages at 16/12/2002
// --------------------------------------------------

d=document
// Basics
function isDef(S){return(eval('typeof('+S+')')!='undefined'&&eval('typeof('+S+')')!='unknown')}
function getElm(id){return (is.ie4)?d.all[id]:d.getElementById(id)}
function toId(S){
	var S=S.toLowerCase()
	S=S.replace(/[áàãâä]/g,'a')
	S=S.replace(/[éèêë&]/g,'e')
	S=S.replace(/[íìîï]/g,'i')
	S=S.replace(/[óòõôö]/g,'o')
	S=S.replace(/[úùûü]/g,'u')
	S=S.replace(/[ç]/g,'c')
	for(var i=0;i<S.length;i++){if(' _0123456789abcdefghijklmnopqrstuvwxyz'.indexOf(S.charAt(i))==-1)S=S.replace(S.charAt(i),' ')}
	S=S.replace(/[ ]/g,'')
	S=S.replace(/[.]/g,'')
	return S
}

function openPopup(url,name,width,height,other,center){
	left=18;top=18
	if(center){left=(screen.availWidth-w)/2;top=(screen.availHeight-h)/2}
	url=url.replace(/[ ]/g,'%20')
	popup=window.open(url,'pop_'+name,'left='+left+',top='+top+',width='+width+',height='+height+',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 checkBrowser(){
	T=this
	b=navigator.appName
	v=navigator.appVersion
	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?(d.body.scrollWidth):(d.width))}
function docH(){return(is.ie?(d.body.scrollHeight):(d.height))}
function winW(){return(is.ie?(d.body.clientWidth):(window.innerWidth))}
function winH(){return(is.ie?(d.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){
	id=(is.ns4&&lyr)?'d.layers.'+lyr+'.document.images.'+id:'d.images[\''+id+'\']'
	if(isDef(id)&&isDef('i'+obj))eval(id).src=eval('i'+obj).src
}

// Reloads the window if Nav4 resized
function BUG_ns4_reloadOnResize(){
	if(!d.pgW){d.pgW=innerWidth;d.pgH=innerHeight;onresize=BUG_ns4_reloadOnResize}
	else if(innerWidth!=d.pgW||innerHeight!=d.pgH)location.reload()
}
if(d.layers)BUG_ns4_reloadOnResize()

