jQuery(document).ready(function(){

	jQuery('.linkstop,.linksbottom').pngFix();
	
	var heightContenuto = jQuery('.contenuto').outerHeight();
	var heightLink = jQuery('.links').outerHeight();


	jQuery('#news').innerfade({
		animationtype: 'slide',
		speed: 750,
		timeout: 2000,
		type: 'random',
		containerheight: '1em'
	});

	if(heightLink>heightContenuto){
		jQuery('.contenutotop').css({height:(heightLink-30)+'px'});
		jQuery('.contenutobottom').css({background:'url(immagini/cbottom_g.png)'});
	}
	
	/*
	
	jQuery('.date-pick').val(new Date().asString()).DatePicker({
		format:'d/m/Y',
		date: jQuery('.date-pick').val(),
		current: jQuery('.date-pick').val(),
		starts: 1,
		position: 'r',
		onBeforeShow: function(){
			jQuery('.date-pick').DatePickerSetDate(jQuery('.date-pick').val(), true);
		},
		onChange: function(formated, dates){
			jQuery('.date-pick').val(formated);
			if ($('#closeOnSelect input').attr('checked')) {
				jQuery('.date-pick').DatePickerHide();
			}
		}
	});
	
	*/
	
	jQuery('.formX_wrapper').each(function(){
		var curel = this;
		if(jQuery('#n_privacy_container input',curel).length>0){
			if(!jQuery('#n_privacy_container input',curel).attr('checked')){
				jQuery('.submit_formX',curel).attr('disabled','disabled');
			}
			jQuery('#n_privacy_container input',curel).bind(
				'change',
				function(){
					if(jQuery(this).attr('checked')){
						jQuery('.submit_formX',curel).attr('disabled','');
					}
					else{
						jQuery('.submit_formX',curel).attr('disabled','disabled');
					}
				}
			);
		}
		
	});
	
});

