function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}

function showLogin() {
var lf = document.getElementById('login_div');
  if (hasClass(lf,'hidden')) {
    removeClass(lf,'hidden');
  }
}
function hideLogin() {
var lf = document.getElementById('login_div');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
}
function showPomoc(dname) {
var lf = document.getElementById(dname);
  if (hasClass(lf,'hidden')) {
    removeClass(lf,'hidden');
  }
}
function hidePomoc(dname) {
var lf = document.getElementById(dname);
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
}
function submitOnEnter(field,e) {
		var keycode;
			if (window.event) keycode = window.event.keyCode;
			else if (e) keycode = e.which;
			else return true;
			if (keycode == 13) {
				document.forms.login_form.submit();
				return false;
			} else return true;
}

function confirmDelete(delUrl) {
  if (confirm("Napewno usun±æ dane?")) {
    document.location = delUrl;
  }
}

function showTemat(tname) {
	hideTemat();
	showPomoc(tname);	
}

function showTemat2(tname) {
	hideTemat2();
	showPomoc(tname);	
}

function hideTemat() {
	hidePomoc("pomoc1_div");
	hidePomoc("pomoc2_div");
	hidePomoc("pomoc3_div");
	hidePomoc("pomoc5_div");
	hidePomoc("pomoc6_div");
	hidePomoc("pomoc7_div");
	hidePomoc("pomoc8_div");
	hidePomoc("pomoc9_div");
	hidePomoc("pomoc10_div");
	hidePomoc("pomoc11_div");
	hidePomoc("pomoc12_div");
	hidePomoc("pomoc13_div");
	hidePomoc("pomoc14_div");
	hidePomoc("pomoc15_div");
	hidePomoc("pomoc16_div");
	hidePomoc("pomoc17_div");
}

function hideTemat2() {
	hidePomoc("pomoc21_div");
	hidePomoc("pomoc22_div");
	hidePomoc("pomoc23_div");
	hidePomoc("pomoc24_div");
	hidePomoc("pomoc25_div");
	hidePomoc("pomoc26_div");
	hidePomoc("pomoc27_div");
	hidePomoc("pomoc28_div");
	hidePomoc("pomoc29_div");
}

function hideSpis() {
	hideTemat();
	hidePomoc("pomoc0_div");
	showPomoc("pomoc20_div");
}

function hideSpis2() {
	hideTemat2();
	hidePomoc("pomoc20_div");
}

function switchSpis() {
	hideTemat2();
	hidePomoc("pomoc20_div");
	showPomoc("pomoc0_div");
}

function AddToFavorites()
{
title = "portalwindykacja.pl - portal wierzyciela";
url = "http://www.portalwindykacja.pl/";

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
return true; }
}

function rssgp(dname) {
var lf = document.getElementById('rssgp_naleznosci');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rssgp_prawo');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rssgp_odszkodowania');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById(dname);
  if (hasClass(lf, 'hidden')) {
        removeClass(lf, 'hidden');
  }
}
function rsrp(dname) {
var lf = document.getElementById('rp_w');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_k');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_s');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_pr');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_e');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_f');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById('rp_pi');
  if (! hasClass(lf, 'hidden')) {
        addClass(lf, 'hidden');
  }
lf = document.getElementById(dname);
  if (hasClass(lf, 'hidden')) {
        removeClass(lf, 'hidden');
  }
}


