
(function($) {

	$.fn.toiSlider = function(options) {
		// default Werte < options (geklaut aber laeuft) ;)
		var opts = $.extend({}, $.fn.toiSlider.defaults, options);
		var selector = $(this);
		var baseZ = 10;
		
		function switchBox(test) {  //rekursive funktion
			var muh = $(this);
			baseZ++;
			
			test.fadeIn("fast", function() {
				if (test.nextAll('div:hidden:first').length > 0) {
					test.nextAll('div:hidden:first').find('.slideContentWrap').css('left', '-700px');
					test.nextAll('div:hidden:first').hide();
					test.nextAll('div:hidden:first').css('z-index', baseZ);
					test.nextAll('div:hidden:first').fadeIn("normal", function() {
						var tmp = $(this);
						tmp.find('.slideContentWrap').animate({left: '0px'}, 1000).animate({ opacity: 1.0 }, opts.delay, function() {
							var tmp = $(this).parents('.slideBox');
							test.hide();
							switchContent(tmp);
						});
					});
				} else {
					selector.find(".slideBox:first").find('.slideContentWrap').css('left', '-700px');
					selector.find(".slideBox:first").hide();
					selector.find(".slideBox:first").css('z-index', baseZ);
					selector.find(".slideBox:first").fadeIn("normal", function() {
						var tmp = $(this);
						tmp.find('.slideContentWrap').animate({left: '0px'}, 1000).animate({ opacity: 1.0 }, opts.delay, function() {
							var tmp = $(this).parents('.slideBox');
							test.hide();
							switchContent(tmp);
						});
					});
				}
			});	
		}
		
		function switchContent(test) {  //rekursive funktion
			var muh = $(this);
			test.find('.slideContentWrap').animate({ left: '-700px' }, 1000, function() {
				$(this).animate({ opacity: 1.0 }, 500, switchBox(test));
			});
		}	
			
		$(this).find('.slideBox:not(:first)').hide();
		$(this).find(".slideBox:first").show().animate({opacity: 1.0}, 7000, function() {
			var tmp = $(this);  //muss definiert werden, um THIS an callback zu uebergeben
			switchContent(tmp);
		});
		
	}
	
	// defaults festlegen
	$.fn.toiSlider.defaults = {
		boxClass:        ".slideBox",
		backgroundClass: ".slideContentWrap",
		contentClass:    ".slideBoxBG",
		speed:	         "normal",
		delay:           7000
	};

})(jQuery);



$(document).ready(function(){
	
	$("#toiSlider").toiSlider();
	
	$('.infoText').hide();
	
	$('.infoLink').hover(
		function() {
			$(this).parent().parent().find('.infoText').show();
		},
		function() {
			$(this).parent().parent().find('.infoText').hide();
		}
	);
	
	$(document).mousemove(function(e){
		boxX = e.pageX + 10;
		boxY = e.pageY + 10;
		$('.infoText').css({
			'left': boxX,
			'top': boxY
		});
   }); 
	
});


var browserName=navigator.appName;var browserVer=parseInt(navigator.appVersion);var version="";var msie4=(browserName=="Microsoft Internet Explorer"&&browserVer>=4);if((browserName=="Netscape"&&browserVer>=3)||msie4||browserName=="Konqueror"||browserName=="Opera"){version="n3";}else{version="n2";}
function blurLink(theObject){if(msie4){theObject.blur();}}
function decryptCharcode(n,start,end,offset){n=n+offset;if(offset>0&&n>end){n=start+(n-end-1);}else if(offset<0&&n<start){n=end-(start-n-1);}
return String.fromCharCode(n);}
function decryptString(enc,offset){var dec="";var len=enc.length;for(var i=0;i<len;i++){var n=enc.charCodeAt(i);if(n>=0x2B&&n<=0x3A){dec+=decryptCharcode(n,0x2B,0x3A,offset);}else if(n>=0x40&&n<=0x5A){dec+=decryptCharcode(n,0x40,0x5A,offset);}else if(n>=0x61&&n<=0x7A){dec+=decryptCharcode(n,0x61,0x7A,offset);}else{dec+=enc.charAt(i);}}
return dec;}
function linkTo_UnCryptMailto(s){location.href=decryptString(s,-2);}