var $_GET = {};
var firstThree=0;

$_GET["L"]=0;

document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
    function decode(s) {
        return decodeURIComponent(s).replace(/\+/g, " ");
    }

    $_GET[decode(arguments[1])] = decode(arguments[2]);
});

var texte = new Array();

texte[0]=new Array('&hellip; <b>Verantwortungsbewusstsein</b> gegen&uuml;ber unserer Umwelt bedeutet nat&uuml;rliche Ressourcen zu sch&uuml;tzen und diese durch zeitgem&auml;&szlig;e Alternativen zu ersetzen&nbsp;&hellip;',
		'&hellip; Techboard Anwendungen stehen f&uuml;r <b>umweltfreundliche Produkte</b> f&uuml;r den Au&szlig;enbereich, die durch <b>Qualit&auml;t und Innovation</b> den Werkstoff WPC neu definieren&nbsp;&hellip;',
		'&hellip; ein <b>neues und st&auml;ndig wachsendes Produktportfolio</b> optimiert Anwendungen f&uuml;r den Au&szlig;en- und Nassbereich mit allen Vorteilen und Eigenschaften unserer Produkte&nbsp;&hellip;'
);

texte[1]=new Array('&hellip; a sense of responsibility towards our environment means protecting natural resources and utilising modern alternatives in their place&nbsp;&hellip;',
		'&hellip; a new and constantly increasing product portfolio optimises the application for outdoor and wet areas with all the advantages and attributes of our products&nbsp;&hellip;',
		'&hellip; Techboard applications stand for environmentally friendly products for outdoor areas which, through quality and innovation, have given WPC a new definition&nbsp;&hellip;'
);

texte[2]=new Array('&hellip; Сознание ответственности по отношению к окружающей среде вокруг нас предполагает защиту природных ресурсов и их замену современными альтернативными средствами&nbsp;&hellip;',
		'&hellip;Новое и постоянно расширяющееся портфолио продукции делает наши изделия со всеми их свойствами и преимуществами оптимальными для использования как на открытых территориях, так и в местах с повышенной влажностью&nbsp;&hellip;',
		'&hellip;«Техбоард» делает акцент на экологичности продукции, использующейся в открытых местах, благодаря качеству и инновации нашей продукции древесно-пластиковый композитный материал (WPC) приобретает совершенно новое видение&nbsp;&hellip;'
);

texte[3]=new Array('&hellip; Un sentiment de responsabilitate faţă de mediul nostru mijloc de protecţie a resurselor naturale şi prin intermediul acestor moderne soluţii alternative pentru a înlocui&nbsp;&hellip;', '&hellip; un nou produs şi o creştere a portofoliului de aplicaţii optimizate pentru exterior şi umed, cu toate avantajele şi caracteristici ale produselor noastre&nbsp;&hellip;', '&hellip; Techboard aplicaţii sunt disponibile pentru produsele ecologice pentru exterior, de calitate şi de inovare prin materiale WPC redelimita&nbsp;&hellip;'
);

texte[4]=new Array(
	'&hellip; Doğa ve Çevreye karşı sorumluluk, doğal kaynakları korumaktan ve çağın gerektirdiği alternatifleri değerlendirmekten geçer&nbsp;&hellip;',
	'&hellip; sürekli yenilenen ve büyüyen ürün çeşitliliği, dış ve ıslak bölgelerde ürünlerimizin avantajlarını göz önüne seriyor&nbsp;&hellip;',
	'&hellip; WPC maddesinin inovasyonunu ve kalitesini  çevreye duyarlılığını dış bölgeler için Techboard’ın uygulamaları tanımlıyor&nbsp;&hellip;'
);

texte[5]=new Array(
	'&hellip; vědomí zodpovědnosti vůči našemu životnímu prostředí znamená chránit přírodní prameny a tyto nahrazovat alternativním řešením&nbsp;&hellip;',
	'&hellip; nové a stále se rozšiřující portfolio produktu optimuje aplikaci i ve vlhkém exteriéru&nbsp;&hellip;',
	'&hellip; aplikace techboardu představují nejen ekologicky přátelské produkty pro exteriér, ale také novou definici materiálu WPC skrze svoji kvalitu a inovaci&nbsp;&hellip;'
);

texte[7]=texte[5];

texte[8]=new Array('&hellip; Świadomość odpowiedzialności za środowisko naturalne pociąga za sobą chęć ochrony zasobów naturalnych i korzystanie z odpowiednich zamienników&nbsp;&hellip;',
		'&hellip; nasza bogata i wciąż rozbudowywana oferta to rozwiązania i produkty, które bez utraty swych wyjątkowych cech mogą być  stosowanie w miejscach narażonych na zmienne warunki pogodowe lub wilgoć&nbsp;&hellip;',
		'&hellip; Rozwiązania firmy Techboard to przyjazne środowisku naturalnemu produkty przeznaczone do użytku zewnętrznego, dzięki swej jakości i innowacyjności, tworzące nowe oblicze WPC kompozytu drewno-polimer&nbsp;&hellip;'
);

textn=0;

function scrollup() {
	var lb = $('.csc-frame-frame1 .csc-textpic .csc-textpic-imagewrap');
	var sz=lb.height()-firstThree;
	td=sz+parseInt(lb.css('top'));
	lb.animate({top: -sz}, td*30, 'linear')
		.queue( function() { $(this).css('top', '0px'); scrollup(); $(this).dequeue(); } );
}

function step1() {
	if(textn >= texte[$_GET["L"]].length)
		textn=0;
	$('#bla').html(texte[$_GET["L"]][textn++])
		.css("margin-top", parseInt(30+Math.random()*100)) /* 400, normally */
		.fadeIn(1000)
		.animate({ a:1 }, 5000)
		.fadeOut(1000)
		.queue( function() { step1(); $(this).dequeue(); });
}

function blapause() {
	$('#bla').stop(true)
		.css('opacity', 1.0);
}

function blacont() {
	$('#bla').stop(true)
		.fadeOut(1000)
		.queue( function() { step1(); $(this).dequeue(); });
}

function checkLoaded() {
	loaded=true;
	$('.csc-frame-frame1 .csc-textpic .csc-textpic-imagewrap img').each(function(i) {
		if($(this).height() < 40)
			loaded=false;
		else if(i<3)
			firstThree+=$(this).height();
	});
	if(!loaded)
		setTimeout(checkLoaded, 500);
	else
	{
		$('.csc-frame-frame1').hover(function() { $('.csc-frame-frame1 .csc-textpic .csc-textpic-imagewrap').stop(true) }, function() { scrollup() });
		scrollup();
		$('#bla').hover(blapause, blacont);
		step1();
		$('.csc-frame-frame2 div.csc-textpic').animate({height:"0px"});
		$('.csc-frame-frame2 h3').css('background-image', 'url(/fileadmin/user_upload/down.gif)');
	}
	return loaded;
}

/*
This code is licenced under LGPL v3
Author : Alexandre Stanislawski

fadeImages

Simple jQuery plugin that can transform a div containing images into a slideshow with a fade as a transition.

In :
- params : object containing the attributes :
 - timeout : time before next transition
 - fadeDuration : transition duration
*/

jQuery.fn.fadeImages = function(params){
	var config = {timeout:4000, fadeDuration:500};
	if (params) jQuery.extend(config, params);

	this.each(
		function(){
			jQthis = jQuery(this);
			//jQthis.css({position:"relative", overflow:"hidden"});
			jQthis.css({position:"relative"});
			var imgSet = jQthis.find("div.csc-textpic-imagerow");
			imgSet.css({opacity:0, position:"absolute", top:0, left:0});
			imgSet.first().css({opacity:1});
			var current = 1;
			var total = imgSet.size();
			jQthis.find("div.csc-textpic-imagerow:nth-child(1)").css("z-index", 999);

			setTimeout(
				(function fade(){
					var nextIter = current+1;
					if(nextIter>total){
						nextIter=1;
					}

					jQthis.find("div.csc-textpic-imagerow:nth-child("+current+")").animate({opacity:0},params.fadeDuration).css("z-index", 998);
					current = nextIter;
					jQthis.find("div.csc-textpic-imagerow:nth-child("+nextIter+")").animate({opacity:1},params.fadeDuration, function(){
						$(this).css('z-index', 999)
						setTimeout(fade,params.timeout);
					});
				}),
			params.timeout);
	});
	return this;
};

$(document).ready(function(){
	$(".csc-frame-invisible").fadeImages({timeout:4000, fadeDuration:500});
/*
	window.setTimeout(checkLoaded, 100);
	var h=$('.csc-frame-frame2 div.csc-textpic').height();
	$('.csc-frame-frame2').click(function() {
		if($('.csc-frame-frame2 div.csc-textpic').height() < 1) {
			$('.csc-frame-frame2 div.csc-textpic').animate({height:h+"px"});
			$('.csc-frame-frame2 h3').css('background-image', 'url(/fileadmin/user_upload/up.gif)');
		} else {
			$('.csc-frame-frame2 div.csc-textpic').animate({height:"0px"});
			$('.csc-frame-frame2 h3').css('background-image', 'url(/fileadmin/user_upload/down.gif)');
		}
	});
*/
});


