
$(document).ready(function(){

	$('[title]').removeAttr('title');
	
	
	/* SLSLIDE */
	slSlide.init('#ul_jobs > li .bt_abrir','adming/uploads/album/trabalhos/');
    slSlide.getTopPosition = function(){
        var imgTag = jQuery('#ul_jobs > li img')[ jQuery('#ul_jobs > li .bt_abrir').index(this) ];
        return jQuery( imgTag ).offset()['top'];
    }
    
	var hash;
	
    hash = window.location.hash;
    hash = hash.substring(1);
	
	if( hash != '' ){
		slSlide.openHash(hash);
	}

    /*Alerta Provisório*/
    $(".alerta_prov").show().delay(200).animate({
        opacity: 0
    }, 10);	
	
	
    $('.alertTit').mouseenter(function(){
		
        $(this).mousemove(function(e){
            posx = e.pageX+20;	
            posy = e.pageY-10;
            $(".alerta_prov").css('left',posx);
            $(".alerta_prov").css('top',posy);
        });
			
        thetit = $(this).attr('rel');
        $(".alerta_prov").text(thetit);
        $(".alerta_prov").animate({
            opacity: 1
        }, 200);			
    });	
    
    $('.alertTit').mouseleave(function(){
        $(".alerta_prov").animate({
            opacity: 0
        }, 50);			
    });
	
    /* GO TOP */
    //diminui opacidade
    $('.gotop').animate({
        'opacity':0
    }).show();
    //hover
    $('.gotop').hover( function(){
        $(this).stop().animate({
            'opacity':0.9
        });
    }, function(){
        $(this).stop().animate({
            'opacity':0.6
        });
    });
	
    //click
    $(window).scroll( function(){ 
        var top = $(this).scrollTop();
        if( top > 161 ){
            $('.gotop').show().stop().animate({
                'opacity':0.6, 
                'top':top+15
            });
        } else {
            $('.gotop').stop().animate({
                'opacity':0
            });
        }
	
    });
    $('.gotop').click( function(){
        $('html, body').stop().animate({
            scrollTop:0
        }, 300);
    });

    /* FIM GO TOP */

    /*lazy Load*/
    $(".portf_list img").lazyload({
        placeholder : "img/grey.gif",       
        effect      : "fadeIn"
    });
	
		
});
	
/* Funcao para Voto*/
function voto(id){
	
    
    var num_votos = Number($('#star_num #valx').html());

    //voto positivo
    if( $('#star').attr('class')== "kwek_like_off"){
		
        $.getJSON('verificar_voto.php',{
            id:id,
            classe:"kwek_like_off"
        },function(data){
            if(data == 0){
                $('#star').removeClass('kwek_like_on');
                $('#star').addClass('kwek_like_off');
                $('#star').html('Gostou?');
                $('#star_num #valx').html(num_votos -1);
				$('.star_fx').animate({'top':2,'opacity':1},1).hide();
            }else{
				$('.star_fx').show().delay(0).animate({'top':-50,'opacity':0.7},600).animate({'opacity':0},300);
                $('#star').removeClass('kwek_like_off');
                $('#star').addClass('kwek_like_on');
                $('#star').html('Gostou!');
                $('#star_num #valx').html(num_votos +1);
            }
        });
		
    }else{
		
        $.getJSON('verificar_voto.php',{
            id:id,
            classe:"kwek_like_on"
        },function(data){
            if(data == 0){
                $('#star').removeClass('kwek_like_on');
                $('#star').addClass('kwek_like_off');
                $('#star').html('Gostou?');
                $('#star_num #valx').html(num_votos -1);
				$('.star_fx').animate({'top':2,'opacity':1},1).hide();
            }else{
				$('.star_fx').show().delay(0).animate({'top':-50,'opacity':0.7},600).animate({'opacity':0},300);
                $('#star').removeClass('kwek_like_off');
                $('#star').addClass('kwek_like_on');
                $('#star').html('Gostou!');
                $('#star_num #valx').html(num_votos +1);
            }
        });
		
    }
	
	
}


/*APP FEEDBACK */
$(document).ready(function(){
	$('.headlink').toggle(function() {
		
		$('.feedback_box').animate({
			height: 555
    	}, 300);
		$('.headlink').text('Minimizar');
		  
	}, function() {
	  
		$('.feedback_box').animate({
        	height: 35
    	}, 100);
		$('.headlink').text('Envie seu Feedback!');
	});

});

	
	

