$(document).ready(function(){
			$("a[rel^='prettyPopin']").prettyPopin({width: 550});
			$('.css-scrollbar').scrollbar({arrows:false});
			$("a[rel^='info']").prettyPopin({width: 400});
			$("a[rel^='Photo']").prettyPhoto({theme: 'light_square',default_height: 800,modal: false,social_tools:'',
			overlay_gallery: false});
			$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			opacity: 0.80, /* Value between 0 and 1 */
			showTitle: false, /* true/false */
			allowresize: true, /* true/false */
			default_width: 850,
			default_height: 500,
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			callback: function(){}, /* Called when prettyPhoto is closed */
			
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline clearfix" >{content}</div>',
			social_tools:'',
			overlay_gallery: false
		});
		$jScroller.add("#sc","#scroll","up",2,true);
		$jScroller.start();
		
		$('img.a').hover(function() {  
		$("img.a").stop().fadeTo('normal', 0 , function() {
			
			
		}); 
	} , function() { 
		
			$("img.a").fadeTo('normal',1);
		
		
});
		$("ul.gallery li").hover(function() { 
		
		var thumbOver = $(this).find("img").attr("src"); 
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() 
		}); 
	} , function() {
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
		$("#topnav li").prepend("<span></span>"); 
		$("#topnav li").each(function() { 
		var linkText = $(this).find("a").html(); 
		$(this).find("span").show().html(linkText); 
	}); 
	
	$("#topnav li").hover(function() {	
		$(this).find("span").stop().animate({ 
			marginTop: "-40" 
		}, 250);
	} , function() { 
		$(this).find("span").stop().animate({
			marginTop: "0" 
		}, 250);
	});
	
	 $("#formulario").validationEngine({
		
				ajaxSubmit: false,
				liveEvent:false,
				promptPosition: "topLeft",
				
					ajaxSubmitFile: "../ricerca/ricerca.php",
					ajaxSubmitMessage: "Thank you, we received your inscription!",
				success : function() {return true}
				
				
				,
				failure : function() {return false}
			})
			
		$('#cerca').click(function() { 
				if($("#formulario").validationEngine({returnIsValid:true})){
					var nome = $("#nome").val();  
					var tipologia = $("#tipologia").val();  
					var produttore = $("#produttore").val();  
					var anno = $("#anno").val(); 
					var size = $("#size").val(); 
					var dataString = '&tipologia='+ tipologia + '&nome=' + nome + '&produttore=' + produttore+ '&anno=' + anno+ '&size=' + size;  
				$.ajax({
        type: "POST",
        url: "../ricerca/ricerca.php",
        async: true,
       
        data: dataString,
        success: function(data){
          $("#over").html(data);
		
		
		$.prettyPhoto.open('#risultato');
		
		
		 
        },
        error: function(xml,msg){
          $("#over").text("Error");
        }
		
      });}
      return false;})	
		});
		
		
