
function edytor(polaid)
{
	tinyMCE.init({
		// General options
		mode : "textareas",
		elements : polaid,
		theme : "advanced",
		plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		// Example content CSS (should be your site CSS)
		content_css : "css/example.css",
		//Drop lists for link/image/media/template dialogs
		template_external_list_url : "js/template_list.js",
		external_link_list_url : "js/link_list.js",
		external_image_list_url : "js/image_list.js",
		media_external_list_url : "js/media_list.js",
		//Replace values for the template plugin
		template_replace_values : {
		username : "Some User",
		staffid : "991234"
		}
		});
}
function edytorbrak(polaid)
{
    tinyMCE.init({
        mode : "exact",
        elements : polaid,
        theme : "advanced",
        theme_advanced_buttons1 : "bold,italic,underline,separator,outdent,indent,separator,link",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        //			plugins : "table,advhr,advimage,advlink,flash,paste,fullscreen,noneditable,contextmenu,splitpaging",
        //			theme_advanced_buttons1_add_before : "newdocument,separator",
        //			theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        //			theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
        //			theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,",
        //			theme_advanced_buttons3_add_before : "tablecontrols,separator,splitpaging",
        //			theme_advanced_buttons3_add : "flash,advhr,separator,fullscreen",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        theme_advanced_disable : "separator,outdent,indent,link",

        extended_valid_elements : "hr[class|width|size|noshade]",
        file_browser_callback : "ajaxfilemanager",
        paste_use_dialog : false,
        theme_advanced_resizing : false,
        theme_advanced_resize_horizontal : false,
        apply_source_formatting : true,
        force_br_newlines : true,
        force_p_newlines : false,
        relative_urls : false,
        language : 'pl'
    });
    
	/*
    tinyMCE.init({
        theme : "advanced",
        mode : "none",
        elements : polaid,
        plugins : "bbcode",
        theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "bottom",
        theme_advanced_toolbar_align : "center",
        theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
        content_css : "css/bbcode.css",
        entity_encoding : "raw",
        add_unload_trigger : false,
        remove_linebreaks : false,
        inline_styles : false,
        convert_fonts_to_spans : false
	});
	*/

}

function dodaj_notke(){

	var temat=document.getElementById('inputNotatkanowa').value;
	var tresc=document.getElementById('textareaNotatkanowa').value;
	var id=document.getElementById('inputNotatkaid').value;
	xajax_dodajNotke(temat,tresc,id);
	if(id!='')
		document.getElementById('nota_zmieniona').style.display='';
	else
		document.getElementById('nota_dodana').style.display='';
	
	window.setInterval("history.go(0);", 1000);

		
}


function wyczysc_notki(){
	document.getElementById('nota_dodana').style.display='none';
	document.getElementById('usun_note').style.display='none';
	document.getElementById('nota_zmieniona').style.display='none';
	document.getElementById('inputNotatkanowa').value='';
	document.getElementById('textareaNotatkanowa').value='';
	document.getElementById('inputNotatkaid').value='';
}
function wypelnijnote(id,temat,tresc){
	document.getElementById('usun_note').style.display='';
	document.getElementById('nota_dodana').style.display='none';
	document.getElementById('nota_zmieniona').style.display='none';
	document.getElementById('inputNotatkanowa').value=temat;
	document.getElementById('textareaNotatkanowa').value=tresc;
	document.getElementById('inputNotatkaid').value=id;
	
}
function usun_note(){
	xajax_usunNote(document.getElementById('inputNotatkaid').value);
}
function usun_pracownika(id){
	if(confirm("Czy na pewno usunąć pracownika ?"))
		xajax_usunPracownika(id);
}


function var_dump(obj) { 
	   if(typeof obj == "object") {
	      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
	   } else {
	      return "Type: "+typeof(obj)+"\nValue: "+obj;
	   }
	}//end function var_dump





//Podświetlanie tabeli
var kolor;
function podsw(elem,kolo){
	kolor=kolo;
	
	var oldBgColor = kolo;
		if (oldBgColor == elem.style.backgroundColor) {
			oldBgColor = elem.style.backgroundColor;
			elem.style.backgroundColor = "#007DBE";	//kolor najechango tr
			elem.style.color="#FFFFFF";
					 
			 
		}
}

//od�wietlanie
function odsw(elem) {
	elem.style.backgroundColor = kolor;
	elem.style.color="#000000";
}

//czyszczenie formularz
function wyczyscform( id ) {
	
	for(i=0;i< document.getElementById(id).length;i++) {
	var pole=document.getElementById(id).elements[i];
	if(pole.type!="hidden" && pole.type!='select-one' && pole.type!='submit' && pole.type!='button'  && pole.type!='reset' && pole.type!='checkbox'  && pole.type!='reset') {
		pole.value='';
	}
  }
  init();
}

function dodajgrupeadm(){
	wartosc=prompt('Nazwa grupy');
	if(wartosc)
		xajax_dodajGrupe(wartosc);
}
function usungrupeadm(idg,nazwa) {
	if(confirm("Czy na pewno usunąć grupę "+nazwa+" ?"))
		xajax_usunGrupeAdm(idg);

}
function edytujgrupeadm(idg,nazwa){
var result = prompt("Zmień nazwę:", nazwa); 
if(result)
	xajax_edytujGrupe(idg,result);

}

function selectChild(nameChild)
{
	for(i=0;i<document.forms[0].length;i++) {
		element = document.forms[0].elements[i];
		reg = new RegExp('^'+nameChild.name);

		if(element.name.match(reg))
			if(nameChild.checked == true && nameChild.name != element.name)
				element.checked = true;
			else if(nameChild.checked == false && nameChild.name != element.name)
				element.checked = false;
	}
}

function pokazOpcjeNewsa(id){
	
	document.getElementById("news_"+ id).style.display="";
}

function pokazOpcjeNewsletera(id){
	
	document.getElementById("newsleter_"+ id).style.display="";
}
function ukryjOpcjeNewsletera(id){
	
	document.getElementById("newsleter_"+ id).style.display="none";
}
function ukryjOpcjeNewsa(id){
	
	document.getElementById("news_"+ id).style.display="none";
}
function usunNewsa(id){
	xajax_usunNewsa(id);
}
function zapiszFormularz(id){
	
//	var tekst='a';
	var tekst=document.getElementById("hidden_tresc").value;
	alert(tekst+'kurczaki');
	xajax_zapiszFormularz(id,tekst);
}

function dodaj_kolejnego_autora(){
	
	  var ni = document.getElementById('myDiv');
	  var numi = document.getElementById('theValue');
	  var num = (document.getElementById('theValue').value -1)+ 2;
	  var obiekt=document.getElementById('ilosc_autorow');
	 
	  obiekt.value=parseFloat(parseFloat(obiekt.value)+1);
	  numi.value = num;
	  var newdiv = document.createElement('p');
	  var divIdName = 'my'+num+'Div';
	  newdiv.setAttribute('id',divIdName);
	  tresc_podpowiedzi="'"+'Usuwanie autora'+"'";
	  newdiv.innerHTML = '<label> <input name="autor_'+num+'" id="autor_'+num+'"  type="text" class="{$bl_autor}" style="width:260px;"/>  <img  onmouseover="ddrivetip('+tresc_podpowiedzi+',150);return false" id="img_usun_autora_'+num+'"  onmouseout="hideddrivetip();" src="/images/no.gif" onclick="usun_autora('+num+');"/> </label>';
	 //newdiv.innerHTML = '<label> <input name="autor" id="autor_'+num+'"  type="text" class="{$bl_autor}" style="width:260px;"/>  <img onmouseout="hideddrivetip();" src="/images/no.gif" onmouseover="usun_autora();"/> </label>';
	 
	  ni.appendChild(newdiv);	
	  xajax_dodajKolejnegoAutora('autor_'+num);
	}
function dodaj_obraz(nazwa,plik,akcja){
	
	var ed = tinyMCE.get(nazwa); 
	tresc = ed.getContent(); //pobranie treści z edytora
	wartosc=prompt('Tytuł obrazu');
	//alert('jest: '+wartosc);
	if(!wartosc)
		wartosc='';
	if(akcja=='edytuj')
		ed.setContent(tresc+"<img src='/obrazy/"+plik+"' alt='"+wartosc+"'/>"); 
	else{
	//	kod="<img src='../obrazy/";
		//alert(kod);
		ed.setContent(tresc+"<img src='/obrazy/"+plik+"' alt="+wartosc+"/>"); 
		//ed.setContent(tresc+kod+plik+"' alt='brak'/>"); 
	}
	
}

function addslashes(str) {
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\0/g,'\\0');
return str;
}

function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\0/g,'\0');
str=str.replace(/\\\\/g,'\\');
return str;
}

function dodaj_do_galerii(plik,roz){
	wartosc=prompt('Tytuł obrazu');
	if(!wartosc)
		wartosc='';
	xajax_dodajDoGalerii(plik,roz,wartosc);
}
function dopisz_obraz(nazwa){
	document.getElementById('input-cover').value='/obrazy/'+nazwa;
}
function wyloguj(){
	
}
function usunWiadomosc(id){
	if(confirm("Czy na pewno usunąć newsa ?")){
		xajax_usunWiadomosc(id);
		document.location='/admin/news';
	}
}
function deleteOpinie(id){
	if(confirm("Czy na pewno usunąć opinię ?")){
		xajax_deleteOpinie(id);
		document.location='/admin/opinie';
	}
}

function dodaj_obraz_do_recenzji(nazwa,plik,akcja){
	//alert(plik);
//	var ed = tinyMCE.get(nazwa); 
//	tresc = ed.getContent(); //pobranie treści z edytora
//	if(akcja=='edytuj')
//		ed.setContent(tresc+"<img src='/obrazy/"+plik+"' alt='brak'/>"); 
//	else{
//	//	kod="<img src='../obrazy/";
//		//alert(kod);
//		ed.setContent(tresc+"<img src='/obrazy/"+plik+"' alt='brak'/>"); 
//		//ed.setContent(tresc+kod+plik+"' alt='brak'/>"); 
//	}
	//pliczek='/obrazy/'+plik;
	
//	document.getElementById('plik_nazwa').style.display='';
//	xajax_dopiszPlikTemp(plik);
}

function sprawdz(){
	czyPusto=document.getElementById('okladka').value;
	
	if(czyPusto!=null){
		document.getElementById("fileTreeDemo_1").style.display = "none";

	}
	else
		document.getElementById("fileTreeDemo_1").style.display = "";
		
	
}
/////////////////////////////panele

function showpanel( pole ) {

	if($( pole ).style.display=='none') {
		new Effect.BlindDown($( pole ))	;
		window.setTimeout("savelists()",1100);
	}
	else {
		hidepanel( pole );
		window.setTimeout("savelists()",1100);
	}
}

function hidepanel( pole ) {
	new Effect.BlindUp($(  pole  ));
}

function closepanel( pole ){
	new Effect.Shrink( pole );
	window.setTimeout("$('" + pole +  "').parentNode.removeChild($('"  + pole +  "')) ",1100);
	window.setTimeout("savelists()",1100);
}

function apearpanel( pole ,lista , lista2 ) {
   Sortable.create("lewemenu",
     {dropOnEmpty:true,handle:'handle',containment:["lewemenu","prawemenu"],constraint:false,hoverclass: 'block-hover',onUpdate: function() {savelists()} });
   Sortable.create("prawemenu",
     {dropOnEmpty:true,handle:'handle',containment:["lewemenu","prawemenu"],constraint:false,hoverclass: 'block-hover',onUpdate: function() {savelists()}});
	$( pole ).style.display='none;'
	new Effect.Appear( pole, {duration:.6}) ;
}

function onecol() {
	opcje=getCookie('opcje');
	opcje=opcje.split('_');
	$('panele').style.width="210px";
	$('content').style.left="215px";
	if(opcje[1]=="right" ){
		$('panele').style.right="230px";
		$('content').style.left="0px";
	}
        listaob=$('prawemenu').getElementsByClassName("li_list");
        listadoc=$('lewemenu');
        dlugosc=listaob.length;
        for(i=0;i<dlugosc;i++) {
                listadoc.appendChild(listaob[0]);
        }
	savelists();
	opcje[0]='1';
	opcjestr=opcje[0]+'_'+opcje[1];
	setCookie('opcje',opcjestr,4,'/');
}

function twocol() {
	opcje=getCookie('opcje');
	opcje=opcje.split('_');
	$('panele').style.width="410px";
	if(opcje[1]=="right" ) {
		$('content').style.left="0px";
		$('panele').style.right="30px";
	}
	else
		$('content').style.left="400px";
    listaob=$('lewemenu').getElementsByClassName("li_list");
    listadoc=$('prawemenu').getElementsByClassName("li_list");
    doc=$('prawemenu');
    dlugoscob=listaob.length;;
    dlugoscdoc=listadoc.length;
    nowa=dlugoscob-dlugoscdoc;
    nowa=parseInt(nowa/2);
    if(nowa>0)
     {
            for(var i=0;i<nowa;i++) {
            		listaob=$('lewemenu').lastChild;
                    doc.appendChild(listaob);
            }
    }
    else if(nowa<0)
     {
             nowa*=-1;
             doc=$('lewemenu');
            for(var i=0;i<nowa;i++) {
                    listaob=$('prawemenu').lastChild;
                   doc.appendChild(listaob);
            }
    }
    savelists();
	opcje[0]='2';
	opcjestr=opcje[0]+'_'+opcje[1];
	setCookie('opcje',opcjestr,4,'/');
}

function changemenu() {
	
	opcje=getCookie('opcje');
	opcje=opcje.split('_');
	if(opcje[1]=='right' ) {
		$('panele').style.left="30px";
//		$('panele').style.left="0px";
		if(opcje[0]!=2 )
			$('content').style.left="215px";
		else
			$('content').style.left="400px";
		opcje[1]='left';
	}
	else{
		$('panele').style.left="820px";
		$('content').style.left="0px";
		opcje[1]='right';
		}
	opcjestr=opcje[0]+'_'+opcje[1];
	setCookie('opcje',opcjestr,4,'/');
}

function addpanel( id ) {
    listalew=$('lewemenu').getElementsByClassName("li_list");
    listapr=$('prawemenu').getElementsByClassName("li_list");
    dlugoslew=listalew.length;
    dlugoscpr=listapr.length;
   
	if(!$( id ))  {
		
		if(dlugoslew<=dlugoscpr)
			xajax_menu( id ,'lewemenu');
		else
			xajax_menu( id ,'prawemenu');
	}
}

function savelists() {
	
var listy=["lewemenu","prawemenu"];
  for(var a=0;a < listy.length;a++) {
  	var orderList = '';
  	
  	if($( listy[a])) {
	   orderedNodes = eval($( listy[a] ).getElementsByClassName("li_list"));
	  
	  for (var i=0;i < orderedNodes.length;i++) {
	  	 idp=orderedNodes[i].getAttribute('id');
//	  	 idp=idp + 'h';
		
		idp=idp.split('_');
		idp=idp[1]; 
		tekst=$( idp ).style.display;
		
	  	if(i==orderedNodes.length-1)
	    	orderList += orderedNodes[i].getAttribute('id')+'_'+tekst;
	    else
	    	orderList += orderedNodes[i].getAttribute('id')+'_'+tekst + ', ';
	    }
	 
	  setCookie('lista'+a,orderList,4,'/');
  	}
  	}
  }
//--------------------------------------------------notatki
var xx=150;
var yy=120;
function addDrag( id ) {
//	$( 'inputNotatka'+id).focus();
 	new Draggable(id, {handle:'header'});
  	$( id ).style.left=xx+'px';
 	$( id ).style.top=yy+'px';
 	xx+=20;
 	yy+=20;
	slider(id,'przegladaj');

}

function scrollVertical(value, element, slider) {
		element.scrollTop = Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight));
	}

var ilosc=100;
function shownote( id) {
	if(id!='new') {
		if(!$( 'note_'+id ))
			xajax_shownote( id );
	}
	else {
		ilosc++;
		xajax_shownote( 'nowa'+ ilosc,'new');
	}

}

function addnote( id ) {
	var node = $( 'p'+id ).className='n';
	new Draggable(id, {handle:'header'});
	slider(id,'przegladaj');

}

function editnote( id ) {
	$('przegladaj'+ id ).style.display='none';
	$('botp'+ id ).style.display='none';
	$('edytuj'+ id ).style.display='';
	$('bote'+ id ).style.display='';
	$('inputNotatka'+ id ).focus();
	slider(id,'edytuj');

}

function slider( id, idp ) {
	var slider = new Control.Slider('handle'+id, 'track'+id, {
	axis: 'vertical',
	onSlide: function(v) { scrollVertical(v, $(idp+id), slider);  },
	onChange: function(v) { scrollVertical(v, $(idp+id), slider); }
	});

	if ($(idp+id).scrollHeight <= $(idp+id).offsetHeight) {
			slider.setDisabled();
			$('track'+id).hide();
		}
}

function closenote( pole ){

	new Effect.Squish( pole );
 	xx-=20;
 	yy-=20;
	window.setTimeout("$('" + pole +  "').parentNode.removeChild($('"  + pole +  "')) ",1100);
}

function deletenote( pole ){
	closenote (pole);
	xajax_deletenote(pole);

}

//////////----------------------cookies
function setCookie( name, value, expires, path, domain, secure )
{

var today = new Date();
today.setTime( today.getTime() );

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    }
  }
return ""
}

function zmien_post(id,temat){ 
	document.getElementById('rodzic').value=id;
	if(temat.substring(0,3)='Re:'){
		document.getElementById('temat').value=temat;
	}else{
		document.getElementById('temat').value="Re: "+temat;
	}
}
function graf(wyniki){
	var d=[];

	for(i=0;i< wyniki.length;i++) {
		 d.push(new Array(wyniki[i]['data'],wyniki[i]['wynik']));
	}
    $.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });

    $("#whole").click(function () {
        $.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });
    });
 
    $("#nineties").click(function () {
        $.plot($("#placeholder"), [d], {
            xaxis: {
                mode: "time",
                min: (new Date("1990/01/01")).getTime(),
                max: (new Date("2000/01/01")).getTime()
            }
        });
    });

    $("#ninetynine").click(function () {
        $.plot($("#placeholder"), [d], {
            xaxis: {
                mode: "time",
                minTickSize: [1, "month"],
                min: (new Date("1999/01/01")).getTime(),
                max: (new Date("2000/01/01")).getTime()
            }
        });
    });

}
function adresStrony(id){
	document.location='/index/index/strona/'+id;
}
function usunokladke(okladka){
	document.getElementById('z_dysku').style.display='';
	document.getElementById('lista_ob').style.display='';
	if(confirm('Czy usunąć okładkę także z zasobow?')) 
		xajax_usunOkladke(okladka);
}
function zakladkitv(){
	jQuery("#tabs").tabs();

}
function usun_baner_sklepu(id){ 
	document.getElementById('nazwapliku').style.display='';
	xajax_usunBanerSklepu(id);
}
function dopiszDoInfo(typ,id,tekst){
	pozycja=document.getElementById('l_news_arch_'+id).value;
	var elOptNew = document.createElement('option');
	  elOptNew.text = tekst;
	  elOptNew.value = id;
	  elOptNew.selected='selected';
	 
	 
	  sel=document.getElementById(typ+'_'+pozycja);
	   
	  var elOptOld = sel.options[sel.selectedIndex];
	 try {
	    sel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
	  }
	  catch(ex) {
	    sel.add(elOptNew); // IE only
	  }
	
}
function dopiszDoVideo(typ,id,tekst){
	
	pozycja=document.getElementById('l_news_arch_'+id).value;
	var elOptNew = document.createElement('option');
	  elOptNew.text = tekst;
	  elOptNew.value = id;
	  elOptNew.selected='selected';
	  sel=document.getElementById(typ);
	  var elOptOld = sel.options[sel.selectedIndex];
	 try {
	    sel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
	  }
	  catch(ex) {
	    sel.add(elOptNew); // IE only
	  }	
}
function spr_pole(nazwa){
	pole=document.getElementById(nazwa);
	if(pole.value==''){
		pole.style.borderColor='#CC4400';
		pole.style.borderStyle='solid';		
	}
	else
		pole.style.borderColor='black';	
		
}
function spr_form(f){
	hack=false;
	if (f.news_title.value==""){
		f.news_title.style.borderColor='#CC4400';
		f.news_title.style.borderStyle='solid';
		hack=true;
	}
	if (f.news_content.value==""){
		f.news_content.style.borderColor='#CC4400';
		f.news_content.style.borderStyle='solid';		
		hack=true;
	}
	if (f.news_source.value==""){
		f.news_source.style.borderColor='#CC4400';
		f.news_source.style.borderStyle='solid';
		hack=true;
	}
	if(hack){
		document.getElementById('form_news_info').style.display='';
	}
	else
		f.submit();
}
function szukajobr(){
	tresc=document.getElementById('szukajo').value;
	xajax_szukajobrazu(tresc);
}
function zmienkatalog(id,nazwa){
	wartosc=prompt('Nowa nazwa',nazwa);
	if(wartosc){
		xajax_zmienKatal(id,wartosc);
		document.location='/admin/files/pokaz';
	}
}
function waliduj(zmienna){
		var tekst=zmienna.value;
		var dlugosc=tekst.length;
		var sprawdz=tekst.substring(dlugosc-1);
		var reszta=tekst.substring(0,dlugosc-1);
		
		//WzorNazwiska = /^[0-9a-zA-Z'"]{0,}$/;
		WzorNazwiska = /^[0-9a-zA-Z'"ąćęłńóśźżĄĆĘŁŃÓŚŹŻ\s\,]{0,}$/;
		//WzorNazwiska = /'#^[a-z]*$#is'/;
		if (!WzorNazwiska.test(sprawdz)) {
			zmienna.value=reszta;
			document.getElementById('tagblad').style.display="";
			document.getElementById('tagblad').innerHTML="Niedozwolony znak: "+sprawdz;
		}
		else{
			document.getElementById('tagblad').style.display='none';
		}
}
function tvclass(pole){
   
	if(pole=='tpop')
		document.getElementById(pole).className='active';
	else
		document.getElementById('tpop').className='ui-state-default ui-corner-top';
	if(pole=='tfron')
		document.getElementById(pole).className='active';
	else
		document.getElementById('tfron').className='ui-state-default ui-corner-top';
	if(pole=='tdoc')
		document.getElementById(pole).className='active';
	else
		document.getElementById('tdoc').className='ui-state-default ui-corner-top';
	
	
}


