jQuery(document).ready( function () {
	
	jQuery('#info-control').addClass("openw");
	
    jQuery('.openw').click( function () {
        jQuery('#dades').toggle('slow');
	});
	
	jQuery('.fact-inf').hide();
	jQuery('.total-container').hide();
    jQuery('.school').hide();
	
    jQuery('#factcheck-control').click( function () {
	    jQuery('.fact-inf').toggle('slow');    
	});
	
    jQuery('#isStudent-control').click( function () {
	    jQuery('.school').toggle('slow');    
	});
    
    //jQuery('.lv-number').hide();
	
	/*
    jQuery('#lvsubscriptor-control').click( function () {
	    jQuery('.lv-number').toggle('slow');    
	});
	
	
    if(jQuery('#lvsubscriptor-control:checked').length > 0){
	    jQuery('.lv-number').show('slow');
	}
    */
	
	if(jQuery('#factcheck-control:checked').length > 0){
	    jQuery('.fact-inf').show('slow');
	}
	
	if(jQuery('#isStudent-control:checked').length > 0){
	    jQuery('.school').show('slow');
	}
    
	/*
	jQuery('.activity-checkbox').click( function () {
        calculate();
	})
	*/

    jQuery(".noticeby").hide();
    
    if(jQuery('.fields .noticebydummy select').val() != "other") jQuery(".others").hide();
    

    jQuery('.fields .noticebydummy select').change(function () {
        var val = jQuery(this).val();
        if(val == "other"){
            jQuery("input[name='noticeby']").val('');
            jQuery(".others").show("slow");
        }else{
            jQuery("input[name='noticeby']").val(jQuery("option[value='" + val + "']").html());
            jQuery(".others").hide("slow");
        }
    });

    jQuery(".SubscriberForm").submit(function () {
        var other = jQuery("input[name='others']").val();
        if(other != "") {
            jQuery("input[name='noticeby']").val(other);
        }
    });
	
	function calculate() {
	    var total = 0;
	    if(jQuery('.activity-checkbox:checked').length > 0){
    	    jQuery('.activity-checkbox:checked').each( function (i) {
                total += parseFloat(jQuery(this).next('.activity-money').html()); 	        
    	    });
    	    jQuery('.total-div').html(total + ' &euro;');    	    
    	    jQuery('.total-container').show('slow');
    	}else{
    	    jQuery('.total-container').hide('slow');
        }
	}
		
	//calculate();
	
});

function payment() {
	var vent = window.open('','payment','width=725,height=725,scrollbars=no,resizable=yes,status=yes,menubar=no,location=no');
	document.forms[0].submit();
}

