$(document).ready(function(){
  /////////////////////////////
  var name = "#etiqueta";
  var menuYloc = null;
  
  menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
  $(window).scroll(function () {
  var offset = menuYloc+$(document).scrollTop()+"px";
  $(name).animate({top:offset},{duration:500,queue:false});
  });
  ///////////////////////////
  
  $('#etiqueta').addClass('etiqueta-normal');
  
  $('#etiqueta').hover(function(){
	  $(this).removeClass('etiqueta-normal');	
	  $(this).addClass('etiqueta-hover');							
  }, function(){
	  $(this).removeClass('etiqueta-hover');
	  $(this).addClass('etiqueta-normal');
  
	  });
  ////////////////////////////////
  
  $('.cadastra-bt').addClass('cad-bt');
  $('.cadastra-bt').hover(function(){
		$(this).addClass('cad-bt-hover');							   
  }, function(){
	  	$(this).removeClass('cad-bt-hover');
	   });
  
  ///////////////////////////////
  $('.submit').addClass('submit');	
  $('.submit').hover(function(){
		$(this).addClass('another-submit');							   
  }, function(){
	  	$(this).removeClass('another-submit');	
	   });
  
 		$('#news-field').focus(function(){
			if($(this).val()=="cadastre-se"){
				$(this).val('');
			}
		});
		
		$('#news-field').blur(function(){
			if($(this).val()==''){
				$(this).val("cadastre-se");
			}
		});
		
		/*$('html').click(function(){
		$('.cx-estagnacao, .cx-cresc, .cx-start, .cx-crise').fadeOut('fast');						 
		});*/
		
		$('.estag-hover').hover(function(){
			$('.cx-estagnacao').fadeIn('fast');
		}, function(){
			//$('.cx-estagnacao').delay(5000).fadeOut('fast');	
			$('html').click(function(){$('.cx-estagnacao').fadeOut('fast');});
		});	

		$('.cresc-hover').hover(function(){
			$('.cx-cresc').stop(true, true).fadeIn('fast');
		}, function(){
			//$('.cx-cresc').stop(true, true).delay(5000).fadeOut('fast');
			$('html').click(function(){$('.cx-cresc').fadeOut('fast');});
		});
				
		$('.start-hover').hover(function(){
			$('.cx-start').stop(true, true).fadeIn('fast');
		}, function(){
			//$('.cx-start').stop(true, true).delay(5000).fadeOut('fast');	
			$('html').click(function(){$('.cx-start').fadeOut('fast');});
		});
		
		$('.crise-hover').hover(function(){
		$('.cx-crise').stop(true, true).fadeIn('fast');
		}, function(){
			//$('.cx-crise').stop(true, true).delay(5000).fadeOut('fast');	
			$('html').click(function(){$('.cx-crise').fadeOut('fast');});
		});
		
		$("a.lightbox").colorbox({
		height: 500,
		width: 750
		}); 
  
});
