//now this is my script :)

$(document).ready(function() {
    $('a.anchorLink').click(function(event){event.preventDefault()});
    $('a.anchorLink').anchorAnimate()
    $('#header a').click(function(){
	$('#nav li a').removeClass('selected')
	$('#nav li a:eq(0)').addClass('selected')
	});
    $('#nav li a').click(function(){
	$('#nav li a').removeClass('selected')
	$(this).addClass('selected')
	});
    
    $('.joblist li a').css({opacity: 0});
    
    $('.joblist li a').animate({
	opacity: 1
	} , 1200 ,function(){
	    $('<img />')
	    .appendTo(this)
	    .attr({
		src: $(this).attr('href'),
		alt: $(this).attr('title')
        	});
	});
    
    $('<img />')
    .appendTo('#tela')
    .attr({
	src: $('.joblist li a:eq(0)').attr('href'),
	alt: $('.joblist li a:eq(0)').attr('title')
	});
    
    $('<div class="jobdescription"><h4></h4><p></p></div>')//criaçao da div de descricao dos trampos
    .insertAfter('#tela img');
    
    $('.jobdescription h4')
	.text($('.joblist li a:eq(0)').attr("title"));//titulo da descricao
	
    $('.jobdescription p')
	.text($('.joblist li a:eq(0)').text());//texto da descricao
    
    
	
    $('.joblist li a:eq(0)').addClass('selected');
    $('.joblist li a').click(function(event){
	event.preventDefault()
	$('.joblist li a').removeClass('selected')
	$(this).addClass('selected')
	$('#tela img').remove();
	$('div.jobdescription h4').remove();
	$('div.jobdescription p').remove();
	$('div.jobdescription').remove();
	$('<img />')
	.appendTo('#tela')
	.attr({
	    src: $(this).attr('href'),
	    alt: $(this).attr('title')
	    })
	.hide()
	.fadeIn(1000)
    $('<div class="jobdescription"><h4></h4><p></p></div>')
    .insertAfter('#tela img');
    
    $('.jobdescription h4')
	.text($(this).attr("title"))
	.hide().fadeIn(1100);
	
    $('.jobdescription p')
	.text($(this).text())
	.hide()
	.fadeIn(2600)
	});
    
/*    $('<div id="over"></div>')
		.css({
		opacity : 0.68,
		width : $(document).width(),
		height : $(document).height()
		})
		.appendTo('body')
		.hide()
		.click(function(){
			$(this).hide(200)
			$('#telaover').remove()
			});
    $('#tela img').click(function(){
	    
	    $('#telaover').remove();
	    
	    $('#over').fadeIn(900);
	    
	    $('<div id="telaover"><img /></div>').insertAfter('#over');
	    
	    $('#telaover img').attr({
		    src: $(this).attr('src'),
		    alt: $(this).attr('alt')
		    });
	    });*/
    
    //$('#parceiros').hide();
    $('h3.parceiros').click(function(event){
	event.preventDefault()
	$('#parceiros').slideToggle(500);
	});
    
     //script para placeholder do formulário :P
    var textDefault0 = $('#contato form input:eq(0)').attr('title');
    $('#contato form input:eq(0)').val(textDefault0)
    .focus(function() {
	if ($(this).val() == textDefault0) {
		$(this).val("");
	}
	}).blur(function() {
	if ($(this).val() =="") {
		$(this).val(textDefault0);	
	}
	});
     var textDefault1 = $('#contato form input:eq(1)').attr('title');
    $('#contato form input:eq(1)').val(textDefault1)
    .focus(function() {
	if ($(this).val() == textDefault1) {
		$(this).val("");
	}
	}).blur(function() {
	if ($(this).val() =="") {
		$(this).val(textDefault1);	
	}
	});
     var textArea = $('#contato form textarea').text();
    $('#contato form textarea').val(textArea)
    .focus(function() {
	if ($(this).val() == textArea) {
		$(this).val("");
	}
	}).blur(function() {
	if ($(this).val() == "") {
		$(this).val(textArea);	
	}
	});//fim do placeholder :P
    
    
    });
//Anchor Slider by Cedric Dugas   ***    Http://www.position-absolute.com

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 600
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
                        
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}