/*
 * FUNCAO DO jquery.form PARA POST DE UPLOAD DE IMAGENS
 */
function fPost(form) {
    var options = { 
        target:        '#resposta',
        beforeSubmit:  postRequest,
        success:       postResponse 
    }; 
    $(form).ajaxForm(options);
    //alert($('#fContato'))
}
function postRequest(formData, jqForm, options) { 
	$("#resposta").html("Enviando...");
	/*$("#avisos").animate({top: 0, opacity: 'show'}, 300);*/
	return true; 
} 
function postResponse(responseText, statusText)  { 
	/*$("#avisos").html("Arquivo enviado com sucesso!");
	setTimeout(function(){
		$("#avisos").animate({top: -50, opacity: 'hide'}, 300);
	}, 3000);*/
}


function navegador()  { 
	$("#navegador li a").click(function(){
		$("#case_"+box).hide()
		
		var link = $(this).attr("href").replace("#","")
		var ar_total = $("#navegador").attr("class").split("_")
		var total = ar_total[1]-1
		if (link == "avancar") {
			
			
			box++
			$("#case_"+box).animate({top: 0, opacity: 'show'}, 900)
			if (box == total) box = 0;
		} else {

			box--
			$("#case_"+box).animate({top: 0, opacity: 'show'}, 900)
			if (box == total) box = 0;
		};

		return false
	});
}
var box = 0
function navegacao()  {
	if ($(".home").html() != null) {
		$("#case_"+box).hide()
		
		ar_total = $("#navegador").attr("class").split("_")
		var total = ar_total[1]-1
		
		box++
		if (box > total) box = 0;
		//$("#case_"+box).show()
		$("#case_"+box).animate({top: 0, opacity: 'show'}, 900)
	}
}


$(document).ready(function(){
	$("div#top div h1").remove();
	$("div#top div ul").remove();
	
	$("h2.oculta").click(function(){
		var id = this.id.replace("h2","div")
		$("#"+id).toggle();
	});

    
    if ($('#fContato')!=undefined) fPost('#fContato')
    if ($('#fTrabalhe') !=undefined) fPost('#fTrabalhe')
	
	navegador()
	setInterval("navegacao()", 6000); 

});











