function FlashSupported() 
{  
	var playerVersion = swfobject.getFlashPlayerVersion();
	return (playerVersion.major != 0);
}

function SetPicasaAlbum(link,picElementName,title,id)
{  
	if(FlashSupported())
	{
		var elPPKKBody = document.getElementById("PPKKBody");
		var w  =  window.innerWidth != null ? window.innerWidth: 
			          document.body != null ? document.body.clientWidth:null;
		var hW = window.innerHeight != null ? window.innerHeight: 
					  document.body != null ? document.body.innerHeight:null;
		w = w - 10;
		hW = hW - 10;
		var h = Math.floor((5*w)/7);
		if(h > hW)
		{
			h = hW;
		}
		var text = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + w + '" height="'+ h + '" id="' + title + '">';
		text = text + '<param name="movie"  value="http://picasaweb.google.com/s/c/bin/slideshow.swf" />';
		text = text + '<param name="quality" value="high" />'; 
		text = text + '<param name="bgcolor" value="#e9d7d5" />';
		text = text + '<embed type="application/x-shockwave-flash" src="http://picasaweb.google.com/s/c/bin/slideshow.swf" width="'+w+'" height="'+h+'" flashvars="host=picasaweb.google.com&RGB=0xf0e1e0&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fppkk.miauton%2Falbumid%2F'+id+'%3Fkind%3Dphoto%26alt%3Drss" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	    text = text + '</object>';
	    text = text + '<div class="RightFloat"><a href="'+link+'">Picasa...</a></div>';					
		var elPPKKdisp = document.getElementById(picElementName);
	    elPPKKdisp.innerHTML = text;
	}
}

function UpdateHeight() 
{	
	var h = window.innerHeight != null ? window.innerHeight: 
			document.body != null ? document.body.clientHeight:null;
	if(h != null)
	{
		var txtBox = document.getElementById("PPKKBody");
		if(txtBox != null)
		{
			var banner = document.getElementById("PPKKTitleBanner");
			if(banner != null)
			{
				h = eval(h - banner.offsetHeight);
				banner = document.getElementById("PPKKEndBanner");
				if(banner != null)
				{
					h = eval(h - banner.offsetHeight);
					h = eval(h -5);
					txtBox.style.minHeight = ""+h+"px";
				}
			}
		}
	}
}

function InitAlbumPage(link,picElementName)
{
	setTimeout(UpdateHeight, 100);
	SetPicasaAlbum(link,picElementName);
}

function InitGenericPage()
{
	setTimeout(UpdateHeight, 100);
}

function SetOnloadHandler(fct)
{
	if ( window.addEventListener ) 	{ 
		window.addEventListener("load", fct, attachEvent )
	}else if (window.attachEvent) {	
		window.attachEvent( "onload", fct );
	} else  if ( window.onLoad ) {
    	window.onload = fct;
	}
}
