// <script type="text/javascript">

function forPrint()
{
// wyświetla sam tekst artykułu w osobnym oknie sformatowany do wydruku.
var t=document.title;
var x=document.getElementById("forprint");
noweOkno=window.open('','noweOkno', 'menubar=yes,scrollbars=yes,width=900,height=600');
noweOkno.document.write("<html><head><title>");
noweOkno.document.write(t);
noweOkno.document.write(" - wersja do druku");
noweOkno.document.writeln("</title>");
noweOkno.document.writeln("<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-2\">");
noweOkno.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"print.css\">");
noweOkno.document.writeln("</head><body onload=\"window.print()\">");
noweOkno.document.write(x.innerHTML);
noweOkno.document.writeln("</body></html>");
noweOkno.document.close();
}


	function Ukryj(divid)
	{
		document.getElementById(divid).style.visibility = "hidden";
	}
	function UkryjOproznij(divid)
	{
		document.getElementById(divid).innerHTML = "";
		//document.getElementById(divid).style.display = "none";
	}
	function InsertCode(divid,htmlcode)
	{
		document.getElementById(divid).innerHTML = htmlcode;
		document.getElementById(divid).style.visibility = "visible";
	}
	//var logincode = '<form method="POST" name="login" action="http://www.taraka.pl/2010/login.php"><input type="text" name="email" maxlength="64" /> - e-mail jako login<br><input type="password" name="user_password" maxlength="64" /> - hasło<br><input type="hidden" name="zaloguj" value="1"><b><a href="javascript:document.login.submit()" title="Zaloguj">Zaloguj</a></b> &nbsp; <a href="javascript:SkipLogin()" title="Nie loguj się">Pomiń</a></form>';
	
	var logincode = '<form name="login"><input type="text" name="email" maxlength="64" /> - e-mail jako login<br><input type="password" name="user_password" maxlength="64" /> - hasło<br><input type="hidden" name="zaloguj" value="1"><b><a href="javascript:DoLogin()" title="Zaloguj">Zaloguj</a></b> &nbsp; <a href="javascript:SkipLogin()" title="Nie loguj się">Pomiń</a> &nbsp; <a href="javascript:location.replace(\'password_rescue.php\')" title="Ratunku - Zapomniałem hasła!">Zapomniałem hasła!</a></form>';
	
	var skiplogincode = '<a href="JavaScript:Login()" title="Zaloguj">Zaloguj</a>';
	
	function DoLogin()
	{
		var log = document.forms['login'].elements['email'].value;
		var pas = document.forms['login'].elements['user_password'].value;
		//AjaxDisplay('menu','login.php?log='+log+'&pas='+pas);
		var url = location.href;
		location.replace('login.php?log='+log+'&pas='+pas+'&url='+url);
	}
	
	function Logout()
	{
		var url = location.href;
		location.replace('login.php?out=1&url='+url);
	}

	function Login()
	{
		InsertCode("zaloguj",logincode);
	}
	function SkipLogin()
	{
		InsertCode("zaloguj",skiplogincode);
	}
// visibility:hidden;height:0px
	function MailSendShow(mode)
	{
		if (mode=="on")
		{
			document.getElementById("mailtoAuthor").style.display="none";
			document.getElementById("mailsend").style.display="inline";
		}
		else if (mode=="off")
		{
			document.forms['mailsendform'].elements['mailtitle'].value =
				document.forms['mailsendform'].elements['mailMemoryTitle'].value;
			document.forms['mailsendform'].elements['mailcontent'].value = '';
			//document.forms['mailsendform'].elements['mailyourname'].value;
			//document.forms['mailsendform'].elements['mailaddress'].value;
			//document.forms['mailsendform'].elements['mailcopy'].checked;
			
			document.getElementById("mailsend").style.display="none";
			document.getElementById("mailtoAuthor").style.display="inline";
		}
	}
	function AjaxMailSend(autid)
	{
		var mtitle = document.forms['mailsendform'].elements['mailtitle'].value;
		var mcontent = document.forms['mailsendform'].elements['mailcontent'].value;
		var mname = document.forms['mailsendform'].elements['mailyourname'].value;
		var maddress = document.forms['mailsendform'].elements['mailaddress'].value;
		var mcopy = (document.forms['mailsendform'].elements['mailcopy'].checked ? '1' : '0');
		var marticle = document.forms['mailsendform'].elements['mailMemoryArticle'].value;
		
		mcontent = mcontent.replace(/\n/g, "\n<br>");
		
		MailSendShow('off');
		var respPHP='mailsend.php?autid='+autid+'&marticle='+marticle+'&mcopy='+mcopy+'&mtitle='+mtitle+'&mname='+mname+'&maddress='+maddress+'&mcontent='+mcontent;
		// document.getElementById('stopka').innerHTML=respPHP;
		AjaxDisplay('mailsendKomunikat',respPHP);
		
		
	}
// mailsend.php?autid='+autid+'&mtitle='+mtitle+'&mcontent='+mcontent+'&mname='+mmname+'&maddress='+maddress+'&mcopy='+mcopy 
	
	/*  --------- funkcje Ajax ------------------ */
	function ajaxObject()
	{
		var x = null;
		if (window.XMLHttpRequest) x = new XMLHttpRequest();
		else if (window.ActiveXObject) x = new ActiveXObject("Microsoft.XMLHTTP");
		return x;
	}
	function ajaxCompleted(ajax)
	{
		if (ajax.readyState !=4) return false;
		if (ajax.status !=200) return false;
		return true;
	}
	
	function hideDiv(divid)
	{
		document.getElementById(divid).style.visibility = "hidden";
	}
	
	function AjaxDisplay(divid,responsePHP)
	{
		var Ajax = ajaxObject();
		Ajax.onreadystatechange = function(){
			if (ajaxCompleted(Ajax)){
				document.getElementById(divid).innerHTML = Ajax.responseText;
			}
		}
		Ajax.open('GET',responsePHP,true);
		Ajax.send(null);
	}
	/*  --------- KONIEC funkcji Ajax ------------------ */

function goToUrl(object)
{
	window.location = object.value;
}

function RevColumn(anid,column)
{
	var tab = document.getElementById(anid).value.split('|');
	//
	tab[0]=column;
	if (tab[1]=='asc') {
		tab[1] = 'desc';
		} else {
		tab[1] = 'asc';
		}
	window.location = 'spis.php?var='+tab[0]+'&ord='+tab[1]+'&aut='+tab[2]+'&cat='+tab[3]+'&spec='+tab[4];
	//window.location = 'spis.php?var='+'d'+'&ord='+'asc'+'&aut='+tab[2]+'&cat='+tab[3];
	//window.location = 'spis.php';
}
/*-----------    Wysyłanie e-maili via Ajax    -----------------*/
function MailSend(divid, author_id, art_id)
{
	AjaxDisplay(divid,'mailsend.php?autid='+author_id+'&artid='+art_id);
	document.getElementById(divid).style.visibility = "visible";
}
/* ---------- TOGGLE ULUBIONYCH ----------------------- */
function ToggleLike(itemid, typeid){
		AjaxDisplay("ToggleLike","toggle_like.php?itemid="+itemid+"&typeid="+typeid);
}

//</script>

