
var ki;
window.onload = function(){
ki = new KIG();
}

function KIG(){
	
	//---------------------------------------- animation start from here ---------------------------------
	var body = document.body;
	var continuewith = new GOON(new Array(), new Array());
	var active;
	
	function GOON(funcnames, funcparams){
		this.pointer = -1;
		this.functions = funcnames;
		this.funcparams = funcparams;
	}
	
	function continue_(){
		continuewith.pointer++;
		if(continuewith.pointer >= continuewith.functions.length){
			active = 0;
			return;
		} else
			continuewith.functions[continuewith.pointer](continuewith.funcparams[continuewith.pointer]);
	}
	
	function $(id) {
		return document.getElementById(id);
	}
	
	function getStyle(el,styleProp)
	{
					return document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
			
	}
	
	function findPos(obj) {
		if(getStyle(obj, "position") == "fixed")
			return [parseInt(getStyle(obj, "left")), parseInt(getStyle(obj, "top"))];
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft;
			curtop = obj.offsetTop;
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			}
		}
		return [curleft,curtop];
	}
	
	function getDim(obj) {
		var y = obj.offsetHeight;
		var x = obj.offsetWidth;
					x = x - parseInt(getStyle(obj, "padding-left")) - parseInt(getStyle(obj, "padding-right")) - parseInt(getStyle(obj, "border-left-width")) - parseInt(getStyle(obj, "border-right-width"));
			y = y - parseInt(getStyle(obj, "padding-top")) - parseInt(getStyle(obj, "padding-bottom")) - parseInt(getStyle(obj, "border-top-width")) - parseInt(getStyle(obj, "border-bottom-width"));
			
		return [x, y];
	}
	
	
	// continue function with params: show
	function shadebody(params) {
		var show = parseInt(params[0]);	
		if(show == 0){
			$("blende").style.display = "block";
			continue_();
		} else {
			$("blende").style.display = "none";
			continue_();
		}
	}
	
	
	// continue function with params: show
	function scrollbars(params) {
		var show = parseInt(params[0]);
	
		if(show == 0){
						body.style.overflow = "hidden";
			document.getElementsByTagName("html")[0].style.overflow = "hidden";
						continue_();
		} else {
						document.getElementsByTagName("html")[0].style.overflow = "auto";
			body.style.overflow = "auto";
						continue_();
		}
	}
	
	// continue function with params: id, alpha
	function fade(params){
		var intfading;
		var actfade;
		var endfade;
		var fadeadd;
		var divtofade;
		
		active = 1;
	
		divtofade = $(params[0]);
				actfade = parseInt(getStyle(divtofade, "opacity")*100);
				endfade = parseInt(params[1]);
		if(actfade == endfade){
			continue_();
			return;
		}
		divtofade.style.display = "block";
		if(actfade < endfade)
			fadeadd=20;
		else
			fadeadd=-20;
		intfading = setInterval( function() {
			fading();
		}, 25);
		
		function fading(){
			actfade+=fadeadd;
						divtofade.style.opacity = actfade/100;
						if(actfade == endfade)
			{
				if(endfade == 0)divtofade.style.display = "none";
				clearInterval(intfading);
				continue_();
			}
		}
	}
	
	// continue function with params: type, width, height, id
	function resize(params) {
		var intresizing;
		var actx;
		var acty;
		var endx;
		var endy;
		var step;
		var stepsx;
		var stepsy;
		var width;
		var height;
		var count;
		var divtoresize;
		
		active = 1;
		
		divtoresize = $(params[3]);
		divtoresize.style.display = "block";
		
		width = parseInt(params[1]);
		height = parseInt(params[2]);		
		switch(parseInt(params[0])){
			case 1:
				divtoresize.style.height = height+"px";
				divtoresize.style.marginTop = -0.5*height+"px";
			break;
			case 2:
				divtoresize.style.width = width+"px";
				divtoresize.style.marginLeft = -0.5*width+"px";
			break;
		}
		var temp = getDim(divtoresize);
		count = 7;
		actx = temp[0];
		stepsx = new Array();
		stepsx.push(0);
		step = (width-actx)/count;
		endx = actx;
		while(step != 0){
			if( Math.abs(width-endx) < Math.abs(2*step) ){
				step = Math.round(0.4*step);
			}
			endx += step; 
			stepsx.push(step);
		}
		endx = stepsx.length;
		acty = temp[1];
		stepsy = new Array();
		stepsy.push(0);
		step = (height-acty)/count;
		endy = acty;
		while(step != 0){
			if( Math.abs(height-endy) < Math.abs(2*step) ){
				step = Math.round(0.4*step);
			}
			endy += step;
			stepsy.push(step);
		}
		endy = stepsy.length;
		if(endx > endy){
			for(var i = 0; i < endx - endy; i++)stepsy.push(0);
		} else {
			for(var i = 0; i < endy - endx; i++)stepsx.push(0);
			endx = endy;
		}
		step = 0;
		intresizing = setInterval( function(){
			resizing();
		}, 25);
		
		function resizing(){
			actx+=stepsx[step];
			acty+=stepsy[step];
			divtoresize.style.width = actx + "px";
			divtoresize.style.height = acty + "px";
			divtoresize.style.marginLeft = actx*-0.5 + "px";
			divtoresize.style.marginTop = acty*-0.5 + "px";
			step++;	
			if(step == endx) {
				divtoresize.style.width = width + "px";
				divtoresize.style.height = height + "px";
				divtoresize.style.marginLeft = width*-0.5 + "px";
				divtoresize.style.marginTop = height*-0.5 + "px";
				clearInterval(intresizing);
				continue_();
			}		
		}
	}
	
	// continue function with params: type, left, top, id, withcontinue
	function move(params) {
		var intmoving;
		var actx;
		var acty;
		var endx;
		var endy;
		var step;
		var stepsx;
		var stepsy;
		var count;
		var leftie;
		var topie;
		var divtomove;
		var withcontinue = parseInt(params[4]);
		
		if(withcontinue == 1)active = 1;
		
		divtomove = $(params[3]);
		divtomove.style.display = "block";
		
		if(getStyle(divtomove, "position") == "static"){
			divtomove.style.position = "absolute";
		}
		
		leftie = parseInt(params[1]);
		topie = parseInt(params[2]);
		switch(parseInt(params[0])){
			case 1:
				divtomove.style.top = topie+"px";
			break;
			case 2:
				divtomove.style.left = leftie+"px";
			break;
		}
		var temp = findPos(divtomove);
		count = 10;
		actx = temp[0];
		stepsx = new Array();
		stepsx.push(0);
		step = (leftie-actx)/count;
		endx = actx;
		while(step != 0){
			if( Math.abs(leftie-endx) < Math.abs(2*step) ){
				step = Math.round(0.4*step);
			}
			endx += step; 
			stepsx.push(step);
		}
		endx = stepsx.length;
		acty = temp[1];
		stepsy = new Array();
		stepsy.push(0);
		step = (topie-acty)/count;
		endy = acty;
		while(step != 0){
			if( Math.abs(topie-endy) < Math.abs(2*step) ){
				step = Math.round(0.4*step);
			}
			endy += step;
			stepsy.push(step);
		}
		endy = stepsy.length;
		if(endx > endy){
			for(var i = 0; i < endx - endy; i++)stepsy.push(0);
		} else {
			for(var i = 0; i < endy - endx; i++)stepsx.push(0);
			endx = endy;
		}
		step = 0;
		intmoving = setInterval( function(){
			moving();
		}, 25);
		
		function moving(){
			actx+=stepsx[step];
			acty+=stepsy[step];
			divtomove.style.left = actx + "px";
			divtomove.style.top = acty + "px";
			step++;	
			if(step == endx) {
				divtomove.style.left = leftie + "px";
				divtomove.style.top = topie + "px";
				clearInterval(intmoving);
				if(withcontinue == 1)continue_();
			}
		}
	}
	//---------------------------------------- animation end here ---------------------------------

	var xmlhttp;
	var waitingResponse = 0;

	var cur_id;
	var cur_file;
	var pre_add = 1;
	var pre_gre = 10000;
	var load_id;
	var pln = 0;
	var preload;
	var int_preloadingimgs = 0;
	var int_loadingimg = 0;
	var int_previewloading = 0;
	var int_dia = 0;
	var nextid;
	var previd;
	var addforcomm = 0;
	var oversizex;
	var oversizey;
	var posx;
	var posy;
	this.oldx;
	this.oldy;
	var windowX;
	this.mousestatus = 0;
	var previewshould = new Array(0, 0, "");
	
	var picturediv = $("foto");
	var prev_obj = $("ppl0");

	var modus = 0;

	function initAjax(){
		try { 
			xmlhttp = new XMLHttpRequest();
		} catch (e) { 
			try { 
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) { 
				try	{ 
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
				} catch (e) { alert("Ihr Browser ist veraltert. Versuchen Sie es mal mit Firefox unter http://www.mozilla-europe.org/de/");	}
			}
		}
	}

	function getHTTP(adr, result, params) {
		if(waitingResponse == 0) {
			waitingResponse = 1;
			initAjax();
			xmlhttp.onreadystatechange = function() {
				if(xmlhttp.readyState == 4){
					if(xmlhttp.status == 200){
						waitingResponse = 0;
						result(params);
					}
				}
			}
			xmlhttp.open("GET", adr, true);
			xmlhttp.send('');
		}
	}
	
	function moregalleries(id){
		$("koschtit"+id).innerHTML = xmlhttp.responseText;
		$("koschtit"+id).style.display = "block";
		if($("koschtit" + (id+1))){
			getHTTP("ki_koschtit.php?gallery="+$("koschtit"+(id+1)).title+"&number="+(id+1), moregalleries, id+1 );
		} else {
			$("loadme").style.display = "none";
			cur_id = 10;
			startpreloading(10);
		}
	}

	function startpreloading(id){
		var temp1 = $("koschtit"+id).childNodes;
		var temp2 = temp1.length;
		var temp3 = 0;
		for(var i = 0; i < temp2; i++){
			if(!temp1[i].alt)continue;
			temp3++;
		}
		if(id != load_id){
			preload = new Array();
			load_id = id;
		}
		int_preloadingimgs = setInterval( function() {
			ki.preloadingimgs(temp3);
		}, 300);
	}

	this.preloadingimgs = function(anzahl) {
		if(waitingResponse == 0){
			if(preload[pln]){
				if(preload[pln].complete != true){
					return;
				} else {
					if(pln == anzahl-1){
						clearInterval(int_preloadingimgs);
						int_preloadingimgs = 0;
						return;
					}
					pln++;
				}
			}
			if(!preload[pln]){
				if($(load_id + "ld" + (pln+1))){
					preload[pln] = new Image();
					preload[pln].src = $(load_id + "ld" + (pln+1)).alt;
					return;
				}
			}
		}
	}

	this.getImage = function(id, kind) {
		// kind = 0: Bild komplett neu öffnen
		// kind = 1: Nur Resize durchführen
		if(waitingResponse == 1)return;
		if(int_preloadingimgs != 0){
			clearInterval(int_preloadingimgs);
			int_preloadingimgs = 0;
		}
		cur_id = id.substring(0,2);
		if($(id).style.color)
			addforcomm = 16.5;
		else
			addforcomm = 0;
		bildhoehe = parseInt($(id).style.lineHeight)+8 + addforcomm;
		bildbreite = parseInt($(id).style.textIndent)+8;
								if(bildhoehe > window.innerHeight){
				aspect = bildbreite/(bildhoehe-addforcomm);
				bildhoehe = window.innerHeight;
							bildbreite = parseInt(aspect*(bildhoehe-addforcomm));
			}
						if(bildbreite > window.innerWidth){
				aspect = (bildhoehe-addforcomm)/bildbreite;
				bildbreite = window.innerWidth;
							bildhoehe = parseInt(aspect*bildbreite+addforcomm);
			}
						var temp1 = parseInt(id.substring(4));
		cur_file = temp1;
		
		pln = temp1;
		nextid = $(cur_id + "le"+(temp1+1));
		previd = $(cur_id + "le"+(temp1-1));
		if(kind == 0){
			picturediv.innerHTML = "";
			picturediv.style.width = "0px";
			continuewith = new GOON(new Array(scrollbars, shadebody ,resize), new Array(new Array("0"), new Array("0") ,new Array(1 ,bildbreite, bildhoehe, "foto")));
			continue_();
		} else {
			$("comm").style.display = "none";
			continuewith = new GOON(new Array(fade, resize), new Array(new Array("thepicture", 0), new Array(0 ,bildbreite, bildhoehe, "foto")));
			continue_();
		}
		getHTTP("ki_fullimg.php?file="+$(id).alt+"&x="+(bildbreite-8)+"&y="+(bildhoehe-8-addforcomm), ki.imgload, null);
	}
	
	this.imgload = function(){
		if(active == 1){
			setTimeout(function(){
				ki.imgload();
			}, 250);
			return;
		}	
		
		picturediv.innerHTML = xmlhttp.responseText;
		if(int_loadingimg == 0){
			int_loadingimg = setInterval(function(){
				imgloading();
			}, 250);
		}
		
		function imgloading(){
			if(active == 0){
				if($("thepicture").complete == true){
					clearInterval(int_loadingimg);
					int_loadingimg = 0;
					$("loadme").style.display = "none";
					$("comm").style.display = "block";
										fade(new Array("thepicture", 100));
					startpreloading(cur_id);
					if(modus == 0)modus = 1;
					if(modus == 2){
						ki.to_dia = setTimeout(ki.nextdia, 4000);
					}
					return;
				} else {
					$("loadme").style.display = "block";
				}
			}
		}
	}
	
	this.closeImage = function() {
		if(active == 0){
			modus = 0;
			if(int_loadingimg != 0){
				clearInterval(int_loadingimg);
				int_loadingimg = 0;
				$("loadme").style.display = "none";
				startpreloading(cur_id);
			}
			if(ki.to_dia != 0){
				clearTimeout(ki.to_dia);
				ki.to_dia = 0;
			}
			$("comm").style.display = "none";
			removepreview();
			continuewith = new GOON(new Array(resize, shadebody, scrollbars), new Array(new Array(2, bildbreite, 0, "foto"), new Array("1"), new Array("1")) );
			fade(new Array("thepicture", 0));
		}
	}

	this.nextsite = function(startfrom, id) {
		if(int_preloadingimgs != 0){
			clearInterval(int_preloadingimgs);
			int_preloadingimgs = 0;
		}
		cur_id = id;
		pln = startfrom;
		getHTTP("ki_koschtit.php?gallery="+$("koschtit"+id).title+"&number="+id+"&startfrom="+startfrom, thumbspageloaded, id );
	}

	function thumbspageloaded(id) {
		if(waitingResponse == 0){
			$("koschtit"+id).innerHTML = xmlhttp.responseText;
			$("koschtit"+id).style.display = "block";
			startpreloading(id);
		}
	}	

	function viewdim(){
		if (self.innerHeight) // all except Explorer
		{
			windowX = self.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			windowX = document.documentElement.clientWidth;
		}
		else if (document.body) // other Explorers
		{
			windowX = document.body.clientWidth;
		}
	}
	
	this.mousemoved = function(aEvent) {
		if(modus == 1){
			aEvent = aEvent ? aEvent : window.event;
			x = aEvent.clientX ? aEvent.clientX : aEvent.pageX;
			y = aEvent.clientY ? aEvent.clientY : aEvent.pageY;
			ki.oldx = x;
			ki.oldy = y;
			ki.triggerpreview(x,y);	
		}
	}
	
	
	this.triggerpreview = function(x, y) {
		if(x > (190+6) && x < (windowX-185-6) && ki.mousestatus != 0){
			if(ki.mousestatus == -1)
				previewshould[0] = -200;
			else
				previewshould[0] = windowX + 200;
			ki.mousestatus = 0;
			if(active == 0)previewing();
			for(var j = 1; j < 4; j++){
				$("ppl"+j).style.display = "none";
			}
			pre_add = 1;
			pre_gre = 10000;
			$("blende").style.cursor = "default";
		} else { 
			if(x > windowX - 35 && nextid != null && pre_gre > 9999){
				ki.mousestatus = 1;
				previewshould[0] = windowX - 185 - 6;
				previewshould[1] = y - 60;
				previewshould[2] = nextid.innerHTML;
				if(active == 0)previewing();
				$("blende").style.cursor = "pointer";
			} else {
				if(y > pre_gre && pre_add < 4 && ki.mousestatus == 1){
					var temp1 = $(cur_id + "le"+(cur_file+pre_add+1));
					if(temp1 != null){
						
						var act_pre = $("ppl"+(pre_add));
						act_pre.firstChild.src = "ki_makepic.php?file="+temp1.innerHTML;
						act_pre.firstChild.hasloaded = false;
						act_pre.style.left = windowX + 200 + "px";
						act_pre.style.top = pre_gre+50 + "px";
						pre_add += 10;
						var temp3 = 0;
		
						var damn = setInterval( function(){
							if(ki.mousestatus == 0 || pre_add == 1){
								clearInterval(damn);
								act_pre.style.display = "none";
								return;
							}
							if(act_pre.firstChild.complete == true){
								var temp2 = parseInt(act_pre.style.left);
								if(temp3 == 0){
									temp3 = 1;
									move(new Array(1, windowX - 185 - 6, pre_gre, act_pre.id, 0));
									clearInterval(damn);
									pre_add -= 9;
									pre_gre = pre_gre + 50 + act_pre.firstChild.offsetHeight;
									if(ki.oldy > pre_gre)ki.triggerpreview(ki.oldx, ki.oldy);
								}
							}
						}, 25);
					}
				}
			}
			if(x < 40 && previd != null && pre_gre > 9999){
				previewshould[0] = 35;
				ki.mousestatus = -1;
				previewshould[1] = y - 60;
				previewshould[2] = previd.innerHTML;
				if(active == 0)previewing();
				$("blende").style.cursor = "pointer";
			} else {
				if(y > pre_gre && pre_add < 4 && ki.mousestatus == -1){
					var temp1 = $(cur_id + "le"+(cur_file-1*pre_add-1));
					if(temp1 != null){
						
						var act_pre = $("ppl"+(pre_add));
						act_pre.firstChild.src = "ki_makepic.php?file="+temp1.innerHTML;
						act_pre.firstChild.hasloaded = false;
						act_pre.style.left = "-200px";
						act_pre.style.top = pre_gre+50 + "px";
						pre_add += 10;
						var temp3 = 0;
						
						var damn = setInterval( function(){
							if(ki.mousestatus == 0 || pre_add == 1){
								clearInterval(damn);
								act_pre.style.display = "none";
								return;
							}
							if(act_pre.firstChild.complete == true){
								var temp2 = parseInt(act_pre.style.left);
								if(temp3 == 0){
									temp3 = 1;
									move(new Array(1, 35, pre_gre, act_pre.id, 0));
									clearInterval(damn);
									pre_add -= 9;
									pre_gre = pre_gre + 50 + act_pre.firstChild.offsetHeight;
									if(ki.oldy > pre_gre)ki.triggerpreview(ki.oldx, ki.oldy);
								}
							}
						}, 25);
					}
				}
			}
		}
	}

	function previewing(){
		var temp1 = parseInt(prev_obj.style.left);
		var temp2 = windowX/2;
		
		if(previewshould[0] == temp1){
			active = 0;
			return;
		} else {
			if(temp1 != -200 && temp1 != windowX + 200){
				if(temp1 < temp2)
					var temp3 = -200;
				else
					var temp3 = windowX + 200;
				continuewith = new GOON(new Array(previewing), new Array(null));
				move(new Array(1, temp3, parseInt(prev_obj.style.top), "ppl0", 1));
				return;
			} else {
				if(temp1 < temp2){
					if(previewshould[0] < temp2){
						continuewith = new GOON(new Array(move, previewing), new Array(new Array(1, previewshould[0], previewshould[1], "ppl0", 1), null));
						prev_obj.firstChild.src = "ki_makepic.php?file="+previewshould[2];
						prev_obj.firstChild.hasloaded = false;
						previewloading();
						return;
					} else {
						prev_obj.style.left = windowX + 200 + "px";
						prev_obj.style.top = previewshould[1] + "px";
						previewing();
						return;
					}
				} else {
					if(previewshould[0] < temp2){
						prev_obj.style.left = -200 + "px";
						prev_obj.style.top = previewshould[1] + "px";
						previewing();
						return;
					} else {
						continuewith = new GOON(new Array(move, previewing), new Array(new Array(1, previewshould[0], previewshould[1], "ppl0", 1), null));
						prev_obj.firstChild.src = "ki_makepic.php?file="+previewshould[2];
						prev_obj.firstChild.hasloaded = false;
						previewloading();
						return;
					}
				}
			}
		}
	}

	function previewloading() {
		if(prev_obj.firstChild.complete == true){
			clearInterval(int_previewloading);
			int_previewloading = 0;
			prev_obj.style.display = "block";
			pre_gre = previewshould[1] + prev_obj.offsetHeight + 50;
			continue_();			
			return;
		}
		if(int_previewloading == 0){
			int_previewloading = setInterval(previewloading, 25);
		}
	}
	
	this.previewclicked = function(aEvent, gotos) {
		if(waitingResponse == 0 && active == 0){
			
			ki.mousestatus = 0;
			removepreview();
			
			aEvent = aEvent ? aEvent : window.event;
			x = aEvent.clientX ? aEvent.clientX : aEvent.pageX;
			y = aEvent.clientY ? aEvent.clientY : aEvent.pageY;
			
			if(x > windowX*0.5){
				this.getImage(cur_id + "ld" + (cur_file + gotos), 1);
			} else if(x < windowX*0.5){
				this.getImage(cur_id + "ld" + (cur_file - gotos), 1);
			}
		}
	}
	
	
	function removepreview(){
			for(var j = 0; j < 4; j++){
				$("ppl"+j).style.display = "none";
			}
			prev_obj.style.left = -200 + "px";
			pre_add = 1;
			pre_gre = 10000;
			$("blende").style.cursor = "default";
	}	
	
	
	
	this.diashow = function(nummer) {
		modus = 2;
		cur_id = nummer;
		this.getImage(cur_id + "ld1", 0);
	}
	
	this.nextdia = function(){
		clearTimeout(ki.to_dia);
		ki.to_dia = 0;
		if(nextid != null){
			ki.getImage(cur_id + "ld" + nextid.id.substring(4), 1);
		} else {
			ki.getImage(cur_id + "ld1", 1);
		}
		$("comm").style.display = "none";
	}

	function preventDefaultAction(aEvent) {	
				aEvent.preventDefault();
					}
	
	this.taste = function(aEvent) {
		if(waitingResponse == 0 && active == 0 && modus != 0){
			aEvent = aEvent ? aEvent : window.event;
			
			if(aEvent.keyCode == 27) {
				ki.closeImage();
									preventDefaultAction(aEvent);
								return false;
			}
			if(aEvent.keyCode == 19 && modus == 2)
			{
				if(ki.to_dia != 0){
					clearTimeout(ki.to_dia);
					ki.to_dia = 0;
				} else {
					$("comm").style.display = "none";
					ki.nextdia();
				}
									preventDefaultAction(aEvent);
								return false;
			}
			if(aEvent.keyCode == 35 || aEvent.keyCode == 34) {
				if(nextid != null){
					if(ki.to_dia != 0){
						clearTimeout(ki.to_dia);
						ki.to_dia = 0;
					}
					removepreview();
					$("comm").style.display = "none";
					ki.getImage(cur_id + "ld" + nextid.id.substring(4), 1);
				}
									preventDefaultAction(aEvent);
								return false;
			}
			if(aEvent.keyCode == 36 || aEvent.keyCode == 33) {
				if(previd != null){
					if(ki.to_dia != 0){
						clearTimeout(ki.to_dia);
						ki.to_dia = 0;
					}
					removepreview();
					$("comm").style.display = "none";
					ki.getImage(cur_id + "ld" + previd.id.substring(4), 1);
				}
									preventDefaultAction(aEvent);
								return false;
			}
							fensterhoehe = window.innerHeight - bildhoehe;
				fensterbreite = window.innerWidth - bildbreite;
						if(aEvent.keyCode == 40){
									preventDefaultAction(aEvent);
								if(oversizey == 1 && posy >= fensterhoehe){
					picturediv.style.top = parseInt(picturediv.style.top) - 20 + "px";
					posy-=20;
					return false;
				}
			}
			if(aEvent.keyCode == 38){
									preventDefaultAction(aEvent);
								if(oversizey == 1 && posy <= 0){
					picturediv.style.top = parseInt(picturediv.style.top) + 20 + "px";
					posy+=20;
					return false;
				}
			}
			if(aEvent.keyCode == 39){
									preventDefaultAction(aEvent);
								if(oversizex == 1 && posx >= fensterbreite){
					picturediv.style.left = parseInt(picturediv.style.left) - 20 + "px";
					posx-=20;
					return false;
				}
			}
			if(aEvent.keyCode == 37){
									preventDefaultAction(aEvent);
								if(oversizex == 1 && posx != 0){
					picturediv.style.left = parseInt(picturediv.style.left) + 20 + "px";
					posx+=20;
					return false;
				}
			}
		}	
	}

//------------------------------------------------------------------------------

	window.onresize = viewdim;
	viewdim();
		document.onkeypress = this.taste;
		document.onmousemove = this.mousemoved;
	
	
		getHTTP("ki_koschtit.php?gallery="+$("koschtit10").title+"&number=10", moregalleries, 10 );
	}
