	var pic = new Image();
	imageLinkList = [];
	imageLinkAktiv = -1;
	var nextFlag = false;
	var nextAuto = false;
	var nextAutoTimeout = null;
	var border = 30;
	var imagePath = '';
	var elem = null;
	
	var mediaType = '';
	var swfFile = '';
	var swfTitle = '';
	var swfWidth = 0;
	var swfHeight = 0;
	
//-----------------------------------------------------------------------------
		
	function f_pic_back() {
		f_auto_stop();
		if (imageLinkAktiv != -1 && imageLinkAktiv > 0) {
			imageLinkAktiv--;
			f_next();
		}
	}
	function f_pic_next() {
		f_auto_stop();
		if (imageLinkAktiv != -1 && imageLinkAktiv < imageLinkList.length-1) {
			imageLinkAktiv++;
			f_next();
		}
	}

	function f_auto() {
		if (nextAuto) {
			f_auto_stop();
		}
		else {
			clearTimeout(nextAutoTimeout);
			if (imageLinkAktiv == 0)
				imageLinkAktiv++;
			else
				imageLinkAktiv = 0;
			nextAuto = true;
			f_next();
		}
	}
	function f_auto_next() {
		if (imageLinkAktiv != -1 && imageLinkAktiv < imageLinkList.length-1) {
			imageLinkAktiv++;
			f_next();
		}
		else {
			f_auto_stop();
		}
	}

	function f_auto_stop() {
		clearTimeout(nextAutoTimeout);
		nextAuto = false;
		$('buttonAuto').src = 'images/play.gif'; 
	}
	
	function f_next() {
		pic = new Image();
		pic.src = imageLinkList[imageLinkAktiv];
		nextFlag = true;
		f_screen_hidden();
	}
	
//-----------------------------------------------------------------------------

	function openScreen(e,pdf) {
		swfFile = '';
		if (pdf == null)
			pdf = '';
		elem = e;
//		alert(''+elem.onclick)
//		alert(elem.title+'---'+pdf+'---'+(''+elem.onclick).substring((''+elem.onclick).indexOf('this, "')+7,(''+elem.onclick).indexOf('");')))
//alert(elem.title+'---'+elem.getAttribute('ref'))
		imagePath = frames.inhalt_frame.location.href;
		imagePath = imagePath.substring(0,imagePath.lastIndexOf('/'));
		imageLinkList = [];
		imageLinkAktiv = -1;
		var linkList = inhalt_frame.document.getElementsByTagName("a");
		for (var i = 0; i < linkList.length; i++) {
			link = linkList[i];
			href = link.href;
			if (href != null) {
				if (href.indexOf(".gif") != -1 || href.indexOf(".jpg") != -1 || href.indexOf(".png") != -1) {
//					href = 'file://///or-server/mitarbeiter/Bech/test_jens/produkte/images-produkte'+href.split('images-produkte')[1];
					if (imageLinkList.indexOf(link.href) == -1)
						imageLinkList.push(link);			
				}
			}
		}
//		href = 'file://///or-server/mitarbeiter/Bech/test_jens/produkte/images-produkte'+elem.href.split('images-produkte')[1];
		href = elem.href;
		for (var i = 0; i < imageLinkList.length; i++) {
			link = imageLinkList[i];
			if (link.href.indexOf(href) != -1) {
				imageLinkAktiv = i;
			}
		}
		pic = new Image();
		pic.src = elem.href;
		setTimeout("openScreen_1()",20)
	}
	
//-----------------------------------------------------------------------------

	function openSWF(e_,w_,h_) {
		openMedia(e_,w_,h_);
	}
	
	function openMedia(e,w,h) {
		imageLinkList = [];
		imageLinkAktiv = -1;

		elem = e;
		swfWidth = w;
		swfHeight = h;
		
		swfTitle = elem.getAttribute('title');
		if (swfTitle == null)
			swfTitle = '';

		rel = elem.getAttribute('rel');
		imagePath = frames.inhalt_frame.location.href;
		imagePath = imagePath.substring(0,imagePath.lastIndexOf('/'));
		swfFile = imagePath+'/'+rel;
		setTimeout("openScreen_1()",20)
	}

	function openScreen_1() {
		if (imageLinkAktiv >= imageLinkList.length-1)
			nextAuto = false;

		iWidth = getClientWidth();
		iHeight = getInnerHeight();
		sTop = getScrollTop(parent.frames["body"]);

		if (!nextFlag) {
			$("screen_body").style.visibility = "hidden";
			$("screen_body").style.top = ""+(0)+"px";
			$("screen_body").style.opacity = "0";
			$("screen_body").style.width = ""+iWidth+"px";
			$("screen_body").style.height = ""+document.body.scrollHeight+"px";

			viewWait();
			blendTrans($("screenWait"),20,100,'openScreen_2b()');
		}
		else {
			openScreen_2b();
		}
	}

	function openScreen_2b() {
		if (imageLinkList.length > 0) {
			blendTrans($("screen_body"),20,80,'openScreen_3()');
		}
		else {
			blendTrans($("screen_body"),20,80,'openScreen_4()');
		}
	}

	function openScreen_3() {
		if (!pic.complete) {
			setTimeout("openScreen_3()",50)
		}
		else {
			openScreen_4();
		}
	}
	
	function openScreen_4() {
		viewImage();
		blendTrans($("screen"),20,100,'openScreen_5()');
	}

	function openScreen_5() {
		nextFlag = false;
		if (nextAuto) {
			nextAutoTimeout = setTimeout("f_auto_next()",3000)
		}
	}
		
//----------	

	function f_screen_close() {
		clearTimeout(nextAutoTimeout);
		nextFlag = false;
		nextAuto = false;
		f_screen_hidden();
	}
	
	function f_screen_hidden() {
		if (!nextFlag) {
			$("screenWait").style.visibility = "hidden";
			blendTrans($("screen_body"),-20,0,'f_screen_hidden_1()');
		}
		else 
			f_screen_hidden_1();
	}
	function f_screen_hidden_1() {
		blendTrans($("screen"),-20,0,'f_screen_hidden_2()');
	}

	function f_screen_hidden_2() {
		if (!nextFlag) {
			$("screen_body").style.visibility = "hidden";
			$("screen_body").style.width = "";
			$("screen_body").style.height = "";

			$("screen").innerHTML = "";
			$("screen").style.width = "";
			$("screen").style.height = "";
		}
		if (nextFlag) {
			openScreen_1();
		}
	}

	function f_down() {
//		f_screen_hidden();
	}

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

	function viewWait() {
		var W = "";
		var picW = 300;
		var picH = 200;

/*		if (nextFlag) {
			picW = pic.width;
			picH = pic.height;
		}*/

		W += '<table id="screen_wait_table" border="0" cellspacing="0" cellpadding="0">';
		W += '<tr onclick="f_screen_close()">';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_o_l.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity" style="cursor: pointer;" align="right" rowspan="2"><img src="images/close.png" style="border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_o_r.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: '+(border)+'px; height: 0px; border: 0px" /></td>';
		W += '<td id="" class="screen_opacity" style="width: '+picW+'px; height: '+picH+'px; text-align: center"><img src="images/wait.gif" style="border: 0px" /></td>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: '+(border)+'px; height: 0px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '<td class="screen_opacity" rowspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border)+'px; border: 0px" /></td>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>'
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_u_l.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_u_r.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '</tr>';
		W += '</table>';
		$("screenWait").innerHTML = W;

		newLeft = parseInt((iWidth-$("screen_wait_table").getWidth())/2,10);
		newTop = parseInt((iHeight-$("screen_wait_table").getHeight())/2+sTop,10);
		$("screenWait").style.left = newLeft+'px';
		$("screenWait").style.top = newTop+'px';
	}

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

	function viewImage() {
		var W = "";
		W += '<table id="screen_table" border="0" cellspacing="0" cellpadding="0">';
		W += '<tr onclick="f_screen_close()">';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_o_l.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';

//		W += '<td class="screen_opacity" style="cursor: pointer;" align="right" rowspan="2"><img src="images/close.png" style="border: 0px" /></td>';
		W += '<td class="screen_opacity" style="cursor: pointer;" rowspan="2">';

		W += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		W += '<tr>';
		titel = '';
		if (imageLinkList.length > 0) {
			titel = imageLinkList[imageLinkAktiv].getAttribute('title');
			if (titel == null)
				titel = '';
		}
		else {
			titel = swfTitle;
		}
		W += '<td class="big_pic_titel" style="width: 99%" align="left">'+titel+'</td>';
		W += '<td style="cursor: pointer;" align="right"><img src="images/close.png" style="border: 0px" /></td>';
		W += '</tr></table>';

		W += '</td>';

		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_o_r.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';
		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: '+(border)+'px; height: 0px; border: 0px" /></td>';
		if (swfFile != '')
			W += '<td id="screenImage" class="screen_opacity" style="width: 300px; height: 200px; text-align: center">';
		else
			W += '<td id="screenImage" class="screen_opacity" style="width: 300px; height: 200px; text-align: center" onclick="f_screen_close()">';
		if (swfFile.indexOf('.swf') != -1) {
			W += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+swfWidth+'" height="'+swfHeight+'" border="0" vspace="0" hspace="0">';
			W += '<param name="movie" value="'+swfFile+'">';
			W += '<param name="quality" value="high">';
			W += '<embed src="'+swfFile+'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+swfWidth+'" height="'+swfHeight+'" border="0" vspace="0" hspace="0">';
			W += '</embed>'; 
			W += '</object>';
		}
		else if (swfFile.indexOf('.flv') != -1) {
			if (imagePath.indexOf('pages/') != -1) {
				mediaplayer = imagePath.split('pages/')[0]+'pages/js/mediaplayer.swf';
			}
			else {
				mediaplayer = top.location.href;
				mediaplayer = mediaplayer.substring(0,mediaplayer.lastIndexOf('/'))+'/js/mediaplayer.swf';
			}
 			flashvars = swfFile+'&autostart=true';
			W += '<object width="'+swfWidth+'" height="'+swfHeight+'"'; 
			W += ' type="application/x-shockwave-flash"'; 
			W += ' data="'+mediaplayer+'">';
//			W += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'; 
//			W += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.115>';
			W += '<param name="flashvars" value="file='+flashvars+'" />';
			W += '<param name="movie" value="'+mediaplayer+'" />';
			W += '<param name="quality" value="high" />';
			W += '<param name="wmode" value="transparent" />';
			W += '<param name="scale" value="noscale" />';
			W += '<embed src="'+mediaplayer+'" width="'+swfWidth+'" height="'+swfHeight+'" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file='+flashvars+'" />';
			W += '</object>';
		}
		else if (swfFile.indexOf('.flv_') != -1) {
 			mediaplayer = imagePath.split('pages')[0]+'pages/js/player.swf';
 			movie = swfFile+'&autoplay=on&autoload=on&autorewind=on';
// 			mediaplayer = 'player.swf';
// 			movie = 'video/zuber2.flv';
			W += '<object width="'+swfWidth+'" height="'+swfHeight+'" id="flvPlayer" ';
			W += ' type="application/x-shockwave-flash">'; 
			W += '<param name="allowFullScreen" value="true" />';
			W += '<param name="movie" value="'+mediaplayer+'?movie='+movie+'" />';
			W += '<embed src="'+mediaplayer+'?movie='+movie+'" width="'+swfWidth+'" height="'+swfHeight+'" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
			W += '</object>';
		}
		else if (swfFile.indexOf('.mpg') != -1) {
			W += '<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="'+swfWidth+'" height="'+swfHeight+'" border="0">';
//			W += '<param name="type" value="application/x-oleobject" />';
			W += '<param name="filename" value="'+swfFile+'" />';
//			W += ' <param name="URL" value="'+src+'" />';
			W += '<param name="PlayCount" value="1" />';
			W += '<param name="AutoStart" value="1" />';
			W += '<param name="ShowControls" value="1" />';
			W += '<param name="ShowDisplay" value="0" />';
			W += '<param name="ShowAudioControls" value="1" />';
			W += '<param name="ShowGotoBar" value="0" />';
			W += '<param name="ShowPositionControls" value="0" />';
			W += '<param name="ShowStatusBar" value="0" />';
			W += '<param name="AutoSize" value="0" />';
			W += '<param name="Mute" value="0" />';
			W += '<param name="currentPosition" value="0" />';
			W += '<embed src="'+swfFile+'" type="video/x-ms-wmv" autostart="1" enabled="1" showstatusbar="0" showdisplay="0" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" width="'+swfWidth+'" height="'+swfHeight+'"></embed>';
			W += '</object>';
		}
		else {
			W += '<img src="'+pic.src+'" style="width: '+pic.width+'px; height: '+pic.height+'px;  border: 0px" />';
		}

		W += '</td>';

		W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: '+(border)+'px; height: 0px; border: 0px" /></td>';
		W += '</tr>';
		W += '<tr>';

		if (imageLinkList.length > 1) {
			W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(48-16)+'px; border: 0px" /></td>';
			W += '<td class="screen_opacity" rowspan="2">';

			W += '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>';
			W += '<td width="50%"><img src="images/leer.gif" style="width: 1px; height: 1px; border: 0px" /></td>';
			W += '<td align="center">';
	
			W += '<table border="0" cellspacing="0" cellpadding="0"><tr>';
			W += '<td style="cursor: pointer;" onclick="f_pic_back()" title="Previous Picture"><img src="images/back.gif" style="border: 0px" /></td>';
			W += '<td class="big_pic_count" style=""><nobr>'+(imageLinkAktiv+1)+' of '+imageLinkList.length+'</nobr></td>';
			W += '<td style="cursor: pointer;" onclick="f_pic_next()" title="Next Picture"><img src="images/next.gif" style="border: 0px" /></td>';
			W += '<td><img src="images/leer.gif" style="width: 31px; height: 1px; border: 0px" /></td>';
	
			src = 'images/play.gif';
			if (nextAuto)
				src = 'images/stop.gif'; 
			
			W += '<td style="cursor: pointer;" onclick="f_auto()" title="Start/Stop automatic viewing"><img id="buttonAuto" src="'+src+'" style="border: 0px" /></td>';

			W += '</tr></table>';
			W += '</td>';
	
			link = '&nbsp;';
			rel = imageLinkList[imageLinkAktiv].getAttribute('rel');
			if (rel != null && rel != '')
				link  = '<a href="'+imagePath+'/'+rel+'" target="_blank" onclick="openMaxWindow(this); return false;" style="cursor: pointer;"><img id="buttonAuto" src="images/lupe.jpg" style="border: 0px" /></a>';
			W += '<td width="50%" style="" align="right">'+link+'</td>';
	
			W += '</tr></table>';

			W += '</td>';
			W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(48-16)+'px; border: 0px" /></td>';
		}
		else {
			W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
			W += '<td class="screen_opacity" rowspan="2">';
			W += '</td>';
			W += '<td class="screen_opacity" colspan="2"><img src="images/leer.gif" style="width: 0px; height: '+(border-16)+'px; border: 0px" /></td>';
		}

		W += '</tr>';
		W += '<tr>'
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_u_l.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity"><img src="images/leer.gif" style="width: '+(border-16)+'px; height: 16px; border: 0px" /></td>';
		W += '<td class="screen_opacity_ecke"><img src="images/rundung_screen_u_r.png" style="width: 16px; height: 16px; border: 0px" /></td>';
		W += '</tr>';
		W += '</table>';
		$("screen").innerHTML = W;

		newLeft = parseInt((iWidth-$("screen_table").getWidth())/2,10);
		newTop = parseInt((iHeight-$("screen_table").getHeight())/2+sTop,10);
		$("screen").style.left = newLeft+'px';
		$("screen").style.top = newTop+'px';
	}

