//--------------------------------------------------------------------

function ShowPrivacy (div, mode){
	jQuery('#privacyd').slideToggle();
	jQuery(div).slideToggle();
	jQuery('#gallery').slideToggle(); // appare		
	
	if(mode=='close'){
		jQuery('.close').fadeOut();  // scompare
		jQuery('.acconsento').fadeIn(); // appare
		jQuery('.privacyd').fadeIn();	// appare
	}else{
		jQuery('#gallery').hide(); // appare
		jQuery('.close').fadeIn(); // appare
		jQuery('.acconsento').fadeOut(); // scompare
		jQuery('.privacyd').fadeOut(); // scompare
		
	}
}



function loadBook(id, div, request) {

	jQuery(div).html('<div id="loading"></div>');
	jQuery(div).load("index.php?l=it&option=content&id="+id+"&"+request+"=on");	

}


function Contatti(element)
{

	jQuery('#'+element).slideDown('slow');
	
	if(element == 'second')
	{
		if(jQuery('#first:visible')) {
			jQuery('#first').slideUp('slow');
		}else{
			jQuery('#first').slideDown('slow');
		}
			jQuery('#second').hide();			
			jQuery('#frm_tipo_richiesta').attr('value','richiesta informazioni');
		
	}
	
	if(element == 'first')
	{

		if(jQuery('#second:visible')) {
			jQuery('#second').slideUp('slow');
		}else{
			jQuery('#second').slideDown('slow');
		}
			jQuery('#first').hide();					
			jQuery('#frm_tipo_richiesta').attr('value','richiesta preventivo');
	}

}

function SubmitForm(formName, load, fields, thanks, secure)
{
	var d = new Date()
	var param = d.getTime();
	var Secure = jQuery('#'+secure);
	var Form = jQuery('#'+formName);
	var Load = jQuery('#'+load);
	var Field = jQuery('#'+fields);
	var Thanks = jQuery('#'+thanks);
	
	jQuery(Secure).val(param); // -> "inc.contatti.tpl": <input type="hidden" name="secure" id="secure" value="">
	
	//inizio validazione
	var error_found = 0;			
	
	if(error_found==0)
	{

		var options = { 
		
			beforeSubmit: function()
			{
				jQuery(Load).fadeIn('slow');	
	//			jQuery(Field).animate({height: 'toggle', opacity: 'toggle'}, "slow"); NON LAVORA SU IE7
				jQuery(Field).slideUp('slow');	
	
			},
			resetForm: true,
			error: function()
			{
				toConsole('Errore di invio');
				return false;
			},
		    success: function() 
		    { 			    			        
				jQuery(Load).fadeOut('slow');
		    	jQuery(Thanks).slideDown('slow');	
			  return false; 			        
		    } 
		    
		}; 	
		
		
		jQuery(Form).ajaxForm(options); 
	    jQuery(Form).ajaxSubmit(options); 
	}	
	return false;

}


