function ColorIn(id) {
    mint.fx.Color(id, "backgroundColor", null, "000000", 20, 500);
}

function ColorOut(id) {
    mint.fx.Color(id, "backgroundColor", null, "999999", 20, 500);
}

function PColorIn(id) {
    mint.fx.Color(id, "backgroundColor", null, "ffff00", 10, 100);
    mint.fx.Size(id, 140, 26, 20, 500);
}

function PColorOut(id) {
    mint.fx.Color(id, "backgroundColor", null, "666666", 10, 100);
    mint.fx.Size(id, 130, 22, 20, 500);
}
function tablerowmover(id){
	id.style.background = '#CCCC00';
}
function tablerowmout(id){
	if ( $(id).hasClass('troutok') )
		id.style.background = '#FFFFFF';
	
	if ( $(id).hasClass('troutnok') ) 
		id.style.background = '#FF9933';
}

function start(ins){
	for(var i = 0 ; i < ins ; i++){ //alert(i)
		mint.fx.Round("item"+i, "all", "medium",false);
	}
	//mint.fx.Round("CO", "all", "small",true);
	//mint.fx.Round("KOGO", "all", "small",true);
	//mint.fx.Round("KTO", "all", "small",true);
	//mint.fx.Round("REJ", "all", "small",true);

	mint.fx.Round("ARMENU", "all", "medium",false);

}

function dodajtekst(id){
//alert( $(id) );
	var req = mint.Request();
     req.Send("pelnyrycerz", id );
	mint.fx.Size( id, 550, 750, 20, 500);
}

function odejmijtekst(id){
	var req = mint.Request();
    req.Send("rycerzskrot", id);
	mint.fx.Size(id, 550, 100, 20, 500);
}
 				

function powieksz(id)
{
    	mint.fx.Size(id, 550, 750, 20, 500);
} 
function pomniejsz(id)
{
    	mint.fx.Size(id, 550, 100, 20, 500);
} 

function pokaz(ins) {
	for(var i = 0 ; i < ins ; i++)
	{ 
    	mint.fx.Size("item"+i, 200, 200, 20, 500);
		//mint.fx.Round("item"+i, "all", "medium",false);
	}
    //mint.fx.Size("item", 200, 200, 20, 500);
} 

function sprawdz_mail(ml){
	if( ml.search('@') < 1 || ml.search('@') > (ml.length-2) || ml.value == '' || ml.search('\\s+') != -1 ){
		alert("To jest niepoprawny adres poczty");
		return false;
	}
	else return true;
}
function login(){
	location.replace("log.php"); 
}
///ZROBIC po jednej funkcji confdel,  zmienkolejnosc itp...
function addfooteritem(){
	location.replace("funkcje/footeradditem.php?add=1" );
}
function footerzmienkolejnosc(id,nnum){
	if( nnum.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/footerchangenns.php?nid="+id+"&nnum="+nnum );
}
function confdelfooteritem(id){
	if ( confirm("Czy na pewno usunąć element stopki?") == true)
		location.replace("funkcje/footerdelitem.php?delid=" + id);
	else
		return false;
}
function footerzmienbaner(id,id_baner){
	location.replace("funkcje/footerchangebaner.php?id="+id+"&id_baner="+id_baner);
}
function footerzmienwidth(id,nwidth){
	if( nwidth.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nową szerokością.");
		return false;
	}
	location.replace("funkcje/footerchangewidth.php?nid="+id+"&nwidth="+nwidth );
}
function footerzmienheight(id,nheight){
	if( nheight.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nową wysokością.");
		return false;
	}
	location.replace("funkcje/footerchangeheight.php?nid="+id+"&nheight="+nheight );
}
////
function confdelmail(id){
	if ( confirm("Czy na pewno usunąć maila?") == true)
		location.replace("funkcje/delmail.php?delmail="+id); 
	else
		return false;
}
function confdelquest(id){
	if ( confirm("Czy na pewno usunąć pytanie?") == true)
		location.replace("funkcje/delquest.php?delquest="+id); 
	else
		return false;
}
function dodajmaila(mail){
	if( sprawdz_mail(mail) == true) location.replace("funkcje/dodajmail.php?mail="+mail);
	else return false;
}
function wys_pyt(ktore){
	if( ktore == 'all' ){
		location.replace("index.php?mi=9&tylko_akt=0");
	}
	else {
		location.replace("index.php?mi=9&tylkoakt=1")
	}
}
function confdelgfx(path){
	if ( confirm("Czy na pewno usunąć plik?") == true)
		location.replace("funkcje/delgfx.php?delgfx=" + path);
	else
		return false;
}
function confdeluser(idu){
	if ( confirm("Czy na pewno usunąć użytkownika?") == true)
		location.replace("funkcje/deluser.php?delid="+idu );
	else
		return false;
}
function artszmienkolejnosc(id,nnum){
	if( nnum.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/artchangenns.php?nid="+id+"&nnum="+nnum );
}
function newszmienkolejnosc(id,nnum){
	if( nnum.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/newchangenns.php?nid="+id+"&nnum="+nnum );
}
function jurorszmienkolejnosc(id,nnum){
	if( nnum.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/jurorschangenns.php?nid="+id+"&nnum="+nnum );
}
function linkszmienkolejnosc(id,nnum){
	if( nnum.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/linkschangenns.php?nid="+id+"&nnum="+nnum );
}
function artszmienins(nins){
	if( nins.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/artchangeins.php?nins="+nins );
}
function newszmienins(nins){
	if( nins.match('^[\\s]*[0-9]+[\\s]*$') == null ){
		alert("Coś nie tak z nowym numerem.");
		return false;
	}
	location.replace("funkcje/newschangeins.php?nins="+nins );
}

function confdelart(ida){
	if ( confirm("Czy na pewno usunąć artykuł?") == true)
		location.replace("funkcje/artdel.php?delid="+ida );
	else
		return false;
}
function confdelnew(ida){
	if ( confirm("Czy na pewno usunąć njusa?") == true)
		location.replace("funkcje/newdel.php?delid="+ida );
	else
		return false;
}
function confdeljuror(idj){
	if ( confirm("Czy na pewno usunąć jurora?") == true)
		location.replace("funkcje/jurordel.php?delid="+idj );
	else
		return false;
}
function confdellink(idj){
	if ( confirm("Czy na pewno usunąć linka?") == true)
		location.replace("funkcje/linkdel.php?delid="+idj );
	else
		return false;
}
function wstawobraz(){
	
}
/////////edycja ///// Arts & Njus ///////////////////////////////
function bold(id){
	if ( $('opis').checked ) $(id).value += "<b>to będzie pogrubione</b>";
	else $(id).value += "<b>X</b>";	
}
function ital(id){
	if ( $('opis').checked ) $(id).value += "<i>to będzie kursywą</i>";
	else $(id).value += "<i>X</i>";
}
function newline(id){
	$(id).value += "<br />";	
}
function quotes(id){
	if ( $('opis').checked ) $(id).value += "&quot;to będzie w cudzysłowach&quot;";	
	else $(id).value += "&quot;X&quot;";
}
function link(id){
	if ( $('opis').checked ) $(id).value += "<a href=\"tu wpisz URL\"> tu wpisz treść linka </a>";	
	else $(id).value += "<a href=\"URL\">link</a>";
}
function ordlist(id){
	var ne = prompt("Ile elementów ?");
	document.getElementById(id).value += "<ol>";
	for(var i = 1 ; i <= ne ; i++){
		if ( document.getElementById('opis').checked ) document.getElementById(id).value += "<li>element listy "+ i +"</li>";
		else document.getElementById(id).value += "<li>X"+ i +"</li>";
	}
	document.getElementById(id).value += "</ol>";	
}
function unordlist(id){
	var ne = prompt("Ile elementów ?");
	document.getElementById(id).value += "<ul>";
	for(var i = 1 ; i <= ne ; i++){
		if ( document.getElementById('opis').checked ) document.getElementById(id).value += "<li>element listy "+ i +"</li>";
		else document.getElementById(id).value += "<li>X"+ i +"</li>";
	}
	document.getElementById(id).value += "</ul>";	
}
///////////////////////////////////////////
function boldHTML(id){
	$(id).value += "<b>to będzie pogrubione</b>";
}
function italHTML(id){
	$(id).value += "<i>to będzie kursywą</i>";
}
function newlineHTML(id){
	$(id).value += "<br />";	
}
function quotesHTML(id){
	$(id).value += "&quot;to będzie w cudzysłowach&quot;";	
}
function linkHTML(id){
	$(id).value += "<a href=\"tu wpisz URL\"> tu wpisz treść linka </a>";	
}
function ordlistHTML(id){
	var ne = prompt("Ile elementów ?");
	$(id).value += "<ol>";
	for(var i = 1 ; i <= ne ; i++){
		 $(id).value += "<li>element listy "+ i +"</li>";
	}
	$(id).value += "</ol>";	
}
function unordlistHTML(id){
	var ne = prompt("Ile elementów ?");
	$(id).value += "<ul>";
	for(var i = 1 ; i <= ne ; i++){
		$(id).value += "<li>element listy "+ i +"</li>";
	}
	$(id).value += "</ul>";	
}
function wstawobraztrescinfo(id){
	var src = $('trselimg').value ;
	var width = $('trimgwid').value;
	var height = $('trimghei').value;
	
	if($('imgtroblno').checked == true)
		var flo = 'none';
	if($('imgtroblle').checked == true)
		var flo = 'left';
	if($('imgtroblri').checked == true)
		var flo = 'right';

	var ans = "<img src=\""+src+"\" style=\"margin: 2px; width:"+width+"px; height:"+height+"px; float:"+flo+";\" />";	
	
	$(id).value += ans;
}
///////////////////////////////////////////
function trzyhasze(id){
	document.getElementById(id).value += "###";
}
function wstawobraztytul(){
	var src = document.getElementById('tytselimg').value ;
	var width = document.getElementById('tytimgwid').value;
	var height = document.getElementById('tytimghei').value;
	
	if(document.getElementById('imgtytoblno').checked == true)
		var flo = 'none';
	if(document.getElementById('imgtytoblle').checked == true)
		var flo = 'left';
	if(document.getElementById('imgtytoblri').checked == true)
		var flo = 'right';

	var ans = "<img src=\"../"+src+"\" style=\"margin: 5px; width:"+width+"px; height:"+height+"px; float:"+flo+";\" />";	
	
	document.getElementById('ntyt').value += ans;
}
function wstawobraztresc(){
	var src = document.getElementById('trselimg').value ;
	var width = document.getElementById('trimgwid').value;
	var height = document.getElementById('trimghei').value;
	
	if(document.getElementById('imgtroblno').checked == true)
		var flo = 'none';
	if(document.getElementById('imgtroblle').checked == true)
		var flo = 'left';
	if(document.getElementById('imgtroblri').checked == true)
		var flo = 'right';

	var ans = "<img src=\"../"+src+"\" style=\"margin: 5px; width:"+width+"px; height:"+height+"px; float:"+flo+";\" />";	
	
	document.getElementById('ntr').value += ans;
}
function genartview(){
	var ik = 0;
	if( $('ik1').checked == true) ik = 1; else ik=2;
	var xtyt = ($('ntyt').value)
	var xptyt = ($('nptyt').value)
	var xtr = ($('ntr').value)
	var xaut = ($('naut').value)
	while ( $('testfield').down().id != 'stop' ){
    	$("testfield").removeChild( $("testfield").down() );
    }
    	
    	art = document.createElement("div");
		art.className= 'okart';
		art.id = "art";
		
		tyt = document.createElement("div");
		tyt.className= 'okarttytul';
		tyt.id = "tytulid";
		
		ptyt = document.createElement("div");
		ptyt.className= 'okartintro';
		ptyt.id = "ptytulid";
		
		if(ik == 1){ 
			tresc = document.createElement("div");	
			if( xptyt != '') //bylo intro
				tresc.className= 'okarttresczi';
			else tresc.className= 'okarttrescbi';
			tresc.id="trescid";
		}
		if(ik == 2){
			tresclew = document.createElement("div");	
			trescpraw = document.createElement("div");
			trescpraw.className= 'okarttresc2pra';
				
			if( xptyt != '' ) //bylo intro
				tresclew.className= 'okarttresc2lewzi';	
			else tresclew.className= 'okarttresc2lewbi';
						
			tresclew.id="tresclewid";
			trescpraw.id="trescprawid";
		}
				
		autor = document.createElement("div");
		autor.className= 'okartautor';
		autor.id = "autorid";
		
		data = document.createElement("div");
		data.className= 'okartdata';
		data.id = "dataid";
		
		var b = document.getElementById("testfield");		
		b.insertBefore(art, document.getElementById("stop"));
		
		var a = document.getElementById("art");
		a.appendChild(tyt); $("tytulid").innerHTML = xtyt;
		if( xptyt != '' ){ a.appendChild(ptyt); $("ptytulid").innerHTML = xptyt; }
		//if( xptyt != '' )
		//{
			if( ik == 1){
				a.appendChild(tresc); 
				$("trescid").innerHTML = xtr;
			}
			if( ik == 2){
				alert( "xtr" + xtr.length )
				var s = xtr;
				var p = s.search('###') //szukamy dzielnika 
				if( p == -1){ 			//mie ma lini podzialu
					alert("nie ma dzielnika")
					//szukamy spacji srodka 			
					var srodek = s.indexOf(' ', (s.length/2))
					alert("srodek = " + srodek)
					alert(" LEWA " + s.substring(0,srodek));
					alert(" PRAWA " + s.substring(srodek,s.length));
					
					a.appendChild(tresclew);
					$("tresclewid").innerHTML = s.substring(0,srodek);
					a.appendChild(trescpraw);
					$("trescprawid").innerHTML = s.substring(srodek,s.length);
				}
				else {
					
					//alert("dlug=" + s.length + " ind znakpodzialu = " +  p + " lew.dg " + s.substring(0,p).length + " praw.dg " + s.substring(p+3,s.length).length);
					
					a.appendChild(tresclew);
					$("tresclewid").innerHTML = s.substring(0,p);
					a.appendChild(trescpraw);
					$("trescprawid").innerHTML = s.substring(p+3,s.length);
				}
			}
			
		//}
		a.appendChild(autor); $("autorid").innerHTML = xaut;
		a.appendChild(data); $("dataid").innerHTML = "Dodano tu data" 
		
		mint.fx.Round("art","all","large",true);
}
function gennewview(){
	var xtyt = ($('ntyt').value)
	var xptyt = ($('nptyt').value)
	var xtr = ($('ntr').value)
	while ( $('testfield').down().id != 'stop' ){
    	$("testfield").removeChild( $("testfield").down() );
    }	
    	art = document.createElement("div");
		art.className= 'okart';
		art.id = "art";
		
		tyt = document.createElement("div");
		tyt.className= 'oknewstytul';
		tyt.id = "tytulid";
		
		ptyt = document.createElement("div");
		ptyt.className= 'okartintro';
		ptyt.id = "ptytulid";
		
		tresc = document.createElement("div");	
		if( xptyt != '') //bylo intro
			tresc.className= 'okarttresczi';
		else tresc.className= 'okarttrescbi';
			tresc.id="trescid";
				
		data = document.createElement("div");
		data.className= 'okartdata';
		data.id = "dataid";
		
		var b = document.getElementById("testfield");		
		b.insertBefore(art, document.getElementById("stop"));
		
		var a = document.getElementById("art");
		a.appendChild(tyt); $("tytulid").innerHTML = xtyt;
		if( xptyt != '' ){ a.appendChild(ptyt); $("ptytulid").innerHTML = xptyt; }

		a.appendChild(tresc); 
		$("trescid").innerHTML = xtr;
			
		a.appendChild(data); $("dataid").innerHTML = "Dodano tu data" 
		
		mint.fx.Round("art","all","large",true);
}

///////////////////////////////////////////////////////////////
function sndq(ml){
	//zrobic jedno regular expr.
	if( ml.search('@') < 1 || ml.search('@') > (ml.length-2) || ml.value == '' || ml.search('\\s+') != -1 ){
		alert("To jest niepoprawny adres poczty");
		return;
	}
	
	//alert
	var req = mint.Request();
    req.SendForm("form");   
    
    req.OnSuccess = function() {
    	alert(this.responseText);             
	}
	    
}
function SendRequest(akcja, param) {
	alert(akcja + " sss " + param)
	var req = mint.Request();
    req.Set("method",'POST');
 	req.AddParam("akcja", akcja);
    req.AddParam("param", param)
    req.Send("sstr.php");
    
    req.OnSuccess = function() {    	
    	switch (akcja){
    		case 'rejestr': var ans = this.responseText; alert(ans);break;	
    		case 'log':	break;
    		case 'menu':
    			while ( $("CONT").down().id != 'NAVG' )	$("CONT").removeChild( $("CONT").down() );	
    			switch(param){
    				case 'mi1':
    				case 'mi2':
    					var ans = this.responseXML;
    					
    					var tmp = ans.getElementsByTagName("dane");
		    			switch(tmp[0].getAttribute('co')){
							case 'news':	//njusy
								WstawNjusy(ans);
								break;
							case 'arts': //artykuly
								WstawArts(ans);
								break;
    					}
    					break;
    				case 'mi3': //regulamin
    				case 'mi4': //uczestnicy
    				case 'mi5': //jury
    				case 'mi6': //sponsorzy
    					var ans = this.responseText;
    					WstawHTML(ans);
    					break;		
    				}
    			break;
    		case 'navg':			
    			while ( $("CONT").down().id != 'NAVG' ){
    				$("CONT").removeChild( $("CONT").down() );
    			}
    			var ans = this.responseXML;
    			alert(ans);
    			var tmp = ans.getElementsByTagName("dane");
    				 
    			switch(tmp[0].getAttribute('co')){
					case 'news':	//njusy
						WstawNjusy(ans);
						break;
					case 'arts': //artykuly
						WstawArts(ans);
						break;
    			}
				break;	
    	}
    }
}
function WstawHTML(ans){
	art = document.createElement("div");
	art.className= 'artykul_reg';
	art.id = "art_reg";
	
	var b = document.getElementById("CONT");		
		b.insertBefore(art, document.getElementById("NAVG"));
		
	$("art_reg").innerHTML = ans;
	$("NAVG").firstChild.innerHTML = "" ;
	$("ngcn").innerHTML = "" ;
	mint.fx.Round("art_reg","all","large",true);
	
}
function WstawNjusy(ans){
	var Xdoc = ans.getElementsByTagName("dane");
    var Xitems = ans.getElementsByTagName("item");
    var Xtytul = ans.getElementsByTagName("title");
    var Xptytul = ans.getElementsByTagName("intro");
    var Xtresc = ans.getElementsByTagName("cont");
    var Xdata = ans.getElementsByTagName("data");
    
    for(i = 0 ; i < Xdoc[0].getAttribute("ile") ; i++){
		art = document.createElement("div");
		art.className= 'okart';
		art.id = "art"+i;
		
		tyt = document.createElement("div");
		tyt.className= 'oknewstytul';
		tyt.id = "tytulid"+i;
		
		ptyt = document.createElement("div");
		ptyt.className= 'okartintro';
		ptyt.id = "ptytulid"+i;
		
		tresc = document.createElement("div");
		tresc.className= 'okarttresczi';
		tresc.id="trescid"+i;
		
		data = document.createElement("div");
		data.className= 'okartdata';
		data.id = "dataid"+i;
		
		var b = document.getElementById("CONT");		
		b.insertBefore(art, document.getElementById("NAVG"));  //, document.getElementById('czt'));
		
		var a = document.getElementById("art"+i);
		if( Xtytul[i].firstChild ){  a.appendChild(tyt); $("tytulid"+i).innerHTML = Xtytul[i].firstChild.data }
		if( Xptytul[i].firstChild ){ a.appendChild(ptyt); $("ptytulid"+i).innerHTML = Xptytul[i].firstChild.data }
		if( Xtresc[i].firstChild ){  a.appendChild(tresc); $("trescid"+i).innerHTML = Xtresc[i].firstChild.data	}
		if( Xdata[i].firstChild ){   a.appendChild(data); $("dataid"+i).innerHTML = "Dodano " + Xdata[i].firstChild.data }
		mint.fx.Round("art"+i,"all","large",true);
    }
    	
    var navg = "";
	if ( Xdoc[0].getAttribute('mm') == 1 ) navg += "<a href=\"javascript:void(NavgKlik('start'));\">&lt;&lt;</a>  "
	if ( Xdoc[0].getAttribute('m')  == 1) navg += "<a href=\"javascript:void(NavgKlik('prev'));\">&lt;</a>  "
    if ( Xdoc[0].getAttribute('w')  == 1) navg += "<a href=\"javascript:void(NavgKlik('next'));\">&gt;</a>  "
    if ( Xdoc[0].getAttribute('ww') == 1) navg += "<a href=\"javascript:void(NavgKlik('end'));\">&gt;&gt;</a>  "

    if($('NAVG').down() == $('ngcn')) 
    	$('NAVG').insertBefore( document.createElement('div'), $('NAVG').firstChild );
    $('NAVG').firstChild.innerHTML = navg;
     
 	var ngcn = " " + Xdoc[0].getAttribute('ap') + " "+"/"+" "+Xdoc[0].getAttribute('np') ;
    $('ngcn').innerHTML = ngcn;
    
}
function WstawArts(ans){
	var Xdoc = ans.getElementsByTagName("dane");
    var Xitems = ans.getElementsByTagName("item");
    var Xtytul = ans.getElementsByTagName("title");
    var Xptytul = ans.getElementsByTagName("intro");
    var Xtresc = ans.getElementsByTagName("cont");
    var Xautor = ans.getElementsByTagName("autor");
    var Xdata = ans.getElementsByTagName("data");
    
    for(i = 0 ; i < Xdoc[0].getAttribute("ile") ; i++){
    	art = document.createElement("div");
		art.className= 'okart';
		art.id = "art"+i;
		
		tyt = document.createElement("div");
		tyt.className= 'okarttytul';
		tyt.id = "tytulid"+i;
		
		ptyt = document.createElement("div");
		ptyt.className= 'okartintro';
		ptyt.id = "ptytulid"+i;
		
		var ilek =  Xitems[i].getAttribute("type"); 	
		if(ilek == 1){ 
			tresc = document.createElement("div");	
			if( Xptytul[i].firstChild ) //bylo intro
				tresc.className= 'okarttresczi';
			else tresc.className= 'okarttrescbi';
			tresc.id="trescid"+i;
		}
		if(ilek == 2){
			tresclew = document.createElement("div");	
			trescpraw = document.createElement("div");
			trescpraw.className= 'okarttresc2pra';
				
			if( Xptytul[i].firstChild ) //bylo intro
				tresclew.className= 'okarttresc2lewzi';	
			else tresclew.className= 'okarttresc2lewbi';
						
			tresclew.id="tresclewid"+i;
			trescpraw.id="trescprawid"+i;
		}
		
		autor = document.createElement("div");
		autor.className= 'okartautor';
		autor.id = "autorid"+i;
		
		data = document.createElement("div");
		data.className= 'okartdata';
		data.id = "dataid"+i;
		
		var b = document.getElementById("CONT");		
		b.insertBefore(art, document.getElementById("NAVG"));
		
		var a = document.getElementById("art"+i);
		if( Xtytul[i].firstChild ){  a.appendChild(tyt); $("tytulid"+i).innerHTML = Xtytul[i].firstChild.data }
		if( Xptytul[i].firstChild ){ a.appendChild(ptyt); $("ptytulid"+i).innerHTML = Xptytul[i].firstChild.data }
		if( Xtresc[i].firstChild )
		{
			if( ilek == 1){
				a.appendChild(tresc); 
				$("trescid"+i).innerHTML = Xtresc[i].firstChild.data;
			}
			if( ilek == 2){
				alert( "Xtresc[i].firstChild.data" + (Xtresc[i].firstChild.data).length )
				var s = Xtresc[i].firstChild.data;
				var p = s.search('###') //szukamy dzielnika 
				if( p == -1){ 			//mie ma lini podzialu
					alert("nie ma dzielnika")
					//szukamy spacji srodka 			
					var srodek = s.indexOf(' ', (s.length/2))
					alert("srodek = " + srodek)
					alert(" LEWA " + s.substring(0,srodek));
					alert(" PRAWA " + s.substring(srodek,s.length));
					
					a.appendChild(tresclew);
					$("tresclewid"+i).innerHTML = s.substring(0,srodek);
					a.appendChild(trescpraw);
					$("trescprawid"+i).innerHTML = s.substring(srodek,s.length);
				}
				else {
					
					alert("dlug=" + s.length + " ind znakpodzialu = " +  p + " lew.dg " + s.substring(0,p).length + " praw.dg " + s.substring(p+3,s.length).length);
					
					a.appendChild(tresclew);
					$("tresclewid"+i).innerHTML = s.substring(0,p);
					a.appendChild(trescpraw);
					$("trescprawid"+i).innerHTML = s.substring(p+3,s.length);
				}
			}
			
		}
		if( Xautor[i].firstChild ){  a.appendChild(autor); $("autorid"+i).innerHTML = Xautor[i].firstChild.data }
		if( Xdata[i].firstChild ){   a.appendChild(data); $("dataid"+i).innerHTML = "Dodano " + Xdata[i].firstChild.data }
		
		mint.fx.Round("art"+i,"all","large",true);
    }
    
	var navg = "";
	if ( Xdoc[0].getAttribute('mm') == 1 ) navg += "<a href=\"javascript:void(NavgKlik('start'));\">&lt;&lt;</a>  "
	if ( Xdoc[0].getAttribute('m')  == 1) navg += "<a href=\"javascript:void(NavgKlik('prev'));\">&lt;</a>  "
    if ( Xdoc[0].getAttribute('w')  == 1) navg += "<a href=\"javascript:void(NavgKlik('next'));\">&gt;</a>  "
    if ( Xdoc[0].getAttribute('ww') == 1) navg += "<a href=\"javascript:void(NavgKlik('end'));\">&gt;&gt;</a>  "

    if($('NAVG').down() == $('ngcn')) 
    	$('NAVG').insertBefore( document.createElement('div'), $('NAVG').firstChild );
    $('NAVG').firstChild.innerHTML = navg;
     
 	var ngcn = " " + Xdoc[0].getAttribute('ap') + " "+"/"+" "+Xdoc[0].getAttribute('np') ;
    $('ngcn').innerHTML = ngcn;
}

function Rejestruj(f){
	var pole = f;
	var str = pole.value; 
	//zrobic jedno regular expr.
	if( str.search('@') < 1 || str.search('@') > (str.length-2) || str.value == '' || str.search('\\s+') != -1 ){
		alert("To jest niepoprawny adres poczty");
	}
	else{ 
		SendRequest('rejestr', str);		
	}
}

function MeniKlik(id){
	SendRequest('menu',id);	
}

function NavgKlik(param){
	SendRequest('navg',param);
}
/////////////////////////////////////////////////////////////////////////////
/*function ColorInF(id) {
    mint.fx.Color(id, "backgroundColor", null, "ccffff", 20, 500);
}

function ColorOutF(id) {
    mint.fx.Color(id, "backgroundColor", null, "ffffff", 20, 500);
}

function Round() {
    //mint.fx.Round("art1","all","large", false);
	//mint.fx.Round("art2","all","large", false);
	
	
	
	//mint.fx.Round("box2", "top", null, 80);
//    mint.fx.Round("box3", "all", "large");
//    mint.fx.Round("box4", "tl br", "small", true);
}*/
/*
function SendRequest() {
    //var req = mint.Request();
    //req.Set("method",'POST');
    
//  <div id="art1" class="artykul">
//  	<p id="artt2" class="arttyt2"> </p>
//  	<p class="artptyt"></p>
//  	<p class="arttresc">
//  	<p class="autart"></p>
//  	<p class="datart"></p>
//  </div>
		var id = "art_x"+1;
		art = document.createElement("div");
		art.className= 'artykul';
		art.id = id;
		
		tyt = document.createElement("p");
		tyt.className= 'arttyt2';
		tyt.id = "tytulid";
		//tyt.innerHTML = tyt_tresc;
		
		ptyt = document.createElement("p");
		ptyt.className= 'artpt';
		ptyt.id = "ptytulid";
		
		tresc = document.createElement("p");
		tresc.className= 'arttresc2';
		tresc.id="trescid"
		//tresc.innerHTML = art_tresc;
		
		autor = document.createElement("p");
		autor.className= 'autart';
		autor.id = 'autorid'
		//autor.innerHTML = aut;
		
		data = document.createElement("p");
		data.className= 'datart';
		data.id = 'dataid'
		//data.innerHTML = dat;

		var b = document.getElementById("CONT");		
		b.insertBefore(art, document.getElementById("NAVG"));  //, document.getElementById('czt'));
		
		var a = document.getElementById(id);
		a.appendChild(tyt);
		a.appendChild(ptyt);
		a.appendChild(tresc);	
		a.appendChild(autor);
		a.appendChild(data);

		//alert(b.innerHTML);
    
    //req.AddParam("usertext", "rafto");
    //req.Send("start.php", "CONT");
    
    var req = mint.Request();

    req.OnSuccess = function() {
    	//alert(this.responseXML);
    	
    	var doc = this.responseXML.getElementsByTagName("dane");
    	var items = this.responseXML.getElementsByTagName("art");
    	var a1 = doc[0].getAttribute("ile");
    	alert("co dostalem ? " + doc[0].getAttribute("ile") + " " + doc[0].getAttribute("co") + " w typach " + items[0].getAttribute("typ") + ", " + items[1].getAttribute("typ"));
        var tyts = this.responseXML.getElementsByTagName("tyt");
        var ptyts = this.responseXML.getElementsByTagName("ptyt");
        var trs = this.responseXML.getElementsByTagName("tr");
        var auts = this.responseXML.getElementsByTagName("aut");
        var dats = this.responseXML.getElementsByTagName("dat");
        
        for(var i = 0; i < (tyts.length-1); ++i) {
            //$("id").next.innerHTML += items[i].firstChild.data + "<br />";
            //alert( $("tytulid") );
            $("tytulid").innerHTML = tyts[i].firstChild.data;
            $("ptytulid").innerHTML = ptyts[i].firstChild.data;
            $("trescid").innerHTML = trs[i].firstChild.data;
            $("autorid").innerHTML = auts[i].firstChild.data;
            $("dataid").innerHTML = dats[i].firstChild.data;
        }
    }
    
    req.Send("start.php");
    
    mint.fx.Round("art_x1","all","large", false);
 // mint.fx.Round("art2","all","large", false);
	//Round();
}
*/

