jQuery(document).ready(function(){
	$('.h_ticker .h_ticker_list').each(function(){

											var content=$(this).find('li:last .ticker_el_spacer:last').html();
											$(this).find('li:last .ticker_el_spacer:last').html(content+'<span style="padding:0px 40px;"></span>');
											var width = 0;
											$(this).find('li').each(function(){
												var tw	= $(this).width();
												width	+=$(this).width() + 20;
												$(this).width(tw+'px').data('width',tw).find('.ticker_el_inner').css({position:'absolute'});
											});
											$(this).find('li').each(function(){
												$(this).clone(true).appendTo($(this).parents('ul')).data('width',$(this).data('width'));
											});
											$(this).width((width*2)+'px');
										});
	ticker_tick();
	
	if($('div[@contenteditable=true]').length ==0) {
		// vertical ticker
		$('.v_ticker').each(function(){
												$(this).find('.v_ticker_inner').each(function(){
																		$(this).clone(true).appendTo($(this).parents('.v_ticker'));
																	});
											});
		
		
		window.setTimeout("init_vert_ticker()", 3000);
	}
});

function init_vert_ticker() {
	var vert_padding_bottom = 40;
	$('.v_ticker .v_ticker_inner').each(function(){
											var w = $(this).width();
											var h = $(this).height();
											$(this).css({
														width:		w,
														height:		(h+vert_padding_bottom)
														})
													.data('height',(h+vert_padding_bottom));
											var x = $('<div>');
												x.addClass('inner').css({
																	width:		w,
																	height:		h,
																	paddingBottom: vert_padding_bottom+'px'
																	});
											$(this).wrapInner(x);
										});
	$('.v_ticker').each( function() {
			vert_ticker_tick($(this));	
	});
}

function vert_ticker_tick(par) {
	var first_el = $('.v_ticker_inner:first', par);
	var speed = Math.round((first_el.height()) * 20);
	first_el.slideUp({
						duration:	speed,
						easing:		'linear',
						complete:	function(){
							$(this).appendTo($(this).parents('.v_ticker')).attr('style','height:'+$(this).data('height')+'px');
							vert_ticker_tick();
						}
					});
}

function ticker_tick() {
	var first_el = $('.h_ticker .h_ticker_list li:first');
	var speed = Math.round((first_el.width()) * 25);
	first_el.animate(
						{
							width:'0px'
						},
						speed,
						'linear',
						function() {
							$(this).appendTo($(this).parents('ul')).attr('style','width:'+$(this).data('width')+'px');
							ticker_tick();
						}
					);
}

 function langSwitch(lang, target) {
	var locat = window.location.href;
	
	// store suffix - may contain additional get-parameters
	var suffix=locat.substr(locat.indexOf('.html')+5,locat.length);

	if(target != '/') {
		if(locat.indexOf('index.html') == -1) {
			locat = target;
		} else {
			var pos = target.lastIndexOf('/')+1;
			locat=target.substring(0,pos)+'index.html';
		}
	}

	if(locat.indexOf('?changelang=') != -1) {
		locat = locat.replace(/\?changelang=1/,'');
		locat = locat.replace(/\?changelang=2/,'');
	}
	if(locat.indexOf('&changelang=') != -1) {
		locat = locat.replace(/\&changelang=1/,'');
		locat = locat.replace(/\&changelang=2/,'');
	}
	
	locat=locat+suffix;
	if(locat.indexOf('?') == -1) {
		locat=locat+'?changelang='+lang;
	} else {
		locat=locat+'&changelang='+lang;
	}

	window.location.href=locat;
}

                                    function getElHeight(el){
                                        if(ns4)return (el.document.height)? el.document.height : el.clip.bottom-el.clip.top;
                                        else if(ie4||ie5)return (el.style.height)? el.style.height : el.clientHeight;
                                        else return (el.style.height)? parseInt(el.style.height):parseInt(el.offsetHeight);
                                    }

                                    function getPageLeft(el){
                                        var x;
                                        if(ns4)return el.pageX;
                                        if(ie4||w3c){
                                            x = 0;
                                            while(el.offsetParent!=null){
                                                x+=el.offsetLeft;
                                                el=el.offsetParent;
                                            }
                                            x+=el.offsetLeft;
                                            return x;
                                        }
                                    }

                                    function getPageTop(el){
                                        var y;
                                        if(ns4)return el.pageY;
                                        if(ie4||w3c){
                                            y=0;
                                            while(el.offsetParent!=null){
                                                y+=el.offsetTop;
                                                el=el.offsetParent;
                                            }
                                            y+=el.offsetTop;
                                            return y;
                                        }
                                    }

                                    function scrollbox(){
                                        if(ns4){
                                            inner.top+=(godown)? pixelstep: -pixelstep;
                                            if(godown){
                                                if(inner.top>boxheight)inner.top=-elementheight;
                                            } else {
                                                if(inner.top<2-elementheight)inner.top=boxheight+2;
                                            }
                                        } else {
                                            inner.style.top=parseInt(inner.style.top)+((godown)? pixelstep: -pixelstep)+'px';
                                            if(godown){
                                                if(parseInt(inner.style.top)>boxheight)inner.style.top=-elementheight+'px';
                                            } else {
                                                if(parseInt(inner.style.top)<2-elementheight)inner.style.top=boxheight+2+'px';
                                            }
                                        }
                                    }

