$(window).load(function() {
	 //carousel slide
	$("#banner").jCarouselLite({
	    //auto	: 3000,
	    //speed	: 1000,
		visible: 1,
		btnNext	: "#next",
	    btnPrev	: "#prev"				
	});
});
$(document).ready(function() {
		
	 $(".xclose").click(function() {
		 $(".message").slideUp(500);
	    });
	    
	 $("#dsp").click(function(){
		 $(this).next().show();
		 //console.log($(this).next());
		 $(this).addClass("activ");
	 });
	 
	 $(".dspnoi").mouseleave(function(){
		 $(".dspnoi").hide();
		 $("#dsp").removeClass("activ");
	 });
	 
	$('.gosus').click(function(){
		$('html, body').animate({scrollTop:"0"}, 'slow');
		});
				
		
	// aplica 
	
	$('select[name=forma_legala]').change(function() {
		
		if ($(this).val() == "Profesie liberala" || $(this).val() == "Alta Categorie de Intreprinzator Individual" || $(this).val() == "Liberal profession" || $(this).val() == "Another category of individual entrepreneurs") {
			$('#forma_other').show();
		}
		else {
			$('#forma_other').hide();
		}
		
	});
	
	$('select[name=destinatie]').change(function() {
		
		if($(this).val() == "Alta" || $(this).val() == "Other") {
			$('#destinatie_other').show();
		}
		else {
			$('#destinatie_other').hide();
		}
		
	});
	
	$("#aplica_wrapper select").change(function(){
		var this_c = $(this).val();
		if($(this).prev().attr("id") == "select2"){
			var len = 45;
		}else{
			var len = 38;
		}
		if(this_c.length > len){
			this_c = this_c.substring(0, len);				
		}
		if(this_c != ""){
			//console.log(this_c);
			$(this).prev().html(this_c);
		}else{
			var t = $(this).children().html();
			$(this).prev().html(t);
		}
	});
	
	$(".checkbox").live('click', function(){
		var this_el = $(this);
		
		if(this_el.prev().is(':checked')){
			this_el.prev().removeAttr("checked");
			$(this).css("background-position","0 0");
		}else{
			this_el.prev().attr("checked", "checked");
			$(this).css("background-position","-21px 0");
		}
	});
	
	// start - tooltip
	$(".tooltip").live({
		mouseover: function(e){
			var this_el = $(this).position();
//			this.attr("alt");
			$("body").append('<div class="tooltip_inf">'+$(this).attr("alt")+'</div>');
			$(".tooltip_inf").css({
				"left"	:	this_el.left+210+"px",
				"top"	:	this_el.top
			});
	}, mouseleave: function(){
		$(".tooltip_inf").remove();
	}
	});
	// end - tooltip
});

function label_inside_input(input, text, action) {
	if(action == 'focus' && input.value == text)
		input.value = '';
	else if(action == 'blur' && input.value == '')
		input.value = text;
}







