$(document).ready(
	function() {

		//------------------
		// INPUT fields default values
		//------------------

		$('INPUT[onempty]').focus(
			function() {
				var obj = $(this).get(0);
				if(obj.value == $(this).attr('onempty')) { obj.value = ''; $(this).removeClass('Dim');}
			}
		)

		$('INPUT[onempty]').blur(
			function() {
				var obj = $(this).get(0);
				if(obj.value == '') { obj.value = $(this).attr('onempty'); $(this).addClass('Dim'); }
			}
		)
	}
);


//----------------------
// FAQ
//----------------------

function SwitchFAQ(iQuestion) {
	//fixDottedLinksOutline('#Q' + iQuestion + ' a');
	$('.Question a').removeClass('Sel');
	$('.Answer').each(function(){
		if(this!=$('#A' + iQuestion).get(0)) { $(this).hide('fast'); }					   
	});
	$('#Q' + iQuestion + ' a').addClass('Sel');
	$('#A' + iQuestion).show('fast');
}

	
//----------------------
// Form Validations
//----------------------

function validateFormPesquisa(obj) {
	var keywords = $('INPUT[name=search_keywords]').attr('value');
	if(keywords.length <= 0) { alert('Escreva um termo de pesquisa.'); return(false); }
	if(keywords == 'Palavra-Chave') { alert('Escreva um termo de pesquisa.'); return(false); }
	if(keywords.length <= 2) { alert('Termo de pesquisa tem de ter mais que dois caracteres.'); return(false); }
}


//----------------------
// CICLE HOME
//----------------------
$(window).load(function() {
	
		$(".CycleContainerHome").cycle({
			fx:     'scrollLeft',
			easing: 'easeOutCirc',
			requeueOnImageNotLoaded: 'true',
			timeout: 8000, 
			delay:  -1000,
			speed: 1500
		});
		
													
});

//----------------------
// LOADING ICON
//----------------------

function showLoading(domChunk) {
	var offset = $(domChunk).offset();
	$('#LoadingIcon').css({
		position:	'absolute',
		top:	offset.top+($(domChunk).height()/2),
		left:	offset.left+($(domChunk).width()/2)
	});
	$('#LoadingIcon').show();	
}

function showLoadingGroup(domChunk) {
	var offset = $(domChunk).offset();
	$('#LoadingIcon').css({
		position:	'absolute',
		top:	offset.top+(100),
		left:	offset.left+($(domChunk).width()/2)
	});
	$('#LoadingIcon').show();	
}

function hideLoading() {
	$('#LoadingIcon').hide('fast');	
}






