// JavaScript Document

	function resetForm(form) {
	  $(':input', $(form)).each(function(i, item) {
		switch(item.tagName.toLowerCase()) {
		  case 'input':
			switch(item.type.toLowerCase()) {
			  case 'hidden':
			  case 'text':
				item.value = '';
			  break;
			  case 'radio':
			  case 'checkbox':
				item.checked = '';
			  break;
			}
		  break;
		  case 'select':
			item.selectedIndex = 0;
		  break;
		  case 'textarea':
			item.value = '';
		  break;
		}
	  });
	}


	$(document).ready(function(){
							   
		$('#teaser_wrapper').corner('6px');
		
		$('ul#impressum li a#imprint').toggle(
			function(){
				$('div#impressum_wrapper').animate({ 'height' : 145 },800);
				$('div#impressum_content').fadeIn(1000);
			},function(){
				$('div#impressum_wrapper').animate({ 'height' : 0 },800);
				$('div#impressum_content').fadeOut(600);
		});
		$('div#impressum_wrapper').click(function(){
			$('ul#impressum li a#imprint').trigger('click');
		});
		
		
		$(".callback").fancybox({
								
			'titleShow'		: 	true,
			'transitionIn'	: 	'elastic',
			'transitionOut'	: 	'elastic',
			
			'scrolling'		:	'auto',	// 'auto', 'yes' or 'no'
			'width'			:	303,
			'height'		:	'auto',
			'padding'		:	25,
			
			'autoScale'		:	false,
			'autoDimensions':	false,
			'centerOnScroll':	true,
			
			'overlayShow'	:	true,
			'overlayOpacity':	0.3,
			'overlayColor'	:	'#000',
		
			'speedIn'		: 	400,
			'speedOut'		:	400
			
		});
	
		$(".callback").click(function(){ 
			$('form.call input#Name').focus(); 
			
			$(".call").validationEngine({
				ajaxSubmit: true,
				ajaxSubmitFile: "inc/call.inc.php",
				ajaxSubmitMessage: "Vielen Dank!<br />Ihre Nachricht wurde an uns versendet.",
				success :  false,
				failure : function() {}
			});
			resetForm('.call');
		});
		
		$('a#paragraph').fancybox({
			'titleShow'		: 	false,
			'transitionIn'	: 	'elastic',
			'transitionOut'	: 	'elastic',
			
			'scrolling'		:	'auto',	// 'auto', 'yes' or 'no'
			'width'			:	420,
			'height'		:	'auto',
			'padding'		:	25,
			
			'autoScale'		:	false,
			'autoDimensions':	false,
			'centerOnScroll':	true,
			
			'overlayShow'	:	true,
			'overlayOpacity':	0.3,
			'overlayColor'	:	'#000',
		
			'speedIn'		: 	400,
			'speedOut'		:	400
		});

		$("a[rel^=img_show]").fancybox({
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
				
			'titleShow'		: 	true,
			'transitionIn'	: 	'elastic',
			'transitionOut'	: 	'elastic',
			'scrolling'		:	'no',
			'cyclic'		:	true,
			
			'padding'		:	25,
			
			'overlayShow'	:	true,
			'overlayOpacity':	0.3,
			'overlayColor'	:	'#000',
		
			'speedIn'		: 	400,
			'speedOut'		:	400
				
		});
		/*$("a[rel^=vid_show]").fancybox({
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
				
			'titleShow'		: 	false,
			'transitionIn'	: 	'elastic',
			'transitionOut'	: 	'elastic',
			'scrolling'		:	'no',
			'cyclic'		:	true,
			
			'padding'		:	25,
			
			'overlayShow'	:	true,
			'overlayOpacity':	0.3,
			'overlayColor'	:	'#000',
		
			'speedIn'		: 	400,
			'speedOut'		:	400
				
		});*/
		
		
		// RANDOM KUNDENZITATE
		$('#kdzitate > p.zitat').each(function(){ $(this).hide(); });
		
		$.jQueryRandom = 0;
		$.extend($.expr[":"],
		{
			random: function(a, i, m, r) {
				if (i == 0) { $.jQueryRandom = Math.floor(Math.random() * r.length); };
				return i == $.jQueryRandom;
			}
		});
	/*	
		$('#kdzitate> p').ready(function() {
			for(var j=0;j<=1;j++){
//				alert($("p.zitat:random").css('display')+' // '+$("p.zitat:random").index());
				$("p.zitat:random").show();
			};
		});
		*/
		
		
		$('a.video').each(function(i,e){
			//var size = $(e).attr('rel').split('-');
			
	//if (swfobject.hasFlashPlayerVersion("9.0.18")) {
			$(e).fancybox({
				 'autoScale'            : false,
            'transitionIn'        : 'none',
            'transitionOut'        : 'none',
                
            'transitionIn'    :     'elastic',
            'transitionOut'    :     'elastic',
            
            'padding'        :    25,
            
            'overlayShow'    :    true,
            'overlayOpacity':    0.3,
            'overlayColor'    :    '#000000',
        'showNavArrows' : false,
            'speedIn'        :     400,
            'speedOut'        :    400,
				'type'  : 'swf',
				'padding'		:	25,
				'width':480,
				'height':270,
				'swf':{'flashvars':'v='+$(e).attr('rel')+'&playIcon=#000000&controlsAutoHide=true&autoPlay=true&controlsBg=#666666&controlsBgAlpha=1&fullscreen=false','wmode': 'opaque','allowfullscreen':false,'width':'100%','height':'100%'},
				'onComplete':function(){
					setTimeout(function(){
						$('#fancybox-inner object,#fancybox-inner embed').attr({height:1,width:1})
							.attr({width:$('#fancybox-outer').width()-50,height:$('#fancybox-outer').height()-50})
					}
					,200);
				}
			});
			//}else{
			//	$(e).hide();
			//}
		});
		
		$('#recht').fancybox({
			'titleShow'		: 	false,
			'transitionIn'	: 	'elastic',
			'transitionOut'	: 	'elastic',
			
			'scrolling'		:	'auto',	// 'auto', 'yes' or 'no'
			'width'			:	420,
			'height'		:	'auto',
			'padding'		:	25,
			
			'autoScale'		:	false,
			'autoDimensions':	false,
			'centerOnScroll':	true,
			
			'overlayShow'	:	true,
			'overlayOpacity':	0.3,
			'overlayColor'	:	'#000',
		
			'speedIn'		: 	400,
			'speedOut'		:	400
		});
	});

