function fAdicionaEvento(obj, evType, fn){
	if (obj.addEventListener) obj.addEventListener(evType, fn, true)
	if (obj.attachEvent) obj.attachEvent("on"+evType, fn)
}

function fChangeColor () {
	if (obj = document.getElementById('SearchInput')) {
		obj.style.color = "#78a300"
		if (obj.value=="Procure aqui...") obj.value = ''
	}
}

function fLoadCSS (url) {
	// insert the css file
	css = document.createElement('link')
	css.setAttribute('rel','stylesheet')
	css.setAttribute('type','text/css')
	css.setAttribute('media','screen')
	css.setAttribute('charset','utf-8')
	css.setAttribute('href',url)
	document.getElementsByTagName('head')[0].appendChild(css)
}

function fIni () {

	// load CSS Hacks for IE6
	if (navigator.userAgent.indexOf('MSIE 6') != -1) fLoadCSS('css/ie6.css')

	// load CSS Hacks for IE7
	if (navigator.userAgent.indexOf('MSIE 7') != -1) fLoadCSS('css/ie7.css')

	// fix <a> with padding for IE
	if (div = document.getElementById('wrap')) {
		if (navigator.userAgent.indexOf('MSIE') != -1) {
			ListItens = div.getElementsByTagName("li")
			if (ListItens.length > 0) {
				for (var i = 0; i < ListItens.length; i++) {
					if (tag = ListItens[i].getElementsByTagName("a")[0]) {
						NewWidth = tag.offsetWidth-40
						tag.style.width = NewWidth+"px"
					}
				}
			} 
		}
	}
	
	// #main min-width for IE6
	if (navigator.userAgent.indexOf('MSIE 6') != -1) if (div = document.getElementById('main')) if (div.offsetWidth < 960) div.style.width = "960px"
	
	// change search input text color
	if (obj = document.getElementById('SearchInput')) fAdicionaEvento(obj,"focus",fChangeColor)
	
	// questions before contact form
	$("#CheckFAQAnswers").css('display','block')
	$("#PergunteFormSend ul").hide()
	$("#OpenContactForm").click(function () {
		$("#CheckFAQ").hide()
		$("#PergunteFormSend ul").show()
	})
	
	// bt close boo-boxifier
	$("#Boo-Boxifier li.FirstChild a.close").click( function () {
		$("#Boo-Boxifier").fadeOut()
	})
	
	// calls tag rank
	$.ajax({
		type: "GET",
		url: "http://www.deutrabalho.com.br/index.php/tags/",
		dataType: "text"
	});
	
}

fAdicionaEvento(window,"load",fIni)