function MM_preloadImages()
{
  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()
{
  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)
{
  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()
{
  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_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 MM_showHideLayers()
{
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  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_openBrWindow(theURL,winName,features) {

  window.open(theURL,winName,features);
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}


function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
		styleObject.visibility = newVisibility;
		return true;
    } else {
		return false;
    }
}



function Mover(pathtoimage, layer)
{
	if (typeof(pathtoimage) != 'undefined') {
		MM_swapImage('main','',pathtoimage,1);
	}
	if (typeof(layer) != 'undefined') {
		changeObjectVisibility(layer,'visible');
	}
}

function Mout(layer)
{
	if (typeof(layer) != 'undefined') {
		changeObjectVisibility(layer,'hidden');
	}
	MM_swapImgRestore();
}

function NNMover(pathtoimage, layer)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		if (typeof(pathtoimage) != 'undefined') {
			MM_swapImage('main','',pathtoimage,1);
		}
		if (typeof(layer) != 'undefined') {
			MM_showHideLayers(layer,'','show');
		}
	}
}

function NNMout(layer)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		if (typeof(layer) != 'undefined') {
			MM_showHideLayers(layer,'','hide'); 
			}
		MM_swapImgRestore();
	}
}

function ShowImage(imagenumber)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		parent.frames["browser"].document.close();
		parent.frames["browser"].document.write("<html><head><title>browser</title><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'></head><body bgcolor='#7B97AB' text='#000000' background='../../images/main/background.gif' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><table width='98%' border='0' cellspacing='0' cellpadding='0' height='100%' align='center'>  <tr>    <td align='center' valign='middle'>      <table border='0' cellspacing='0' cellpadding='1'>        <tr>          <td bgcolor='5E656A'><img name='picture' src='"+Images[imagenumber]+"'></td>        </tr>      </table>    </td>  </tr></table></body></html>");
	}
	else {
		parent.frames["browser"].document.images.picture.src=Images[imagenumber];
	}
}

function NMover(obj, pathtoimage, layer)
{
	if (document.getElementById) {
		document.getElementById(obj).style.backgroundColor='#95ACBC';
	} else if (document.all) {
		eval("document.all." + obj + ".style.backgroundColor='#95ACBC';");
	}
}

function NMout(obj)
{
	if (document.getElementById) {
		document.getElementById(obj).style.backgroundColor='#839DB0';
	} else if (document.all) {
		eval("document.all." + obj + ".style.backgroundColor='#839DB0';");
	}
}

function NdoPopup(path)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		DoPopup(path);
	}
}

function DoPopup(path)
{
	// We're setting the available screen sizes

	thewidth=window.screen.availWidth;
	theheight=window.screen.availHeight;
	
	// Browser-Check and custom configuration
	
	if (navigator.appName=="Netscape") {
	
	// Resizing for NN4.x
	
		if (parseInt(navigator.appVersion)==4) {
			thewidth = thewidth-26;
			theheight = theheight-58;
		}
		
	// Resizing for NN5.x (includes 6.x)
	
		else if (parseInt(navigator.appVersion)==5) {
			thewidth = thewidth-12;
			theheight = theheight-45;
		}
	}
	
	if(navigator.appName=="Safari"){
		thewidth = thewidth+40;
		theheight = theheight+40;
	}
	
	// Finally, we can open the popup!
	
	var realbrowser = window.open(path,'kbrowser','status=yes,scrollbars=yes,fullscreen=yes,resizable=yes,width='+thewidth+',height='+theheight+',screenX=0,screenY=0,left=0,right=0');

	//	But IE5 for Mac doesn't do that right, so we have to resize again. And yes, we're asking for version 4. :)
	
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)==4)) {
		realbrowser.resizeTo(window.screen.availWidth, window.screen.availHeight);
	}

	//VERY OLD! ;-))
	//eval("MM_openBrWindow('"+path+"','kbrowser','status=yes,resizable=yes,width=700,height=500')");
}

// "Go"-Funktion fuer Netscape bei direktem Klick

function DGo(num)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		csite = --num;
		ShowImage(num);
	}
}

// "Go"-Funktion exklusive direkter Klick von Netscape

function Go(num)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		switch(num) {
			case "next": {
				if (csite < max) {
					csite++;
					ShowImage(csite);
				}
				break;
			}
			case "last": {
				if (csite > 0) {
					csite--;
					ShowImage(csite);
				}
				break;
			}
			case "start": {
				ShowImage(csite);
				break;
			}
			default: {
				csite = num;
				ShowImage(num);
				break;
			}
		}	
	}
	else {	
		switch(num) {
			case "next": {
				if (csite < max) {
					document.getElementById(csite).style.backgroundImage='none';
					csite++;
					document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
					ShowImage(csite);
				}
				break;
			}
			case "last": {
				if (csite > 0) {
					document.getElementById(csite).style.backgroundImage='none';
					csite--;
					document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
					ShowImage(csite);
				}
				break;
			}
			case "start": {
				document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
				ShowImage(csite);
				break;
			}
			default: {
				document.getElementById(csite).style.backgroundImage='none';
				csite = num;
				document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
				ShowImage(num);
				break;
			}
		}
	}
}

// "Go"-Funktion fuer alle Systeme bei Thumbnails

function KGo(num)
{
	ShowImage(--num);
}

// "Go"-Funktion fuer alle Systeme bei Thumbnails UND Browser

function KBGo(num)
{
	GotoBrowser(--num);
}

// "Go"-Funktion fuer den Browser und Netscape bei direktem Klick


function BDGo(num)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		csite = --num;
		GotoBrowser(num);
	}
}

// "Go"-Funktion fuer den Browser exklusive direkter Klick von Netscape

function BGo(num)
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		switch(num) {
			case "next": {
				if (csite < max) {
					csite++;
					GotoBrowser(csite);
				}
				break;
			}
			case "last": {
				if (csite > 0) {
					csite--;
					GotoBrowser(csite);
				}
				break;
			}
			case "start": {
				GotoBrowser(0);
				break;
			}
		}	
	}
	else {	
		switch(num) {
			case "next": {
				if (csite < max) {
					document.getElementById(csite).style.backgroundImage='none';
					csite++;
					document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
					GotoBrowser(csite);
				}
				break;
			}
			case "last": {
				if (csite > 0) {
					document.getElementById(csite).style.backgroundImage='none';
					csite--;
					document.getElementById(csite).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
					GotoBrowser(csite);
				}
				break;
			}
			case "start": {
				document.getElementById(0).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
				GotoBrowser(0);
				break;
			}
			default: {
				document.getElementById(csite).style.backgroundImage='none';
				document.getElementById(num).style.backgroundImage='url(/images/main/anzeiger_icon.gif)';
				csite = num;
				GotoBrowser(num);
				break;
			}
		}
	}
}

function GotoBrowser(num) {
	parent.frames["browser"].document.location="http://www.biasio.com/biasio_cgi-bin/image.cgi?"+Images[num];
}

function NMail()
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
		location="mailto:info@biasio.com";
	}
}

function contactCheck(stat)
{	
	var emailPat=/^(.+)@(.+)\.(.+)$/;
	var matchArray = document.form1.email.value.match(emailPat);

	if (matchArray==null || document.form1.name.value == "" || document.form1.comment.value == "")
 	{
		alert("Bitte fuellen Sie die Felder \"Name\", \"Nachricht\" sowie \"E-Mail\" korrekt aus.");
	}
	else
	{
		document.form1.submit();
	}
}

function feedbackCheck(stat)
{
	var emailPat=/^(.+)@(.+)\.(.+)$/;
	var matchArray = document.form1.email.value.match(emailPat);

	if (matchArray==null || document.form1.name.value == "")
	{
		alert("Bitte fuellen Sie die Felder \"Name\" und \"E-Mail\" korrekt aus.");
	}
	else
	{
		 document.form1.submit();
	}
}

function nAlert()
{
	if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4)) {
	alert("Dieser Browser wird zur Zeit nicht unterstuezt.");
	}
}
