$(document).ready(function(){
	
	$(function() {
			 $("#galerie").jCarouselLite({
				  btnNext: ".btRight",
				  btnPrev: ".btLeft",
				  visible:2,
				  btnGo: [".1", ".2", ".3", ".4"]
			 })
	});
	
	
	$("a.judet").mouseover(function() {
		var xHeight = $(".judet").height();
		var pTop = $(this).offset().top;
		var pLeft = $(this).offset().left;
		var xwidth = $(".judet").width();
		pLeft = pLeft+xwidth+0;
		$(".popupMap").css({
        top: pTop,
        left: pLeft
		}).show();
		var currentTab = $(this).attr('href');
	    $('.popupMap').hide();
	    $(currentTab).show();
	    return false;
		
	});
	$('.closePopup, body').click(function(){
		$('.popupMap').hide();
	});

	
	$('.btNewsletter').click(function(){
		$('<div class="blackBox"></div>').appendTo('body'),
		$('.newsletter').show();
		$('.blackBox').css('height',$(document).height());
	});
	$('.closePopupRed').click(function(){
		$('.newsletter, .blackBox').hide();
	});
	
	
	$('.inputNL').each(function() {
		var default_value = this.value;
			$(this).focus(function() {
				if(this.value == default_value) {
					this.value = '';
				}
			});
		 $(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	$('.errorNL').click(function(){
		$(this).fadeOut('fast');
	});
	
	
	$('.innerContent').hide();
	$('.innerContent:first').show();
	$('a.tabBt:first').addClass('activ');
	$('a.tabBt').click(function(){
	$('a.tabBt').removeClass('activ');
	$(this).addClass('activ');
	var currentTab = $(this).attr('href');
	$('.innerContent').hide();
	$(currentTab).show();
	return false;
	});
	
	$('.headerMenu a').mouseenter(function(){
		$('.utilitare').slideUp('fast');
	});
	$('#utilitare').mouseover(function(){
		$('.utilitare').slideDown('fast');
	});
	$('.utilitare').mouseleave(function(){
		$('.utilitare').slideUp('fast');
	});
	


	
	$('body').addClass('has-js');
	
	$('.label_check, .label_radio').click(function(){
		setupLabel();
	});

	setupLabel(); 
 
	function setupLabel() {
        if ($('.label_check input').length) {
            $('.label_check').each(function(){ 
                $(this).removeClass('c_on');
            });
            $('.label_check input:checked').each(function(){ 
                $(this).parent('label').addClass('c_on');
            });                
        };
        if ($('.label_radio input').length) {
            $('.label_radio').each(function(){ 
                $(this).removeClass('r_on');
            });
            $('.label_radio input:checked').each(function(){ 
                $(this).parent('label').addClass('r_on');
            });
        };
    };
	
	$('.btDetalii').click(function(){
		$(this).next('.cursDetalii').slideToggle();
	});

	 $("label.label_check input").click(function() {
		 isSelectedCheck = $(this).attr('checked');
		 if (isSelectedCheck){
			 $(this).parent().siblings('div.miniForm').show('fast');
		 } else {
			 $(this).parent().siblings('div.miniForm').hide('fast');
		 }
	});
	
	$(function() {
			 $("#galerie").jCarouselLite({
				  btnNext: ".btRight",
				  btnPrev: ".btLeft",
				  visible:2,
				  btnGo: [".1", ".2", ".3", ".4"]
			 })
	});
	
	
})


