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_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_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 RNDBG()
{
	$zufall = Math.round(Math.random()*4+1);
	return $zufall;
}



function PopupWindow(imageName,imageWidth,imageHeight,alt,bgcolor,mode)
{
//	alt=alt+"  ** Zum Schließen ins Fenster klicken **"
	if (bgcolor=="")
	{
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

    if(w<740){
      var lift=0.90;
    }
    if(w>=740 & w<835){
      var lift=0.91;
    }
    if(w>=835){
      var lift=0.93;
    }

	if (imageWidth>w){	
		byFactor = w / imageWidth;			
		imageWidth = w;
		imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
		byFactor = h / imageHeight;
		imageWidth = (imageWidth * byFactor);
		imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
		imageHeight=imageHeight*lift;
		imageWidth=imageWidth*lift;
	}

	var posLeft=0
	var posTop=0
	
	if (mode=="1") {
		posTop = (scrHeight-imageHeight)/2;
		posLeft = ((w-imageWidth)/2);
		scrHeight = imageHeight-adj;
		scrWidth = imageWidth-adj;
 	}
	
	imageHeight=imageHeight-adj;
	imageWidth=imageWidth-adj;
	var scrHeight = scrHeight+25

	newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>');
	newWindow.document.write('<script language="JavaScript">function clwin(){ window.close()}</script></head>');
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" ');
	newWindow.document.write('align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight); 
	newWindow.document.write(' alt=\"Klick\&nbsp\;Bild\&nbsp\;um\&nbsp\;Fenster\&nbsp\;zu\&nbsp\;schließen.\" >'); 
	newWindow.document.write('</td></tr><tr><td><p align="center"><a href="javascript:clwin();">');
	newWindow.document.write('<img border="0" src="http://www.forsttechnik-lochner.de/images/button_schliessen.gif" width="63" height="13">');
	newWindow.document.write('</a></td></tr></table></body></html>');

	newWindow.document.close();
	newWindow.focus();
}



function PopWin(imageName,imageWidth,imageHeight,alt,bgcolor,mode) {

//	alt=alt+"  ** Zum Schließen ins Fenster klicken **"
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var a = 1;
	var scrHeight = imageHeight;
	var scrHeight = (scrHeight*a) + 15;
	var scrWidth = imageWidth;
	var posLeft=10;
	var posTop=10;
	var titlea="www.Offroadtours-Namibia.de , Namibia";
	newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>');
	newWindow.document.write('<script language="JavaScript">function clwin(){ window.close()}</script></head>');
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');   
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" ');
	newWindow.document.write('align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight); 
	newWindow.document.write(' alt=\"Click\&nbsp\;on\&nbsp\;Picture\&nbsp\;to\&nbsp\;close\&nbsp\;screen.\" >'); 
	newWindow.document.write('</td></tr><tr><td><p align="center"><a href="javascript:clwin();">');
	newWindow.document.write('<img border="0" src="http://www.offroadtours-namibia.de/images/button_close.gif" width="63" height="13">');
	newWindow.document.write('</a></td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function openPDF(b_id)
{
	UploadFenster = window.open('http://www.offroadtours-namibia.de/cms/cms_upload_pdf.php?send_to='+b_id, 'Bildauswahl', 'scrollbars,width=800,height=700');
	UploadFenster.focus();
}

function openPIC(b_id)
{
	UploadFenster = window.open('http://www.offroadtours-namibia.de/cms/cms_upload_pic.php?send_to='+b_id, 'Bildauswahl', 'scrollbars,width=800,height=700');
	UploadFenster.focus();
}

function openImage(b_id)
{
	UploadFenster = window.open('http://www.offroadtours-namibia.de/cms/upload_cms.php?send_to='+b_id, 'Bildauswahl', 'scrollbars,width=800,height=6000');
	UploadFenster.focus();
}

