



jQuery(document).ready(
	function(){
	
		jQuery('#slogan').innerfade({
			animationtype: 'fade',
			speed: 500,
			timeout: 5000,
			type: 'random',
			containerheight: '388px'
		});
		
		jQuery('#menuist ul>li:last').css({
			marginRight:'0px'
		});

		jQuery('#interne-dx #cert').css({
			marginTop:jQuery('#interne-sx').height()-jQuery('#interne-dx').height()+15+'px'		
		});

		jQuery('.more_info').hide();
		
		
		
		jQuery('#formcontatti').each(
			function(){
				
				var that = jQuery(this);
				var priv1 = jQuery('#formcontatti_n_privacy');
				var priv2 = jQuery('#formcontatti_n_privacy2');
				var submit = jQuery('#submit_formcontatti');
								
				
				var checkCheck = function(){	
						
					if( !priv1.attr('checked') || !priv2.attr('checked') ){
						submit.click(
							function(){
								alert('Consensi privacy obbligatori');
								priv1.parent().find('label').css('color','red');
								priv2.parent().find('label').css('color','red');
								return false;
							}
						);
					}
					else{
						priv1.parent().find('label').css('color','black');
						priv2.parent().find('label').css('color','black');	
						submit.unbind('click');						
					}
					
				}
				
				
				//priv1.click(checkCheck);
				//priv2.click(checkCheck);
				
				//submit.click(checkCheck);
				
				checkCheck();
				priv1.click(checkCheck);
				priv2.click(checkCheck);
				
			}
		);
		
		
		jQuery('#formcontattiinclude').each(
			function(){
				
				var that = jQuery(this);
				var priv1 = jQuery('#formcontattiinclude_n_privacy');
				var priv2 = jQuery('#formcontattiinclude_n_privacy2');
				var submit = jQuery('#submit_formcontattiinclude');
							
							
						
				
				var checkCheck = function(){	
						
					if( !priv1.attr('checked') || !priv2.attr('checked') ){
						submit.click(
							function(){
								alert('Consensi privacy obbligatori');
								priv1.parent().find('label').css('color','red');
								priv2.parent().find('label').css('color','red');
								return false;
							}
						);
					}
					else{
						priv1.parent().find('label').css('color','black');
						priv2.parent().find('label').css('color','black');	
						submit.unbind('click');					
					}
					
				}
				
				
				//priv1.click(checkCheck);
				//priv2.click(checkCheck);
				
				checkCheck();
				priv1.click(checkCheck);
				priv2.click(checkCheck);
				
				

			}
		);
		
	}
);

window.onload = function(){

		var sectorHeight = [];
		
		jQuery('#home_sector .sector').each(
			function(){
				sectorHeight.push(jQuery(this).height());
			}
		);

		jQuery('#home_sector .sector').css({
			height:Math.max(sectorHeight[0],sectorHeight[1],sectorHeight[2])+45+'px'
		});

		jQuery('#home_boxes,#home-banner-form').css({
			height:(Math.max(jQuery('#home-banner-form').height(),jQuery('#home_boxes').height()))+'px'
		});
		
		jQuery('.more_info').show();
}






function open_piva(doc){
	var win_dim = {
		'w':window.innerWidth,
		'h':window.innerHeight
	}
	
	var dim = {
		'w':369,
		'h':232
	};
	window.open(doc,'','status=no,toolbar=no,height='+dim['h']+',width='+dim['w']+',left='+((win_dim['w']-dim['w'])/2)+',top='+(win_dim['h']-dim['h'])/2);
}



