$(document).ready(function(){
	
	/*$('a.katalog').nyroModal({width: 950, height: 550});	
	$('a.full').nyroModal({width: 950, height: 550});		
	$('a.small').nyroModal({width: 600, height: 450});	
	$('a.essentials').nyroModal({width: 810, height: 600});*/
	
	$("a.katalog").fancybox({
				'autoDimensions'	: true,
				'width'				: '950',
				'height'			: '550',
				'autoScale'			: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titleShow'		: false,
				'padding'		: 10

			});
			
	$("a.full").fancybox({
				'autoDimensions'	: true,
				'width'				: '100%',
				'height'			: '100%',
				'autoScale'			: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titleShow'			: false,
				'padding'			: 10,
			 	'frameWidth'        : '950',
            	'frameHeight'       : '550'
			});
			
	$("a.small").fancybox({
				'width'				: '600',
				'height'			: '450',
				'autoScale'			: true,
				'autoDimensions'	: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titleShow'		: false,
				'padding'		: 10
			});
			
	$("a.essentials").fancybox({
				'width'				: '810',
				'height'			: '600',
				'autoScale'			: true,
				'autoDimensions'	: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titleShow'		: false,				
				'padding'		: 10
			});
			
	
 $("a.overlay-flash").fancybox({
				'width'				: '810',
				'height'			: '600',
				'autoScale'			: true,
				'autoDimensions'	: true,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type'				: 'iframe',
				'titleShow'		: false,				
				'padding'		: 10
 });
	
	$('#tabs').smartTab({
	      selected: 1,  // Selected Tab, 0 = first step   
	      keyNavigation:true, // Enable/Disable key navigation
	      autoProgress:true, // Auto navigate tabs on interval
	      progressInterval: 3500, // Auto navigate Interval
	      stopOnFocus:true, // Stops autoProgress on mouse hover and restarts when not
	      transitionEffect:'none', // Effect on navigation, none/fade/slide
	      tabContainerClass:'tabContainer' // tab container css class name
	}); 
	
		
	$('#search').focus(function(){
	var newValue = $(this).val();
	if($(this).val() == 'suche…'){
	$(this).attr('value','');
	} else {
	$(this).val(newValue);
	}
	});
	
	$('#search').blur(function(){
	var newValue = $(this).val();
	if($(this).val() == ''){
	$(this).attr('value','suche…');
	} else {
	$(this).val(newValue);
	}
	}); 

});

$(function() {
	// News-Accordion
	$("#newsAccordion").accordion({ header: "h3",event: 'mouseover', autoHeight: false  });
			
	// freebie Accordion
	$(".freebieAccordion").accordion({ header: "#hdrFreebie",event: 'click', autoHeight: false, active:0 });
	// accordion form issue fix
	$('.freebieAccordion').find('input').click(function (e) { e.stopPropagation(); });
	$('.freebieAccordion').find('label').click(function (e) { e.stopPropagation(); });
	$('.freebieAccordion').find('select').click(function (e) { e.stopPropagation(); });
	$('.freebieAccordion').find('textarea').click(function (e) { e.stopPropagation(); });

	
	$('#freebieCats li').click(function(){
		//var myId = $(this).attr('id');
		var selIndex = $("#freebieCats li").index(this);
		$('#freebieCats li').each(function(index){
			var curIndex = index;
			//var curClass = $(this).attr('class');
			
			if (curIndex == selIndex){
				var newClass = 'focus';
				var duration = 600;
			}
			
			if (curIndex != selIndex){
				var newClass = 'off';
				var duration = 550;						
			}
			
			$(this).addClass(newClass, duration);
			
		});
		return false;	
	});
	
	$('a.back').click(function(){
		$('#freebieCats li').each(function(index){
			var curClass = $(this).attr('class');
			var duration = 0;		
			
			$(this).removeClass(curClass, duration);
		});			
		return false;	
	});
});


