$(document).ready(function(){
	    cloudTags()
		$('#q').focus(function(){
		a=document.getElementById('q')
		a.value=""
		a.focus()
		
		})
		$('#q').blur(function(){
		a=document.getElementById('q')
		if(a.value=="")a.value='buscar...'
		
		})
	$('#fontSize a').click(function(){
		var ourText = new Array(2)
		ourText[0] = $('.text')
		
		var currFontSize = new Array(2)
		currFontSize[0] = ourText[0].css('fontSize')
		var finalNum = new Array(2)
		finalNum[0] = parseFloat(currFontSize[0], 10)
		var stringEnding = currFontSize[0].slice(-2)
		if(this.id == 'large') {
			if(finalNum[0]>14.4)
			return
			
			else
				finalNum[0] *= 1.1
			
		}
		else if (this.id == 'small'){
			if(finalNum[0] <10)
			return
			else
			finalNum[0] /=1.1
			
		}
		ourText[0].css('fontSize', finalNum[0] + stringEnding);
		return false
	});
		
		$('input:radio[name="ask"]').change(function(){
			resp=$('input:radio[name="ask"]:checked').val();
			$('.tipAsk').css('display','block')
		
		})
		$('#closeTip').click(function(){
			$(this).parent().hide()
		
		})
		$('#askContent').submit(function(){
            url=location.href
            sender = $('#askContent').attr('action')
            sender = sender + '?jsoncallback=?&' + $(this).serialize() + '&url=' + url
            $.getJSON(sender, function(data){
                alert("Foi enviado com sucesso.")
            })
            $('#askContent .tipAsk').fadeOut()
            return false
        })

})
function activeMenu(menu,element){
							var url=location.pathname
							var active
							
							url=url.split('/')
							size=url.length
							
							
							
							if(url[size-1]!=''){
								active=url[size-1]
								
							}
							else if(url[size-1]=='' || url[size-1]=='index.html' || url[size-1]=='index.htm'){
									active='first'
							}
							
							
							
							$(menu).each(function(i){
								href=$(this).attr('href')
								href=href.split('/')
								href=href[href.length-1]

									if(active=='first'){
										if(i==0)
										if(element=='parent'){
											$(this).parent().toggleClass('active')
											
										}
										else{
											$(this).toggleClass('active')
											active='Ok'
										}
									}
									else if(active==href){
										if(element=='parent'){
											$(this).parent().toggleClass('active')
											
											}
										else{
											$(this).toggleClass('active')
											
											}
										
										}
							
								
								}
							
							)

}
function faqToggle(){
		$('.faq li span').siblings().hide()
		$('.faq li span').click(function(){
			$(this).siblings().slideToggle()	
		})
}
//Seta as urls das nuvens de tags
function cloudTags(){
	tags=$('.cloud a')
	if(tags==""){
	
	}
	else{
		url="http://www.serasaexperian.com.br/web/resultados.htm?cx=015908781356372267774%3Aofejn6x3jeg&cof=FORID%3A10&ie=UTF-8&q="
		tags.each(function(){
			$(this).attr('href',url+$(this).text())
		})
	}
}
function changeArea(oldArea,newArea,after){
				oldArea.remove()
				id=oldArea.attr('id')
				$('#'+after).after('<div id="'+id+'"></div>')
				$(window).bind('load',function(){
				oldArea.load(newArea)
				})
		} 
function getArea(){
			from=location.href
			from=from.split("?")
			
			if(from.length>1){
				from=from[1].split("=")
				from=from[1]
		
			return from
			}
			else{
				return "not"	
			}
		}

