jQuery(document).ready(


	function(){


	jQuery('#mainMenu').jmenu({
            speed:250
        });




		jQuery('#submitnewsletter').each(
			
			function(){
				
				if(!jQuery('#privacy').attr('checked')){
					
					jQuery('#submitnewsletter').click(
						function(){
							return false;
						}
					);
					
				}
				
				jQuery('#privacy').change(
					function(){
						
						if(!jQuery('#privacy').attr('checked')){
					
							jQuery('#submitnewsletter').click(
								function(){
									return false;
								}
							);
							
						}
						else{
					
							jQuery('#submitnewsletter').unbind('click');
							
						}
						
					}
				);
				
			}
		);
		
		
		
		jQuery('#interne-formcontatti').each(
			
			function(){
				
				if(!jQuery('#privacy').attr('checked')){
					
					jQuery('#cfContact').click(
						function(){
							return false;
						}
					);
					
				}
				
				jQuery('#privacy').change(
					function(){
						
						if(!jQuery('#privacy').attr('checked')){
					
							jQuery('#cfContact').click(
								function(){
									return false;
								}
							);
							
						}
						else{
					
							jQuery('#cfContact').unbind('click');
							
						}
						
					}
				);
				
			}
		);

		
		
		jQuery('#homeslider').innerfade({
						speed: 1000,
						timeout: 5000,
						type: 'sequence',
						containerheight: '445px'
					});
		jQuery('#homeslider').css({position:'absolute'});

		jQuery("#menuist ul li").hover(function(){
    
        jQuery(this).addClass("hover");
        jQuery('ul:first',this).css('visibility', 'visible');
    
    }, function(){
    
        jQuery(this).removeClass("hover");
        jQuery('ul:first',this).css('visibility', 'hidden');
    
    });
    
  	
  	
  	
  	
		/* javascript che sistema il menu */
		
		jQuery('#mainMenu>.ul>.li>.ul>.li a.last').css({
			border:'none'
		});
	
		
		

	jQuery('#wrapper').each(
			function(){
				
				var firstVisibleIndex = 0;
				var elNo = jQuery('.el',that).length;
				
				var that = this;
				
				jQuery('.arrow-up',that).click(
					function(){
						
						if(firstVisibleIndex>=1){
						
							jQuery('.wrapper-content',that).stop().scrollTo(jQuery('.el:eq('+(firstVisibleIndex-1)+')',that),500);
							firstVisibleIndex--;
						
						}
						
					}
				);
				
				jQuery('.arrow-down',that).click(
					function(){
					
					var nel = 1;
					if(elNo > 2){ nel = 2; }
					
						if(firstVisibleIndex<elNo-nel){
						
							jQuery('.wrapper-content',that).stop().scrollTo(jQuery('.el:eq('+(firstVisibleIndex+1)+')',that),500);
							firstVisibleIndex++;
						
						}
						
					}
				);
				
			}
		);	

		
		var content = jQuery('#full').height();
		var contentp = parseInt(jQuery('#full').css('padding-top'))+parseInt(jQuery('#full').css('padding-bottom'));
		var container = jQuery('#testo').height();
		var wrapper = jQuery('.page .content').height();
		var briciola = jQuery('#briciola').height();
		var menuist = jQuery('#menuist').height();
		
		if((content+contentp)<(wrapper-briciola-menuist)){
			var tot = wrapper-menuist-briciola-contentp;
			//jQuery('#full').css({height:tot+'px'});
		}
		
		jQuery('#formcontatti').each(
			function(){
				
				if(!jQuery('#formcontatti_privacycheck').attr('checked')){
					
					jQuery('#submit_formcontatti').click(
						function(){
							return false;
						}
					);
					
				}
				
				jQuery('#formcontatti_privacycheck').change(
					function(){
						
						if(!jQuery('#formcontatti_privacycheck').attr('checked')){
					
							jQuery('#submit_formcontatti').click(
								function(){
									return false;
								}
							);
							
						}
						else{
					
							jQuery('#submit_formcontatti').unbind('click');
							
						}
						
					}
				);
				
			}
		);
		
		/*
		var cheight = jQuery('.content').height();
		var theight = jQuery('#testo').height();
		
		jQuery('.content').css('height', cheight + 10 + 'px');
		jQuery('#testo').css('height', theight + 10 + 'px');
		*/
		
	}
	
	
);

