/*
 * 	Easy Slider 1.7 - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	markup example for $("#slider").easySlider();
 *	
 * 	<div id="slider">
 *		<ul>
 *			<li><img src="images/01.jpg" alt="" /></li>
 *			<li><img src="images/02.jpg" alt="" /></li>
 *			<li><img src="images/03.jpg" alt="" /></li>
 *			<li><img src="images/04.jpg" alt="" /></li>
 *			<li><img src="images/05.jpg" alt="" /></li>
 *		</ul>
 *	</div>
 *
 */

 (function($) {
	
	$.fn.easySlider_ciando = function(options){
	  
		// default configuration properties
		var defaults = {			
			prevId: 		'prevBtn_frame',
			prevText: 		'&nbsp;',
			nextId: 		'nextBtn_frame',	
			nextText: 		'&nbsp;',
			controlsShow:	true,
			controlsBefore:	'',
			controlsAfter:	'',	
			controlsFade:	true,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			800,
			auto:			false,
			pause:			2000,
			continuous:		false, 
			numeric: 		false,
			numericId: 		'controls'
		}; 
		
		
		
		var options = $.extend(defaults, options);  
				
		this.each(function() {  
			var obj = $(this); 				
			var s = $("li", obj).length;
			var w = $("li", obj).width(); 
			var h = $("li", obj).height(); 
			var clickable = true;
			obj.width(w); 
			obj.height(h); 
			obj.css("overflow","hidden");
			var ts = s-1;
			var t = 0;
			$("ul", obj).css('width',s*w);			
			
			if(options.continuous){
				$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
				$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
				$("ul", obj).css('width',(s+1)*w);
			};s				
			
			if(!options.vertical) $("li", obj).css('float','left');
								
			if(options.controlsShow){
				var html = options.controlsBefore;				
				if(options.numeric){
					html += '<ol id="'+ options.numericId +'"></ol>';
				} else {
					if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
					html += ' <span id="'+ options.prevId +'"><a id="bu" href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
					html += ' <span id="'+ options.nextId +'"><a id="ba" href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
					if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';				
				};
				
				html += options.controlsAfter;						
				$(obj).after(html);										
			};
			
			if(options.numeric){									
				for(var i=0;i<s;i++){						
					$(document.createElement("li"))
						.attr('id',options.numericId + (i+1))
						.html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
						.appendTo($("#"+ options.numericId))
						.click(function(){							
							animate($("a",$(this)).attr('rel'),true);
						}); 												
				};							
			} else {
				$("a","#"+options.nextId).click(function(){		
					animate("next",true);
				});
				$("a","#"+options.prevId).click(function(){		
					animate("prev",true);				
				});	
				$("a","#"+options.firstId).click(function(){		
					animate("first",true);
				});				
				$("a","#"+options.lastId).click(function(){		
					animate("last",true);				
				});				
			};
			
			function setCurrent(){
				i = parseInt(i)+1;
				$("li", "#" + options.numericId).removeClass("current");
				$("li#" + options.numericId + i).addClass("current");
			};
			
			
			function adjust(){
				if(t>ts) t=0;		
				if(t<0) t=ts;	
				if(!options.vertical) {
					$("ul",obj).css("margin-left",(t*w*-1));
				} else {
					$("ul",obj).css("margin-left",(t*h*-1));
				}
				clickable = true;
				if(options.numeric) setCurrent(t);
			};
			
			
			/*----------------------------test-------------------------------*/
			if(s==1){
						$("a","#"+options.nextId).hide();
					};
			
		
		/* if(jc){
			var seite2 = '';
			var seite3 = '';
		} */
		//Walter der folgende Quellcode ist nicht für deine Augen bestimmt aber auf jeden Fall muss eine andere Lösung her, da diese fatal ist.
		if(jc==50 || jc==31 || jc==57 || jc==64 || jc==54){var seite3=1;};
		if(jc==14 || jc==10 || jc==386 || jc==245 || jc==12 || jc==318 || jc==200 || jc==5 || jc==219 || jc==833 || jc==815 || jc==4 || jc==403
			 || jc==27 || jc==22 || jc==299 || jc==16 || jc==21 || jc==40 || jc==44 || jc==41 || jc==61 || jc==997 || jc==35 || jc==46 || jc==30
			 || jc==52 || jc==979 || jc==59 || jc==43 || jc==55 || jc==1049 || jc==62 || jc==836 || jc==48 || jc==70 || jc==73 || jc==80 || jc==81
			 || jc==94  || jc==68 || jc==817 || jc==77 || jc==87 || jc==89 || jc==76 || jc==285 || jc==123 || jc==124 || jc==125 || jc==769 || jc==1202
    	 || jc==130 || jc==127 || jc==823 || jc==128 || jc==446 || jc==133 || jc==129 || jc==144 || jc==145 || jc==151 || jc==162 || jc==165
 			 || jc==146 || jc==150 || jc==821 || jc==158 || jc==147 || jc==212 || jc==164 || jc==374 || jc==198 || jc==201 || jc==809 || jc==173
			 || jc==264 || jc==199 || jc==172 || jc==179 || jc==191 || jc==178 || jc==186 || jc==233 || jc==376 || jc==384 || jc==811 || jc==235
			 || jc==406 || jc==14 || jc==10 || jc==386 || jc==245 || jc==12 || jc==318 || jc==200 || jc==5 || jc==219 || jc==833 || jc==815
			 || jc==4 || jc==403 || jc==27 || jc==22 || jc==299 || jc==16 || jc==21 || jc==126){var seite2=1;};
		
		if(typeof jc == "undefined") {	 
			
		} else {
						
			//seite3 Unterkategorien
			if(seite3==1){
				var p = -1100;
				var t = 2;
				var ts = 3; 
				$("ul",obj).css("margin-left",(-1100));
					$("a","#"+options.prevId).click(function(){		
						animate("prev",true);
					});
					
					$("a","#"+options.nextId).click(function(){		
						animate("next",true);
					});
			}
			
			//seite2 Unterkategorien
			if(seite2==1){
				var p = -550;
				var t = 1;
				var ts = 2; 
				$("ul",obj).css("margin-left",(-550));
					$("a","#"+options.prevId).click(function(){		
						animate("prev",true);
					});
					
					$("a","#"+options.nextId).click(function(){		
						animate("next",true);
					});
			}
		}
			
		/*----------------------------test--------------------------/	
			
/************************************/			
			
		/* ts steht für die anzahl der Seiten. der Pfeil wird versteckt, wenn es nicht mehr als eine Seite mit Kategorien gibt */
		/*if(ts==0) {
			$("a","#"+options.nextId).hide();
		} 
		
		if(jc==14 || jc==10 || jc==386 || jc==245 || jc==12 || jc==318 || jc==200 || jc==5 || jc==219 || jc==833 || jc==815 || jc==4 || jc==403
			 || jc==27 || jc==22 || jc==299 || jc==16 || jc==21 || jc==19 || jc==136 || jc==167 || jc==41 || jc==61 || jc==997 || jc==35 || jc==46
			 || jc==30 || jc==52 || jc==979 || jc==59 || jc==43 || jc==55 || jc==1049 || jc==62 || jc==836 || jc==48 || jc==70 || jc==80 || jc==81
			 || jc==94  || jc==68 || jc==817 || jc==77 || jc==87 || jc==89 || jc==76 || jc==285 || jc==123 || jc==124 || jc==125 || jc==769
			 || jc==1202 || jc==130 || jc==127 || jc==823 || jc==128 || jc==446 || jc==133 || jc==129 || jc==145 || jc==151 || jc==162 || jc==165
 			 || jc==146 || jc==150 || jc==821 || jc==158 || jc==147 || jc==212 || jc==164 || jc==374 || jc==198 || jc==201 || jc==809 || jc==173
			 || jc==264 || jc==199 || jc==172 || jc==179 || jc==191 || jc==178 || jc==186 || jc==233 || jc==376 || jc==384 || jc==811 || jc==235
			 
			 || jc==54 || jc==64 || jc==57 || jc==50 || jc==31 || jc==934 || jc==66 || jc==78 || jc==98 || jc==85 || jc==67 || jc==79 || jc==92
			 || jc==93 || jc==88 || jc==284 || jc==1213 || jc==234 || jc==819 || jc==307 || jc==303 || jc==121 || jc==122 || jc==126 || jc==131
			 || jc==163 || jc==171 || jc==196 || jc==197 || jc==192 || jc==237 || jc==294 || jc==322 || jc==308 || jc==236 || jc==226 || jc==231
			 || jc==234 || jc==317 || jc==406 || jc==243 || jc==74){var seite2=1;};
		
		if(typeof jc == "undefined") {	 
			
		} else {
						
			//seite2 Unterkategorien
			if(seite2==1){
				var p = -580;
				var t = 1;
				var ts = 1; 
				$("ul",obj).css("margin-left",(-580));
					$("a","#"+options.prevId).click(function(){		
						animate("prev",true);
					});
					
					$("a","#"+options.nextId).click(function(){		
						animate("next",true);
					});
					//gibt es keine weitere Seite mit Kategorien wird der "next-Pfeil" ausgeblendet
					$("a","#"+options.nextId).hide();
			}
		}*/
			

/* ********************************************************************* */
			
			function animate(dir,clicked){
				if (clickable){
					clickable = false;
					var ot = t;				
					switch(dir){
						case "next":
							t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;						
							break; 
						case "prev":
							t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
							break; 
						case "first":
							t = 0;
							break; 
						case "last":
							t = ts;
							break; 
						default:
							t = dir;
							break; 
					};	
					var diff = Math.abs(ot-t);
					var speed = diff*options.speed;						
					if(!options.vertical) {
						p = (t*w*-1);
						$("ul",obj).animate(
							{ marginLeft: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);				
					} else {
						p = (t*h*-1);
						$("ul",obj).animate(
							{ marginTop: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);					
					};
					
					if(!options.continuous && options.controlsFade){					
						if(t==ts){
							$("a","#"+options.nextId).hide();
							$("a","#"+options.lastId).hide();
						} else {
							$("a","#"+options.nextId).show();
							$("a","#"+options.lastId).show();					
						};
						if(t==0){
							$("a","#"+options.prevId).hide();
							$("a","#"+options.firstId).hide();
						} else {
							$("a","#"+options.prevId).show();
							$("a","#"+options.firstId).show();
						};					
					};				
					
					if(clicked) clearTimeout(timeout);
					if(options.auto && dir=="next" && !clicked){;
						timeout = setTimeout(function(){
							animate("next",false);
						},diff*options.speed+options.pause);
					};
			
				};
				
			};
			// init
			
			var timeout;
			if(options.auto){;
				timeout = setTimeout(function(){
					animate("next",false);
				},options.pause);
			};		
			
			if(options.numeric) setCurrent();
		
			if(!options.continuous && options.controlsFade){					
				$("a","#"+options.prevId).hide();
				$("a","#"+options.firstId).hide();				
			};				
			
			// wird die zweite Seite mit Kategorien angezeigt muss der "prev-Button" eingeblendet werden 
			/*if(p==-580){
					$("a","#"+options.prevId).show();
				}
				*/

				/*------------------------------test-----------------------------------*/
					/*steuert das ein-und ausblenden der Pfeile*/
			if(jcookie_container==4){
				if(p==-550){
					$("a","#"+options.prevId).show();
					$("a","#"+options.nextId).hide();
				}
			}
			
			if(jcookie_container==5){
				if(p==-0){
					$("a","#"+options.prevId).hide();
					$("a","#"+options.nextId).show();
				}
				if(p==-550){
					$("a","#"+options.prevId).show();
					$("a","#"+options.nextId).show();
				}
				if(p==-1100){
					$("a","#"+options.prevId).show();
					$("a","#"+options.nextId).hide();
				}
			}
			/**/
			
		});
	  
	};

})(jQuery);


/*
 (function($) {
	
	$.fn.easySlider = function(options){
	  
		// default configuration properties
		var defaults = {			
			prevId: 		'prevBtn',
			prevText: 		'<',
			nextId: 		'nextBtn',	
			nextText: 		'>',
			controlsShow:	true,
			controlsBefore:	'',
			controlsAfter:	'',	
			controlsFade:	true,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			800,
			auto:			false,
			pause:			2000,
			continuous:		false, 
			numeric: 		false,
			numericId: 		'controls'
		}; 
		
		
		
		var options = $.extend(defaults, options);  
				
		this.each(function() {  
			var obj = $(this); 				
			var s = $("li", obj).length;
			var w = $("li", obj).width(); 
			var h = $("li", obj).height(); 
			var clickable = true;
			obj.width(w); 
			obj.height(h); 
			obj.css("overflow","hidden");
			var ts = s-1;
			var t = 0;
			$("ul", obj).css('width',s*w);			
			
			if(options.continuous){
				$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
				$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
				$("ul", obj).css('width',(s+1)*w);
			};s				
			
			if(!options.vertical) $("li", obj).css('float','left');
								
			if(options.controlsShow){
				var html = options.controlsBefore;				
				if(options.numeric){
					html += '<ol id="'+ options.numericId +'"></ol>';
				} else {
					if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
					html += ' <span id="'+ options.prevId +'"><a id="bu" href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
					html += ' <span id="'+ options.nextId +'"><a id="ba" href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
					if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';				
				};
				
				html += options.controlsAfter;						
				$(obj).after(html);										
			};
			
			if(options.numeric){									
				for(var i=0;i<s;i++){						
					$(document.createElement("li"))
						.attr('id',options.numericId + (i+1))
						.html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
						.appendTo($("#"+ options.numericId))
						.click(function(){							
							animate($("a",$(this)).attr('rel'),true);
						}); 												
				};							
			} else {
				$("a","#"+options.nextId).click(function(){		
					animate("next",true);
				});
				$("a","#"+options.prevId).click(function(){		
					animate("prev",true);				
				});	
				$("a","#"+options.firstId).click(function(){		
					animate("first",true);
				});				
				$("a","#"+options.lastId).click(function(){		
					animate("last",true);				
				});				
			};
			
			function setCurrent(){
				i = parseInt(i)+1;
				$("li", "#" + options.numericId).removeClass("current");
				$("li#" + options.numericId + i).addClass("current");
			};
			
			
			function adjust(){
				if(t>ts) t=0;		
				if(t<0) t=ts;	
				if(!options.vertical) {
					$("ul",obj).css("margin-left",(t*w*-1));
				} else {
					$("ul",obj).css("margin-left",(t*h*-1));
				}
				clickable = true;
				if(options.numeric) setCurrent(t);
			};
			
			function adjust_kat(){
				alert("ja");
			};
			
			if(s==1){
						$("a","#"+options.nextId).hide();
					};
			
			function animate(dir,clicked){
				if (clickable){
					clickable = false;
					var ot = t;				
					switch(dir){
						case "next":
							t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;						
							break; 
						case "prev":
							t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
							break; 
						case "first":
							t = 0;
							break; 
						case "last":
							t = ts;
							break; 
						default:
							t = dir;
							break; 
					};	
					var diff = Math.abs(ot-t);
					var speed = diff*options.speed;						
					if(!options.vertical) {
						p = (t*w*-1);
						$("ul",obj).animate(
							{ marginLeft: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);				
					} else {
						p = (t*h*-1);
						$("ul",obj).animate(
							{ marginTop: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);					
					};
					
					if(!options.continuous && options.controlsFade){					
						if(t==ts){
							$("a","#"+options.nextId).hide();
							$("a","#"+options.lastId).hide();
						} else {
							$("a","#"+options.nextId).show();
							$("a","#"+options.lastId).show();					
						};
						if(t==0){
							$("a","#"+options.prevId).hide();
							$("a","#"+options.firstId).hide();
						} else {
							$("a","#"+options.prevId).show();
							$("a","#"+options.firstId).show();
						};					
					};				
					
					if(clicked) clearTimeout(timeout);
					if(options.auto && dir=="next" && !clicked){;
						timeout = setTimeout(function(){
							animate("next",false);
						},diff*options.speed+options.pause);
					};
			
				};
				
			};
			// init
			var timeout;
			if(options.auto){;
				timeout = setTimeout(function(){
					animate("next",false);
				},options.pause);
			};		
			
			if(options.numeric) setCurrent();
		
			if(!options.continuous && options.controlsFade){					
				$("a","#"+options.prevId).hide();
				$("a","#"+options.firstId).hide();				
			};				
			
		});
	  
	};

})(jQuery);
*/






