// JavaScript Document

function infojob(info){
	document.getElementById('content_info').innerHTML = info;
}
function Animate2id(id2Animate){
    var animSpeed=1500; //animation speed
    var easeType="easeInOutExpo"; //easing type
    if($.browser.webkit){ //webkit browsers do not support animate-html
        $("body").stop().animate({scrollTop: $(id2Animate).offset().top}, animSpeed, easeType);
    } else {
        $("html").stop().animate({scrollTop: $(id2Animate).offset().top}, animSpeed, easeType);
    }
}
function mycarousel_initCallback(carousel)
{
    carousel.startAuto(0);

 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 2,
		scroll:4,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

    jQuery('#mycarousel2').jcarousel({
        auto: 2,
        initCallback: mycarousel_initCallback
    });
	// $("#espaco_imagens #mycarousel LI").find("a").focus();
	$('#menu_port UL LI A DIV').first().addClass('colorido');
	$('#menu_port UL LI A DIV').click(function(event){
		event.preventDefaut;
		$("#menu_port UL LI A").find("DIV").removeClass('colorido');
		$(this).addClass('colorido');
	});
	$('#c1').css=('width',$(window).width());
	$('#c2').css=('width',$(window).width());
	$('#c3').css=('width',$(window).width());
	$('#c4').css=('width',$(window).width());
	
	xvalor=($('#c1').width() - $('.corpo1').width())/2;
	$('.corpo1').css('left', xvalor);
	xvalor=($('#c2').width() - $('.corpo2').width())/2;
	$('.corpo2').css('left', xvalor);
	xvalor=($('#c3').width() - $('.corpo3').width())/2;
	$('.corpo3').css('left', xvalor);
	xvalor=($('#c4').width() - $('.corpo4').width())/2;
	$('.corpo4').css('left', xvalor);
	$(window).resize(function(){
		
	$('#c1').css=('width',$(window).width());
	$('#c2').css=('width',$(window).width());
	$('#c3').css=('width',$(window).width());
	$('#c4').css=('width',$(window).width());
		xvalor=($('#c1').width() - $('.corpo1').width())/2;
		$('.corpo1').css('left', xvalor);
		xvalor=($('#c2').width() - $('.corpo2').width())/2;
		$('.corpo2').css('left', xvalor);
		xvalor=($('#c3').width() - $('.corpo3').width())/2;
		$('.corpo3').css('left', xvalor);
		xvalor=($('#c4').width() - $('.corpo4').width())/2;
		$('.corpo4').css('left', xvalor);
	});
});

function enviaform(arq, form){
	var aux=true;
	var obj = eval("document.forms[0].nome");
	var txt = obj.value;
	if(txt.length<=0){
	} else {
		obj = eval("document.forms[0].mail");
		txt = obj.value;
		if((txt.length != 0) && ((txt.indexOf("@") < 1) || (txt.indexOf('.') < 7))){
    		alert('Email incorreto.');
			aux=false;
			obj.focus();
		} else {
			obj = eval("document.forms[0].mensagem");
			txt = obj.value;
			if(txt.length<=0){
				alert('Você precisa digitar uma mensagem.');
				aux=false;
			}
		}
	}
	if(aux){
		$.post(arq, $(form).serialize(),
			function(data) {
				if(data=='true'){
     				alert("Enviado com Sucesso!");
				} else {
					alert("Erro ao enviar o relatório. Favor tentar novamente!");
				}
	   	});
	}
}


function inserepagia(arq,idnt){
	$('#content_port').load(arq+".php?idnt="+idnt);
}

function mudaimagem(newimagelocation){
	$(this).attr("src", newimagelocation);
}
