var gl_zoomlevel=0;
var gl_focus=null;
var gl_timer=null;
var gl_prozent=0;
var gl_showfirst=0;
var gl_max=175;
var gl_height=175;
var alpha=100;
var alpha_sethora=100;
onload=function() {
	if (document.getElementById("gl_imageframe")) {
		gl_createSlideshow();
		}
	//loadbackground();
	if (screen.width>1024) {
		document.getElementById("masterframe").style.width="1024px";
		}
	else {
		document.getElementById("masterframe").style.width="768px";
		}
	}
function gl_createSlideshow() {
	gl_prozent=Math.round(100/gl_images.length/4);
	for (i=0;i<gl_images.length;i++) {
		if (parseInt(gl_textids[i])==parseInt(gl_active)) {
			gl_showfirst=i;
			}
		var gl_slide=window.document.createElement("A");
		gl_slide.href=gl_links[i];
		gl_slide.id="gl_slide_"+i;
		gl_slide.className="gl_slide";
		gl_slide.style.zIndex=i;
		gl_slide.style.left=""+Math.round((100/gl_images.length)*i)+"%";
		gl_slide.style.backgroundImage="url('/scripts/frontend/index.php3?ACTION=imageShow&ID="+gl_images[i]+"&width=1152&textid="+gl_textids[i]+"')";
		gl_slide.onmouseover=function() {
			gl_focus=this;
			gl_zoomPicture();
			}
		gl_slide.onmouseout=function() {
			gl_focus=this;
			gl_getMax();
			gl_unzoomPicture();
			}
		gl_imagelabel=window.document.createElement("a");
		gl_imagelabel.className="gl_imagelabel";
		gl_imagelabel.style.top=gl_height+"px";
		gl_imagelabel.style.paddingRight=(gl_prozent)+"%";
		gl_imagelabel.style.width=(100-gl_images.length*gl_prozent)+"%"
		gl_imagelabel.id="gl_imagelabel_"+i;
		gl_imagelabel.innerHTML=gl_comments[i];
		gl_imagelabel.href=gl_links[i];
		gl_slide.appendChild(gl_imagelabel);
		/**
		*	Ein Admin darf hier rechtsklicken
		*/
		if (typeof(synapsisadmin)!="undefined") {
			var adminspan=window.document.createElement("SPAN");
			adminspan.className="synapsisadmin";
			adminspan.shorten=1;
			adminspan.type="content";
			adminspan.ptype="content";
			adminspan.primary=gl_textids[i];
			adminspan.oncontextmenu=function() {showContext(this,'context_content',this.primary,'0','content');document.getElementById('chatCheckbox').checked=true;document.getElementById('guestbookCheckbox').checked=true;document.getElementById('formularCheckbox').checked=true;document.getElementById('forumCheckbox').checked=true;};
			adminspan.appendChild(gl_slide);
			document.getElementById("gl_imageframe").appendChild(adminspan);
			}
		else {
			document.getElementById("gl_imageframe").appendChild(gl_slide);
			}
		}
	/**
	*	Zum Schluss das aktive Bild zoomen
	*/
	if(parseInt(gl_active)>0&&parseInt(gl_showfirst)>0) {
		gl_focus=document.getElementById("gl_slide_"+parseInt(gl_showfirst));
		gl_zoomPicture();
		}
	}
function gl_getMax() {
	for (i=0;i<gl_images.length;i++) {
		if (parseInt(document.getElementById("gl_imagelabel_"+i).style.top)<gl_max) {
			gl_max=parseInt(document.getElementById("gl_imagelabel_"+i).style.top);
			}
		}
	}
function gl_zoomPicture() {
	if (gl_timer!=null) {
		clearTimeout(gl_timer);
		}
	var i=gl_focus.id.replace("gl_slide_","");
	var l=document.getElementById("gl_imagelabel_"+i).style;
	/**
	*	In 100 Schritten das Bild einblenden
	*/
	if (parseInt(l.top)>(gl_height-91)) {
		for (j=0;j<gl_images.length;j++) {
			if (j!=i) {
				var k=document.getElementById("gl_imagelabel_"+j).style;
				var ktop=parseInt(k.top);
				if (ktop<gl_height) {
					k.top=ktop+3+"px";
					}
				var k=document.getElementById("gl_slide_"+j).style;
				var kleft=parseInt(k.left);
				if (j<i) {
					if (kleft>(j*gl_prozent)) {
						k.left=kleft-3+"%";
						}
					}
				if (j>i) {
					if (kleft<(100-((gl_images.length-j)*gl_prozent))) {
						k.left=kleft+3+"%";
						}
					}
				}
			else {
				var k=document.getElementById("gl_slide_"+i).style;
				var kleft=parseInt(k.left);
				if (kleft>(i*gl_prozent)) {
					k.left=kleft-3+"%";
					}
				}
			}
		l.top=(parseInt(l.top)-3)+"px";
		gl_timer=setTimeout("gl_zoomPicture()", 30);
		}
	}
function gl_unzoomPicture() {
	if (gl_timer!=null) {
		clearTimeout(gl_timer);
		}
	var i=gl_focus.id.replace("gl_slide_","");
	var l=document.getElementById("gl_imagelabel_"+i).style;
	/**
	*	In 100 Schritten das Bild einblenden
	*/
	if (gl_max<gl_height) {
		for (j=0;j<gl_images.length;j++) {
			if (j!=i) {
				var k=document.getElementById("gl_imagelabel_"+j).style;
				var ktop=parseInt(k.top);
				if (ktop<gl_height) {
					k.top=ktop+3+"px";
					}
				}
			var k=document.getElementById("gl_slide_"+j).style;
			var kleft=parseInt(k.left);
			if (parseInt(k.left)>Math.round(100/gl_images.length*j)) {
				k.left=kleft-3+"%";
				}
			if (parseInt(k.left)<Math.round(100/gl_images.length*j)) {
				k.left=kleft+3+"%";
				}
			}
		if (parseInt(l.top)<gl_height) {
			l.top=(parseInt(l.top)+3)+"px";
			}
		gl_max--;
		gl_timer=setTimeout("gl_unzoomPicture()", 30);
		}
	}
function loadbackground() {
	document.body.style.backgroundImage="url('index.php3?ACTION=imageShow&ID="+sethora_imageid+"&width="+screen.width+"')";
	}
function malschauen() {
	if (alpha_sethora>0) {
		if (alpha_sethora==100) {
			document.getElementById("masterframe").style.filter="alpha(opacity=100)";
			document.getElementById("masterframe").style.opacity=1.0;
			}
		alpha_sethora=alpha_sethora-5;
		if(document.all) {
			document.getElementById("masterframe").filters[0].opacity=alpha_sethora;
			document.getElementById("masterframe").filters[0].finishOpacity=alpha_sethora;
			}
		else {
			document.getElementById("masterframe").style.opacity=alpha_sethora/100;
			}
		window.setTimeout("malschauen()",20);
		}
	else {
		window.setTimeout("malguggn()",5000);
		}
	}
function malguggn() {
	if (alpha_sethora<100) {
		alpha_sethora=alpha_sethora+5;
		if(document.all) {
			document.getElementById("masterframe").filters[0].opacity=alpha_sethora;
			document.getElementById("masterframe").filters[0].finishOpacity=alpha_sethora;
			}
		else {
			document.getElementById("masterframe").style.opacity=alpha_sethora/100;
			}
		window.setTimeout("malguggn()",20);
		}
	else {
		document.getElementById("masterframe").style.filter="";
		document.getElementById("masterframe").style.filopacityter=1.0;
		}
	}
