function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function move(e,ttid) {
iDistanceX = 10;
iDistanceY = 15;
e = e || window.event;
var dbody = (document.compatMode && document.compatMode != 'BackCompat')?document.documentElement:document.body;
var elm = document.getElementById(ttid);
elm.style.left = e.clientX + iDistanceX + dbody.scrollLeft+'px';
elm.style.top  = e.clientY + iDistanceY + dbody.scrollTop+'px';	
}
function move2(e,ttid) {
iDistanceX = -100;
iDistanceY = 15;
e = e || window.event;
var dbody = (document.compatMode && document.compatMode != 'BackCompat')?document.documentElement:document.body;
var elm = document.getElementById(ttid);
elm.style.left = e.clientX + iDistanceX + dbody.scrollLeft+'px';
elm.style.top  = e.clientY + iDistanceY + dbody.scrollTop+'px';	
}

function moveoff(ttid){
	document.getElementById(ttid).style.left=-400+'px';
	document.getElementById(ttid).style.top=-400+'px';
}


function onoff(uebergabe){
	document.getElementById('content1').className = 'out';
	document.getElementById('content2').className = 'out';
	document.getElementById('content3').className = 'out';
	document.getElementById(uebergabe).className = 'out';
}

function displayonoff(uebergabe){
	document.getElementById('content1').style.display = 'none';
	document.getElementById('content2').style.display = 'none';
	document.getElementById('content3').style.display = 'none';
	document.getElementById(uebergabe).style.display = 'block';
}

/*
var intBild = 0;
do {
	intBild = Math.round(Math.random()*10);
} while ( intBild < 1 || intBild > 2 );
*/


/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/
var itemWidth = 250;
var offsetfrommouse=[15,-150]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 270;	// maximum image size.

var noPicture = "";

//if (document.getElementById || document.all){
//	document.write('<div id="trailimageid">');
//	document.write('</div>');
//}


// div leigt ausserhalb html
function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(imagename,title,description,showthumb,height, newItemWidth){

	// wenn neue weite, dann neue weite setzen
	if (newItemWidth != false) {
		itemWidth = newItemWidth + 6;
	}
	
	//itemWidth = 400;
	
	if (height > 0){
		currentimageheight = height;
	}

	document.onmousemove=followmouse;

	cameraHTML = '';
	
	newHTML = '<div>';
	//newHTML = newHTML + '<div class="zoomTitle" style="width:' + itemWidth + 'px;">&nbsp;' + title + '</div>';

	if (showthumb > 0){
		newHTML = newHTML + '<div style="border: 1px solid #999999;" align="center"><img src="' + imagename + '" width="' + newItemWidth + '" border="0"></div>';
	}
	
	//newHTML = newHTML + '<span style="border: 1px solid #000000;height:30px;width:' + itemWidth + 'px;">&nbsp;' + title + '</span><div class="borderbot"></div>';
	
	if ( title != "" )
	{
		itemWidthTitle = itemWidth - 6;
		newHTML = newHTML + '<div class="zoomTitle" style="width:' + itemWidthTitle + 'px;">&nbsp;' + title + '</div>';
	}
		
	newHTML = newHTML + '</div>';
	
	gettrailobjnostyle().innerHTML = newHTML;

	gettrailobj().visibility="visible";

}


//function showhtml(newHtml,height) {
//
//	document.onmousemove=followmouse;
//	newHtml = '<div style="border: 1px solid #000000;background-color:#FFFFFF;padding:5px" align="left">' + newHtml + '<div>';
//	gettrailobjnostyle().innerHTML = newHtml;
//	gettrailobj().visibility="visible";
//
//}

function hidetrail(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-500px"

}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < itemWidth + 50){
			if (noPicture == "yes") {
				xcoord = e.pageX - xcoord - itemWidth; // Move to the left side of the cursor
			} else {
				xcoord = e.pageX - xcoord - itemWidth; // Move to the left side of the cursor
			}
		} else {
			xcoord += e.pageX;
		}
		if ((docheight - e.pageY) < (currentimageheight + 110)){
			ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < itemWidth + 50){
			if (noPicture == "yes") {
				xcoord = event.clientX + truebody().scrollLeft - xcoord - itemWidth; // Move to the left side of the cursor
			} else {
				xcoord = event.clientX + truebody().scrollLeft - xcoord - itemWidth; // Move to the left side of the cursor
			}
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 110)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}

function hideZoom() {
	document.getElementById('zoom').style.display='none';
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function xMM_showHideLayers() { // changed FR : move absolute elements to their right position
	var i,p,v,obj,args=xMM_showHideLayers.arguments;
	if(document.getElementById) {
		for (i=0; i<(args.length-2); i+=3) {
			obj=tmt_findObj(args[i]);
			v=args[i+2];
	   		v=(v=='show')?'visible':(v='hide')?'hidden':v;
			/*if (navigator.appName.indexOf("Microsoft")==-1 && v=='visible' && obj.style.position && obj.style.position=='absolute' && !(obj.name && obj.name.indexOf("Moved_")!=-1)) {
				obj.style.left = parseInt(obj.style.left) + 1 + "px";
				obj.style.top = parseInt(obj.style.top) - 1 + "px";
				obj.name = "Moved_"+obj.id;
			}	*/		
			if(obj)obj.style.visibility=v;
		}
	 }
	 else {
	 	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { 
			v=args[i+2];
			if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
			obj.visibility=v;
		}
	}
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}
