var scrolling=false;

function carousel_up() {
	if(!scrolling) {
		if(i_pos < (i_count-1)) {
			if(s=document.getElementById("scroller")) {
				scrolling=true;
				i_pos++;
				current=(s.style.top.replace(/px/,"")*1);
				target=current-120;
				carousel_move(-3,target);
			}
		}
	}
}

function carousel_down() {
	if(!scrolling) {
		if(i_pos >0 ) {
			if(s=document.getElementById("scroller")) {
				scrolling=true;
				i_pos--;
				current=(s.style.top.replace(/px/,"")*1);
				target=current+120;
				carousel_move(3,target);
			}
		}
	}
}

function carousel_move(offset, target) {
	if(s=document.getElementById("scroller")) {
		current=(s.style.top.replace(/px/,"")*1);
		current=current+offset;
		s.style.top=current+"px";


		if(Math.abs(current-target) < Math.abs(offset)) {
			//zur Sicherheit
			s.style.top=target+"px";
			scrolling=false;
		}
		else {
			aufruf="carousel_move("+offset+","+target+")";
			window.setTimeout(aufruf,10)
		}
		
	}
}



function show_glossar(element,id) {
	if(g=document.getElementById("glossar_canvas")) {
		g.innerHTML=glossar[id];
		g.style.left=(PageOffsetLeft(element)+10)+"px";
		g.style.top=(PageOffsetTop(element)+20)+"px";
	}
}

function hide_glossar() {
	if(g=document.getElementById("glossar_canvas")) {
		g.style.left="-999em";
	}
}

function PageOffsetTop(el) {
	var y;

	y = el.offsetTop;
	if (el.offsetParent != null) {
	if(el.offsetParent.style && el.offsetParent.style.overflow && el.offsetParent.style.overflow!="visible") {
	}
	else {
		y += PageOffsetTop(el.offsetParent);
	}
	}
	return y;
}


function PageOffsetLeft(el) {
	var x;
  
	x = el.offsetLeft;
	if (el.offsetParent != null) {
		if(el.offsetParent.style && el.offsetParent.style.overflow && el.offsetParent.style.overflow!="visible") {
		}
		else {
		x += PageOffsetLeft(el.offsetParent);
		}
	}
	return x;
}

function popup_close() {
	if(p=document.getElementById("popup")) {
		p.style.left="-999em";
	}
}




function set_group(pid,set_name) {
	h=window.open("admin/group.php?pid="+pid+"&set_name="+set_name,"group_zuo","width=300,height=400,left=100,top=200");
	h.focus();
}

function set_categorie(pid,set_name) {
	h=window.open("admin/set.php?pid="+pid,"set_zuo","width=300,height=400,left=100,top=200");
	h.focus();
}


function fsc_info(url) {
	f=window.open(url,"fsc","width=500,height=285,scrollbars=no,resizable=no");
	f.focus();
}

function inspiration(url) {
	i=window.open(url,"inspiration","width=640,height=400,scrollbars=no,resizable=no");
	i.focus();
}
