//jQuery.preLoadImages("qualifizierung.png", "/redaxo/custom/templates/img/sto/qualifizierung.png");
//jQuery.preLoadImages("steuerung.png", "/redaxo/custom/templates/img/sto/steuerung.png");
//jQuery.preLoadImages("innovierung.png", "/redaxo/custom/templates/img/sto/innovierung.png");
function stoChangeStatus(flag) {
	if (flag==1) {
		$("#sto-img").css("background","url(/redaxo/custom/templates/img/sto/strategien.png) 0 0 no-repeat");
		$("#sto1").css("color","#fff");
		$("#sto2").css("color","#444");
		$("#sto3").css("color","#444");
		$("#sto-right").html($("#stotxt1").html());
	}
	if (flag==2) {
		$("#sto-img").css("background","url(/redaxo/custom/templates/img/sto/organisation.png) 0 0 no-repeat");
		$("#sto1").css("color","#444");
		$("#sto2").css("color","#fff");
		$("#sto3").css("color","#444");
		$("#sto-right").html($("#stotxt2").html());
	}
	if (flag==3) {
		$("#sto-img").css("background","url(/redaxo/custom/templates/img/sto/mitarbeiter.png) 0 0 no-repeat");
		$("#sto1").css("color","#444");
		$("#sto2").css("color","#444");
		$("#sto3").css("color","#fff");
		$("#sto-right").html($("#stotxt3").html());
	}
	
}






function sendContactForm() {
	var cf_name = $("#cform-name").val();
	var cf_adr = $("#cform-mail").val();
	var cf_cake = $("#cform-cake").val();
	var cf_msg = $("#cform-msg").val();
	$.post ("/redaxo/custom/includes/request.php", { "cf_name": cf_name, "cf_adr": cf_adr, "cf_cake": cf_cake, "cf_msg": cf_msg  },
			function (data) {	
			$("#contact-right").html(data);
	});
}





(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);

jQuery.preLoadImages("pulldown_bg.png", "/redaxo/custom/templates/img/pulldown_bg.png");




(function($){
$.fn.vTicker = function(options) {
	var defaults = {
		speed: 700,
		pause: 4000,
		showItems: 3,
		animation: '',
		mousePause: true,
		isPaused: false,
		direction: 'up',
		height: 0
	};

	options = $.extend(defaults, options);

	moveUp = function(obj2, height, options){
		if(options.isPaused)
			return;
		
		var obj = obj2.children('ul');
		
    	var clone = obj.children('li:first').clone(true);
		
		if(options.height > 0)
		{
			height = obj.children('li:first').height();
		}		
		
    	obj.animate({top: '-=' + height + 'px'}, options.speed, function() {
        	$(this).children('li:first').remove();
        	$(this).css('top', '0px');
        });
		
		if(options.animation == 'fade')
		{
			obj.children('li:first').fadeOut(options.speed);
			if(options.height == 0)
			{
			obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show();
			}
		}

    	clone.appendTo(obj);
	};
	
	moveDown = function(obj2, height, options){
		if(options.isPaused)
			return;
		
		var obj = obj2.children('ul');
		
    	var clone = obj.children('li:last').clone(true);
		
		if(options.height > 0)
		{
			height = obj.children('li:first').height();
		}
		
		obj.css('top', '-' + height + 'px')
			.prepend(clone);
			
    	obj.animate({top: 0}, options.speed, function() {
        	$(this).children('li:last').remove();
        });
		
		if(options.animation == 'fade')
		{
			if(options.height == 0)
			{
				obj.children('li:eq(' + options.showItems + ')').fadeOut(options.speed);
			}
			obj.children('li:first').hide().fadeIn(options.speed).show();
		}
	};
	
	return this.each(function() {
		var obj = $(this);
		var maxHeight = 0;

		obj.css({overflow: 'hidden', position: 'relative'})
			.children('ul').css({position: 'absolute', margin: 0, padding: 0})
			.children('li').css({margin: 0, padding: 0});

		if(options.height == 0)
		{
			obj.children('ul').children('li').each(function(){
				if($(this).height() > maxHeight)
				{
					maxHeight = $(this).height();
				}
			});

			obj.children('ul').children('li').each(function(){
				$(this).height(maxHeight);
			});

			obj.height(maxHeight * options.showItems);
		}
		else
		{
			obj.height(options.height);
		}
		
    	var interval = setInterval(function(){ 
			if(options.direction == 'up')
			{ 
				moveUp(obj, maxHeight, options); 
			}
			else
			{ 
				moveDown(obj, maxHeight, options); 
			} 
		}, options.pause);
		
		if(options.mousePause)
		{
			obj.bind("mouseenter",function(){
				options.isPaused = true;
			}).bind("mouseleave",function(){
				options.isPaused = false;
			});
		}
	});
};
})(jQuery);
