var currFlashPluginVersion="10.0.32.18";

function redirectRepertoire()
	{
	var obj=document.getElementById("repertoire1");
		
	if (!obj || document.getElementById("repertoire2")) return;
	obj.onclick();
	}
	
	
function announcement(url,ctgNick,hasContent)
	{
	if (hasContent==1)
		{
		window.location=url;
		return;
		}
		
	switch(ctgNick)
		{
		case "zapkino":
			url="doc_kinostart.html";
			break;
		case "zapwystawy":
			url="doc_wystawystart.html";
			break;
		case "zapkoncerty":
			url="doc_koncertystart.html";
			break;
		case "zapteatr":
			url="doc_teatrstart.html";
			break;
		case "zapdj":
			url="doc_djstart.html";
			break;
		case "zapstrefa":
			url="doc_strefastart.html";
			break;
		case "zapwarsztaty":
			url="doc_warsztatystart.html";
			break;
		}
		
	window.location=url;
	}


function clearField()
	{
	this.value="";
	this.onclick=null;
	}


function clearField2()
	{
	var obj=document.getElementById("panel_text2");
	if (obj.onclick) obj.value="";
	obj=document.getElementById("panel_director");
	if (obj.onclick) obj.value="";
	}
	
	
function removeBillboard()
	{
	var obj=document.getElementsByTagName("body");
	var obj2=document.getElementById("billboard");
	
	if (!obj2) return;
	obj=obj[0];
	obj.removeChild(obj2);
	}
	

//called by Gallery.swf
function showBillboard(pictURL,w,h)
	{
	var element=document.createElement("div");
	var tmp;

	element.id="billboard";
	element.onclick=removeBillboard;
	tmp=document.getElementsByTagName("body");
	tmp=tmp[0];
	tmp.appendChild(element);
	
	tmp=document.createElement("div");
	element.appendChild(tmp);
	element=tmp;
	
	tmp=document.createElement("img");
	tmp.src=pictURL;
	tmp.width=w;
	tmp.height=h;
	tmp.style.marginTop=parseInt(Math.max(0,(document.documentElement.clientHeight-h)/2))+"px";
	element.appendChild(tmp);
	}
	

function initPage()
	{
	var color, obj,tmp;

	redirectRepertoire();
	
	obj=document.getElementById("topGalleryEmbed");
	tmp=typeof(documentId)=="undefined" ? -1 : documentId;
	color=typeof(sectionColor)=="undefined" ? "FFFFFF" : sectionColor;
	if (obj) 
		swfobject.embedSWF("Skins/pl/photos/Gallery.swf","topGalleryEmbed",530,270,currFlashPluginVersion,"/common/expressInstall.swf",{docId:tmp,color:color},{quality:"high",wmode:"transparent",menu:"false"},{id:"topGalleryFlash"});
	
	obj=document.getElementById("verPL");
	if (obj) obj.onclick=function () {window.location="/"};
	obj=document.getElementById("verEN");
	if (obj) obj.onclick=function () {window.location="/en/"};
	if (typeof(headerMode)=="undefined") headerMode="full";
	swfobject.embedSWF("Skins/pl/photos/header.swf","headerEmbed",250,324,currFlashPluginVersion,"/common/expressInstall.swf",{mode:headerMode},{quality:"high",wmode:"transparent",menu:"false"},{id:"headerFlash"});
	
	obj=document.getElementById("promotionEmbed");
	if (obj) 
		swfobject.embedSWF("Skins/pl/photos/Promotion.swf","promotionEmbed",400,152,currFlashPluginVersion,"/common/expressInstall.swf",false,{quality:"high",wmode:"transparent",menu:"false"},{id:"promotionFlash"});
	
	obj=document.getElementById("homeEmbed");
	if (obj) 
		swfobject.embedSWF("Skins/pl/photos/Home.swf","homeEmbed",111,170,currFlashPluginVersion,"/common/expressInstall.swf",false,{quality:"high",wmode:"opaque",menu:"false"},{id:"homeFlash"});
		
	obj=document.getElementById("panel_text");
	if (obj && obj.value=="") 
		{
		obj.value="szukaj w serwisie";
		obj.onclick=clearField;
		}
		
	obj=document.getElementById("panel_text2");
	if (obj && obj.value=="") 
		{
		obj.value="szukaj w tytule";
		obj.onclick=clearField;
		}
		
	obj=document.getElementById("panel_director");
	if (obj && obj.value=="") 
		{
		obj.value="szukaj autora";
		obj.onclick=clearField;
		}
		
	MM_preloadImages("Skins/pl/pictures/icnDocGray.png");
	}


window.onload=init;
initClassObj.registerFunction(initPage);	