﻿$(document).ready(function(){
  			
	  			$(".sn").css({ "opacity": 0.4}).hover(function(){
					$(this).animate({ "opacity": 1}, 200);
				},function(){
					$(this).animate({ "opacity": 0.4}, 200);
				});

 				 
 				 $("a.print").button({text: true,icons: {primary: 'ui-icon-print'}});
 				 $("a.button").button({text: true});
 				 $("input:submit").button({text: true});
  
  
  				 $(".buttonset").buttonset();
  				 
  	//			 $(".buttonset_top").buttonset();
  	//			 $(".buttonset_top").find("a")
  	//			 	.filter(":first").removeClass("ui-corner-left").addClass("ui-corner-tl").end()
  	//			 	.filter(":last").removeClass("ui-corner-right").addClass("ui-corner-tr").end()
  	//			 	.filter(".active").addClass("ui-state-disabled").end();
  				 
  	//			 $(".buttonset_bottom").buttonset();
  	//			 $(".buttonset_bottom").find("a")
  	//			 	.filter(":first").removeClass("ui-corner-left").addClass("ui-corner-bl").end()
  	//			 	.filter(":last").removeClass("ui-corner-right").addClass("ui-corner-br").end()
  	//			 	.filter(".active").addClass("ui-state-disabled").end();

 				 
  				 
				 $('#homebutton').button({text: true,icons: {primary: 'ui-icon-home'}});
				 $('#newsbutton').button({text: true,icons: {primary: 'ui-icon-calendar'}});
				 $('#kontaktbutton').button({text: true,icons: {primary: 'ui-icon-mail-closed'}});
				 $('#imressumbutton').button({text: true,icons: {primary: 'ui-icon-info'}});
				 $('#pressbutton').button({text: true,icons: {primary: 'ui-icon-comment'}});
				 
				 $('#search').button({text:true,icons:{primary: 'ui-icon-search'}}).click(function(){$('#suche').focus();});
			 	 $('#searchgo').button({text:true,icons:{primary: 'ui-icon-play'}});
			
				 $('#produktselector').button({text: true,icons: {primary: 'ui-icon-arrowthick-1-e'}})
				 	.removeClass("ui-state-default").addClass("ui-state-error").end();
				
				 //$("a.bestellen").button({text: true,icons: {primary: 'ui-icon-cart'}});
				
				 $('a.bestellen').button({text: true,icons: {primary: 'ui-icon-arrowthick-1-e'}})
				 	.removeClass("ui-state-default").addClass("ui-state-error").end();

			
			$("#suche").addClass("ui-corner-all");
			
		$("#suche").autocomplete({
			source: function(request, response) {
				$.ajax({
					url: "ajaxsearch.php",
					contentType: "application/json; charset=ISO-8859-1",
					dataType: "json",
					data:{search:request.term},
					success: function(data) {response(data);}
				});
			},
			minLength: 2,
			open: function() {$(this).removeClass("ui-corner-all").addClass("ui-corner-top");$(".ui-autocomplete").removeClass("ui-corner-all").addClass("ui-corner-bottom");},
			close: function() {$(this).removeClass("ui-corner-top").addClass("ui-corner-all");}
		});
		
	
		    $('#logo').click(function () { 
		      window.location.href = 'default.php';
		    });
		    
		  
//			$("a.fancy").fancybox({
//				overlayShow			: true,
//				overlayOpacity		: 0.4,
//				overlayColor		: '#eee',
//				titlePosition		: 'inside',
//			    'transitionIn'		: 'elastic',
//				'transitionOut'		: 'elastic',
//				'hideOnContentClick': true,
//				centerOnScroll      : true
//			});


			$("a.fancy").prettyPhoto({theme: 'light_rounded',
									opacity: 0.80,
									show_title: false,
									modal: false,
									overlay_gallery: true,
									allow_resize: true
									});
	
	
	
			//Tabs
			$("#tabs").tabs({cookie: { expires:5000, name: 'tabs' } });
    		

		    
		    
		    

});
