
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_showHideLayers() { //v6.0
  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; }
}


	var PopupWindow;
	var minW = 100;
	var minH = 100;
	var retries = 30;
	var tried = 0;


	// Opens a Popup displaying an image not wider than "maxW" and not higher than "maxH".
	// If the image is very small a minimal height ("minH") and a minimal width ("minW") are kept.



	function imgReduce( image, maxW, maxH ) {
		var tempImg;
		tempImg = new Image();
		tempImg.src = image;
		if( PopupWindow ) {
			PopupWindow.close();
		}
		PopupWindow = window.open("" ,'Test','resizable=yes,width=' + maxW + ',height=' + maxH + ',scrollbars=no,top=100,left=100,screenx=100,screeny=100,status=no');
		PopupWindow.document.open();
		PopupWindow.document.write("<html>\n\t<head>\n\t\t<title>Bild : " + tempImg.src + "</title>\n\t</head>\n\t<body bgcolor=\"#dddddd\" style=\"margin:0px;\">\n");
		PopupWindow.document.write( "\t\t<table height=\"100%\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t<tr>\n\t\t\t\t<td align=\"center\">\n");
		PopupWindow.document.write("\t\t\t\t\t<img src="+tempImg.src+" align=\"center\" onclick=\"PopupWindow = null; self.close();\" title=\"Klicken um Fenster zu schliessen\">\n");
		PopupWindow.document.write("\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n");
		PopupWindow.document.write("\t</body>\n</html>");
		PopupWindow.document.close();
		PopupWindow.focus();
		imgSqueeze( image, maxW, maxH );
	}

	function imgSqueeze( image, maxW, maxH )
		{
		var tempImg;
		var iWidth;
		var iHeight;
		tried += 1;
		tempImg = new Image();
		tempImg.src = image;

		if( tempImg.complete || tried >= retries )
			{
			iWidth = tempImg.width;
			iHeight = tempImg.height;
			if( iWidth < minW ) iWidth = minW;
			if( iHeight < minH ) iWidth = minH;
			msg = 'Image : "' + tempImg.src + '"\nWidth : ' + iWidth + '\nHeight : ' + iHeight ; 
			//alert( msg );
			
			if( maxW < 1 ) { maxW = iWidth; }
			if( maxH < 1 ) { maxH = iHeight; }
			
			iWx = iWidth / maxW;
			iHx = iHeight / maxH;
			if( iHx > 1 || iWx > 1 )
				{
				if( iWx > iHx )
					{
					iHeight = Math.floor( iHeight / iWx );
					iWidth = Math.floor( iWidth / iWx );
					} 
				else
					{
					iHeight = Math.floor( iHeight / iHx );
					iWidth = Math.floor( iWidth / iHx );
					} 
				}
			sizeString = 'Image: ' + image + '\nNew size: ' + iWidth + 'x' + iHeight ; 
			//alert( sizeString );
			tempImg.setAttribute( "width" , iWidth );
			tempImg.setAttribute( "height" , iHeight );
			
			if( PopupWindow ) {

				PopupWindow.document.open();
				PopupWindow.document.write("<html>\n\t<head>\n\t\t<title>Bild : " + tempImg.src + " (" + iWidth + "x" + iHeight +") " + tried + "</title>\n\t</head>\n\t<body bgcolor=\"#dddddd\" style=\"margin:0px;\">\n");
				PopupWindow.document.write( "\t\t<table height=\"100%\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n\t\t\t<tr>\n\t\t\t\t<td align=\"center\">\n");
				PopupWindow.document.write("\t\t\t\t\t<img src="+tempImg.src+" height=\"" + iHeight + "\" width=\"" + iWidth + "\" align=\"center\" onclick=\"self.close()\" title=\"Klicken um Fenster zu schliessen\">\n");
				PopupWindow.document.write("\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n");
				PopupWindow.document.write("\t</body>\n</html>");
				PopupWindow.document.close();
				PopupWindow.resizeTo(eval(iWidth+40),eval(iHeight+80)); 
				PopupWindow.focus();
			
			}
			tried=0;
			}
		else
			{
			retry = "imgSqueeze( '" + image + "', " + maxW + ", " + maxH + " )";
			window.setTimeout( retry , 200 );
			}
		}
		
		function RandImage()

		{

                var Bild = new Array();

                Bild[1] = "pedigree_start_01.jpg";

                Bild[2] = "pedigree_start_02.jpg";

                /*Bild[3] = "3.jpg";

                Bild[4] = "4.jpg";

                Bild[5] = "5.jpg";

                Bild[6] = "6.jpg";	*/

                

                var Zahl = Math.round(Math.random()*6)

                if (Zahl > 0 && Zahl <= 2) 
                {


                               img = "/pbweb/img/skelett/"+Bild[Zahl];
							   //if(img == 'img/skelett/1.jpg')
							   //{
									//document.getElementById('MainImage_UserDiv').style.opacity = 0.5;
									//document.getElementById('MainImage_UserDiv').style.backgroundColor = '#000';
									document.getElementById('MainImage_UserNameLit').style.color = '#000000';
									document.getElementById('MainImage_UserLit').style.position = 'relative';
									document.getElementById('MainImage_UserLit').style.top = '-90px';
									document.getElementById('MainImage_UserNameLit').style.color = '#000000';
									document.getElementById('MainImage_UserLit').style.color = '#000000';
									document.getElementById('MainImage_UserNameLit').style.position = 'relative';
									document.getElementById('MainImage_UserNameLit').style.top = '-90px';
									
							   //}                               

                               document.getElementById('TitlePic').src = img;
							 

			}
			return img;

}
	
			
