var currFlashPluginVersion="10.0.32.18";
var searchMode=1;


function showFlashGallery()
	{
	var obj2, offset, obj=document.getElementById("gallery");
	
	if (!obj) return;
	obj2=document.getElementsByTagName("html");
	obj2=obj2[0];
	
	obj.style.height=(document.body.clientHeight+20)+"px";
	obj.style.visibility="visible";	
	
	obj=document.getElementById("showGalleryFlash");
	offset=obj2.scrollTop;
	if (document.documentElement.clientHeight>600)
		offset+=parseInt((document.documentElement.clientHeight-600)/2);
	obj.style.marginTop=offset+"px";
	}


function hideFlashGallery()
	{
	var obj=document.getElementById("gallery");
	
	if (!obj) return;
	obj.style.visibility="hidden";	
	}
	

function resizeFlashGallery(height)
	{
	var obj=document.getElementById("galleryPickFlash");
	
	if (!obj) return;
	if (height==0)
		obj.style.display="none";
	else
		obj.style.height=height+"px";	
	}
	
	
function showAdvanced()
	{
	var obj=document.getElementById("searchBoxSmall");
		
	if (!obj) return;
	obj.style.display="none";
	obj=document.getElementById("searchBox");
	obj.style.display="table-cell";
	updateSearchPanel();
	}
	
	
function updateSearchPanel()
	{
	var obj, i;
	
	switch(searchMode)
		{
		case 1:	
			for(i=1; i<=6; i++)
				{
				obj=document.getElementById("mode3_"+i);
				obj.style.display="none";
				}
			break;
		case 2:	
			for(i=1; i<=6; i++)
				{
				obj=document.getElementById("mode3_"+i);
				obj.style.display="none";
				}
			break;
		case 3:	
			for(i=1; i<=6; i++)
				{
				obj=document.getElementById("mode3_"+i);
				obj.style.display="inherit";
				}
			break;
		case 4:	
			for(i=1; i<=6; i++)
				{
				obj=document.getElementById("mode3_"+i);
				obj.style.display="none";
				}
			break;
		}
	}
	
	
function switchSearchMode()
	{
	var i, obj;
	
	for(i=1; i<=4; i++)
		{
		obj=document.getElementById("mode"+i);
		obj.style.fontWeight = obj==this ? "bold" : "normal";
		if (obj==this) searchMode=i;
		}
		
	updateSearchPanel();
	}
	
	
function bookmarkPage()
	{
	if (window.external.AddFavorite)
		window.external.AddFavorite(location.href, document.title)		
	else if (window.sidebar)
		window.sidebar.addPanel(document.title, location.href,"");
	}


function updateMediaForm()
	{
	var obj, ctg, str="";
	if (!document.getElementById("etnoAddMediaForm")) return;
	
	obj=document.getElementById("category");
	ctg=obj.options[obj.selectedIndex].value;
	obj=document.getElementById("attRow");
	
	switch(parseInt(ctg))
		{
		case 1:	//video
			str="FLV";
			break;
		case 2:	//audio
			str="MP3";
			break;
		case 3:	//zdjecia
			str="PNG, JPG, GIF - max. 640x480";
			break;
		case 4:	//osadzone
			obj.style.display="none";
			return;
		}
		
	obj.style.display="table-row";
	obj=document.getElementById("extensionInfo");
	obj.innerHTML=str;
	}
	
	
function setSize(idx)
	{
	var obj=document.getElementById("docSizer");
	
	if (!obj) return;
	switch(idx)
		{
		case 1:
			obj.style.fontSize="12px";
			break;
		case 2:
			obj.style.fontSize="14px";
			break;
		case 3:
			obj.style.fontSize="16px";
			break;
		}
	}
	

function initPage()
	{
	var i;

	swfobject.embedSWF("Skins/pl/photos/showGallery.swf","showGalleryEmbed",600,600,currFlashPluginVersion,"/common/expressInstall.swf",{docId:documentId},{quality:"high",wmode:"transparent",menu:"false"},{id:"showGalleryFlash"});
	
	if (document.getElementById("zasobyEmbed"))
		swfobject.embedSWF("Skins/pl/photos/zasoby.swf","zasobyEmbed",310,330,currFlashPluginVersion,"/common/expressInstall.swf",false,{quality:"high",wmode:"opaque",menu:"false"},{id:"zasobyFlash"});
	
	updateMediaForm();
	}
	

window.onload=init;
initClassObj.registerFunction(initPage);