h_start_pappel=new Array('11:00:00','08:00:00','08:00:00','08:00:00','08:00:00','08:00:00','11:00:00');
h_end_pappel=new Array('22:00:00','23:59:59','23:59:59','23:59:59','23:59:59','23:59:59','22:00:00');

h_start_uni=new Array('-','08:00:00','08:00:00','08:00:00','08:00:00','08:00:00','-');
h_end_uni=new Array('-','19:00:00','19:00:00','19:00:00','19:00:00','19:00:00','-');

h_start_box=new Array('-','08:00:00','08:00:00','08:00:00','08:00:00','08:00:00','11:00:00');
h_end_box=new Array('-','21:00:00','21:00:00','21:00:00','21:00:00','21:00:00','18:00:00');

h_start_py=new Array('-','08:00:00','08:00:00','08:00:00','08:00:00','08:00:00','11:00:00');
h_end_py=new Array('-','19:00:00','19:00:00','19:00:00','19:00:00','19:00:00','18:00:00');
 	 
h_zeiten=new Array();
h_zeiten[0]=new Array(h_start_pappel,h_end_pappel);
h_zeiten[1]=new Array(h_start_uni,h_end_uni);
h_zeiten[2]=new Array(h_start_box,h_end_box);
h_zeiten[3]=new Array(h_start_py,h_end_py);



/*.....funktion für Suckerfish-menu.........*/
			sfHover = function() {
				var sfEls = document.getElementById("mainnavi").getElementsByTagName("LI");
				for (var i=0; i<sfEls.length; i++) {
					sfEls[i].onmouseover=function() {
						this.className+=" sfhover";
					}
					sfEls[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
					}
				}
			}
			
/*......Funktion für ändern der Uhr auf den nächsten tag....*/	
			function setStatus($id,$status){
				if($status){
					$('#'+$id).css("background","none").css('color','#FFF');
					$("#tab-counter-nav a[href=#"+$id+"]").css('color','#FFF');
				}else{
					$('#'+$id).css("background","url('files/images/closed_unten.gif') no-repeat 0 0px").css('color','#F3B012');
					$("#tab-counter-nav a[href=#"+$id+"]").css('color','#F3B012');
				}
			}
		
			function liftOff(loc){
				if(loc != undefined){
					$this = $('.uhr[data-tab="'+loc+'"]');
					$.getJSON('files/php/zeitmatrix.php?ajax=1&actor='+loc, function(data) {
						var adate = parseInt(data.end)*1000;
						setStatus($this.attr('id'),data.status);
						$this.countdown('change', {until: new Date(adate)});
					});
				}
				
			}
			
			
			
			
			function checkDate(i,dayc)
			{
			wochentag=heute+dayc;
			
			if(wochentag>6)wochentag=0;
			
			var zeit = h_zeiten[i][oeffzeit][wochentag];
			//if(zeit=='-')zeit=now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
			//if(zeit=='-')dayc+=1;
			var help=zeit.split(":");
			var zieldatum = new Date(now.getFullYear(),now.getMonth(),now.getDate(),help[0],help[1],help[2]);
			var nullTime =  new Date(now.getFullYear(),now.getMonth(),now.getDate(),23,59,59);
			var nullnullTime =  new Date(now.getFullYear(),now.getMonth(),now.getDate(),0,0,0);
			var zielzeit =zieldatum.getTime();
			var diff=(zielzeit-now.getTime());
			//alert(dayc);
			if(dayc>0 && zeit!='-'){
			
				//if(zielzeit<now.getTime()){
				if(diff<0){	
					var tage=(dayc-1)*86400000;
					diff=tage+((zielzeit-nullnullTime.getTime())+(((nullTime.getTime())-now.getTime())));
					
					}else{
					var tage=daycounter*86400000;
					diff=((tage+zielzeit)-now.getTime());
					}
					
			};
			
			var minuten = Math.round(diff/(1000));
			if(isNaN(minuten))minuten=0;
			
			if((minuten>0 || dayc>0)&& minuten!=0){
				var finished = minuten + 's';//daycounter +'d '+
				//alert(finished);
			}else{
				
				skin=true;
				oeffzeit=0;
				finished = checkDate(i,dayc+1);
			}
			
			return finished;
			
			}
			
/*......Funktion zum initialisieren der Uhr...*/			
            function init(){
				// h_days=new Array('Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday','Sunday');
				// var liftoff = new Array(h_zeiten.length);
				// for (var i = 0; i < h_zeiten.length; i++){
					// tag=now.getDate();
					// heute=now.getDay();
					// daycounter=0;
					// oeffzeit=1;
					// skin=false;
					// liftoff = checkDate(i,daycounter);
					// if(skin==true){ 
						// $('#counter'+(i+1)+'1').css("background","url('files/images/closed_unten.gif') no-repeat 0 0px").css('color','#F3B012');
						// $("#tab-counter-nav a[href=#counter"+(i+1)+"1]").css('color','#F3B012');
					// }
					// var a=i;
					// $('#counter'+(a+1)+'1').attr('rel',a).countdown({until: liftoff, format: 'hMS',layout: '{hnn}h {mnn}min {snn}sec',onExpiry: function(){liftOff($(this).attr('rel'));}});
				// }
				
				$('.uhr',$('#tab-counter')).each(function(){
					var $this = $(this);
					var adate = parseInt($this.attr('data-time'))*1000;
					var status = parseInt($this.attr('data-status'));
					var actor = $this.attr('data-tab');
					setStatus($this.attr('id'),status);
					$this.countdown({until: new Date(adate), format: 'hMS',layout: '{hnn}h {mnn}min {snn}sec',onExpiry: function(){liftOff(actor);}});
				})

            }

/*....Funktionen für die Footeranimation....*/            
			function makeTall(){  
				$(this).css({background:"#fff url('files/images/popup_footer.png') no-repeat"});
				$(this).animate({
				"height":325,
				"marginTop":-225
				},300);
			;}
			function makeShort(){ 
				$(this).css({background:"none"});
						$(this).animate({
				"height":105,
				"marginTop":0,
				"opacity":1

				},200);
			;}
			
/*....document.ready....*/			
			$(document).ready(function(){
			 $('.showhide').click(function(){
			 $('.hide').show();
			 })
			 $('.hidehide').click(function(){
			 $('.hide').hide();
			 })
					zeitarray=jQuery("#javascript-timer-init").attr('title').split(",");
					zeitarray[1]=zeitarray[1]-1;
					if(zeitarray[1]<0)zeitarray[1]=0;
					now=new Date(zeitarray[0],zeitarray[1],zeitarray[2],zeitarray[3],zeitarray[4],zeitarray[5]);
					heute=now.getDay();
					heute2=heute;
					init();
					sfHover;
					$('#contentimage').cycle({ 
						fx:      'fade', 
						speedIn:  1000, 
						speedOut: 500, 
						nowrap:  1,
						timeout: 6000,
						random:1, 
						pauseOnPagerHover:true,
						delay:   -2000
					 });
					var config = {    
									 sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
									 interval: 200, // number = milliseconds for onMouseOver polling interval    
									 over: makeTall, // function = onMouseOver callback (REQUIRED)    
									 timeout: 500, // number = milliseconds delay before onMouseOut    
									 out: makeShort // function = onMouseOut callback (REQUIRED)    
								};

			$("li .anim").hoverIntent(config);
			 $('a.thickbox').fancybox({'zoomSpeedIn':300,'zoomSpeedOut':300,'imageScale':true,'hideOnContentClick': false});
			 $(".bigger").hover(
			 function(){
			 $(this).parent().css('z-index','30');
			 $(this).stop().animate({fontSize:"14px",width:"222px",height:"150px",marginTop:"-50px"},500).css("border-right","10px solid #fff");
			 },
			 function(){
			 $(this).parent().css('z-index','0');
			  $(this).stop().animate({width:"195px",height:"101px",fontSize:'10px',borderRight:0,marginTop:0},500).find('p');
			 }
			 );
			  $(".bigger2").hover(
			 function(){
			 $(this).parent().css('z-index','110');
			 $(this).stop().animate({fontSize:"+=6",width:"222px",height:"150px",marginTop:0},500).css({"border-right":"10px solid #fff","border-bottom":"10px solid #fff"});
			 $(this).find('a,div,span').stop().animate({fontSize:"+=2"},500);
			 $(this).find('h4').stop().animate({fontSize:"+=4"},500);
			  $(this).find('img').stop().css({width:"100%",height:"100%"});
			 },
			 function(){
			 $(this).parent().css('z-index','0');
			  $(this).animate({width:"195px",height:"141px",fontSize:"-=6",borderRight:0,borderBottom:0,marginTop:0},500).find('p');
			  $(this).find('a,div,span').animate({fontSize:"-=2"},500);
			   $(this).find('h4').animate({fontSize:"-=4"},500);
			 }
			 ).css('height',141);
		}); // close document.ready


