function uruchomswf(k){
	// k=1  uruchom swf-a
	// k=2 zamknij swf-a
	if (k=='1'){
		document.getElementById("mewyswf").style.display = 'block';	
		document.getElementById("mewyjpg").style.display = 'none';           
	}else{
		document.getElementById("mewyswf").style.display = 'none';	
		document.getElementById("mewyjpg").style.display = 'block';               
	}
        advAJAX.download('iframemewy', '/p/iframe_mewy.php?mewy='+k);           
}


function LeftMenuOver(menu_id,ev)
{

    if(lastMenu!=null && lastMenu!=menu_id)
	{
		HideSubMenu(lastMenu);
		window.clearTimeout(menuTimeout);
	}
	var sub = document.getElementById("subMenu"+menu_id);
	var menu = document.getElementById("Menu"+menu_id);
	menu.className = "leftMenuElementOver";
	var lewo = document.getElementById("menuLeft");
	if(sub)
	{
		var leftSpace = 0; 
		var winWidth = 0;

		leftSpace = lewo.offsetLeft+lewo.offsetWidth-14;
		if(navigator.userAgent.indexOf("MSIE") == -1 || navigator.userAgent.indexOf("Opera") != -1)  
			leftSpace = leftSpace-10;
		if((sub.offsetTop+sub.offsetHeight+140)>window.screen.availHeight) 
			sub.style.top=document.body.scrollTop+(window.screen.availHeight-sub.offsetHeight)/2;

		sub.style.left = leftSpace;
		sub.style.visibility = "visible";

		menuTimeout = window.setTimeout("HideSubMenu('"+menu_id+"')",4000);
		lastMenu = menu_id;
	}
}

function LeftMenuOut(menu_id)
{
	var menu = document.getElementById("Menu"+menu_id);
	menu.className = "leftMenuElementOut";
}

function SubMenuOut(menu_id)
{
	var sub = document.getElementById("subMenu"+menu_id);
	if(sub)
		subTimeout = window.setTimeout("HideSubMenu('"+menu_id+"')",300);
}

function HideSubMenu(menu_id)
{
	var sub = document.getElementById("subMenu"+menu_id);
	if(sub)
		sub.style.visibility = "hidden";
}

function SubMenuOver(menu_id,ev)
{
	window.clearTimeout(menuTimeout);
	window.clearTimeout(subTimeout);
}

function dodajDoUlubionych( Tytul, link ) {
	if( window.sidebar && window.sidebar.addPanel ) {
		//Gecko (Netscape 6 etc.) - add to Sidebar
		window.addPanel( Tytul, link, '' );
	} else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
		//IE Win32 or iCab - checking for AddFavorite produces errors for no
		//good reason, so I use a platform and browser detect.
		//adds the current page page as a favourite; if this is unwanted,
		//simply write the desired page in here instead of 'location.href'
		window.external.AddFavorite( window.location.href, document.title );
	} else if( window.opera && window.print ) {
		//Opera 6+ - add as sidebar panel to Hotlist
		return true;
	} else if( document.layers ) {
		//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
		//not target page)
		window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
	} else {
		//other browsers - tell them to add a bookmark (adds current page, not target page)
		window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
	}
	return false;
}

function okienko(adres, tytul, wys, szer)
{
	window.open(adres,"tytul", 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=no, width='+szer+', height='+wys);

}

function otworzZTekstem(tekst, tytul, wys, szer)
{
	
	TextWindow = window.open('', tytul, 'toolbar=no, resizable=yes, top=200, left=200, width=' + szer + ', height=' + wys);
	TextWindow.document.open();
	TextWindow.document.write('<HTML lang="pl"><HEAD><meta http-equiv="content-type" content="text/html;charset=iso-8859-2"><TITLE>'+tytul+'</TITLE></HEAD>');
	TextWindow.document.write('<BODY marginheight="5" marginwidth="5" topmargin="" leftmargin="5">');
	TextWindow.document.write('<div style="color:#616161; font-size:11px; font-family:Tahoma, Arial, Verdana, sans-serif; font-weight:normal;text-align:justify;">');
	TextWindow.document.write('<font color=red><b>'+tytul+'</b></font><br><br>');
	TextWindow.document.write(tekst);
	TextWindow.document.write('</div>');
	TextWindow.document.write('</BODY></HEAD>');
	TextWindow.document.close();
	TextWindow.focus();

}


function podgladKartka(id_zdjecia) 
{
	
	kadIdZjecia = 'kadIdZjecia='+id_zdjecia;	
	karOdbEmail = 'karOdbEmail='+document.forms['mailForm'].input_email.value;
	karNadEmail = 'karNadEmail='+document.forms['mailForm'].input_emailn.value;
	karNadNazwa = 'karNadNazwa='+document.forms['mailForm'].input_nadawca.value;
	karTresc = 'karTresc='+document.forms['mailForm'].textarea_tresc.value;
	karNaglowek = 'karNaglowek='+document.forms['mailForm'].input_tytul.value;
	karIdSzablon = 'karIdSzablon='+document.forms['mailForm'].kartka_szablon.value;
	
	id = 0;
	if (document.forms['mailForm'].radio_znaczki.value > 0) {
		id = document.forms['mailForm'].radio_znaczki.value;
	} else {
		for (i=0;i<document.forms['mailForm'].radio_znaczki.length;i++){
			if (document.forms['mailForm'].radio_znaczki[i].checked==true)
				id = document.forms['mailForm'].radio_znaczki[i].value;
		}
	}	
	karIdZnaczek = 'karIdZnaczek='+id;
	
	id = 0;
	if (document.forms['mailForm'].radio_papeteria.value > 0) {
		id = document.forms['mailForm'].radio_papeteria.value;
	} else {
		for (i=0;i<document.forms['mailForm'].radio_papeteria.length;i++){
			if (document.forms['mailForm'].radio_papeteria[i].checked==true)
				id = document.forms['mailForm'].radio_papeteria[i].value;
		}
	}
	karIdPapeteria = 'karIdPapeteria='+id;	

	adres = kadIdZjecia+'&'+karOdbEmail+'&'+karNadEmail+'&'+karNadNazwa+'&'+karTresc+'&'+karIdZnaczek+'&'+karIdPapeteria+'&'+karNaglowek+'&'+karIdSzablon;

	okienko('/kartki/odczyt/kartka.html?'+adres,'Podglad_kartki',600,800);
}

sfHover = function() {
	var sfEls = document.getElementById("navmsie").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent)
	{
	 window.attachEvent("onload", sfHover);
	 }

