// hello, tomi
// hello, adi

$(document).ready(function() {

    // fancy scrolling ------------
	$('.scrollable').jScrollPane();

    $('#featuredTabs').tabs();

	// tipuri de facturare..............................................	
	var isjuridica = $('#radio-juridica').attr('checked');
	var isfizica = $('#radio-fizica').attr('checked');	
	
	if (!isjuridica) $('#juridica').hide;
	if (isfizica) $('#fizica').show;

	
	$('#radio-juridica').click(function(){
		$('#juridica').show();
		$('#fizica').hide();
	});

	$('#radio-fizica').click(function(){
		$('#juridica').hide();
		$('#fizica').show();
	});

	// custom select element.............................................		
	var firstinlist = $('.datas .select ul li:first-child a').html();  //takes first element from the hidden list...
	$('.datas .select a.input').html(firstinlist);
	
	$('.select a.input').click(function(){
		$('.select ul').hide();
		$(this).siblings('ul').toggle();
		return false;
	});
	
	$('.select ul li a').click(function(){
		var text = $(this).html();
		var parent = $(this).parent().parent().parent();
		$('.select a.input').html(text);
		$('.select ul').hide();
		return false;
	});	
	
    // step3 things...................
    $('#wantNewAcc').click(function(){
        $('#wantNewAcc').is(':checked') ? $('#newAccount').show() : $('#newAccount').hide();
    });

    $('#taxiDetailsKey, #atQuarter').click(function(){  
        $('#taxiDetailsKey').is(':checked') ? $('#taxiDetails').show() : $('#taxiDetails').hide();
        $('#atQuarter').is(':checked') ? $('#atQuarterDetails').show() : $('#atQuarterDetails').hide();
    });

	$('#toGo .selector').click(function(){
        $('#chooseLocation').dialog({
            width:560,
            modal:true,
            draggable: false,
            resizable: false,
            position: 'center'
        });
	});
    
    $('#userBlock .newAcc').click(function(){
        $('#makeAnOrder').dialog({
            width:620,
            modal:true,
            draggable: false,
            resizable: false,
            position: 'center'
        });
    });
});
