function searchIt() {
  var errors = false;
  q = document.search_form.q.value;
  if ( !isEmpty ( q ) || q == "wpisz frazę" || q.length < 3 ) {
  		errors = true;
  		document.search_form.q.focus();
  		alert ( "Proszę wpisać szukaną frazę składającą się przynajmniej z 3 znaków" );
  }
  if ( errors == false ) {
  		document.search_form.action="http://www.interwencja.pl/szukaj";
  		document.search_form.submit();
  }
}
function clrSrch() {
	if ( document.search_form.q.value == "wpisz frazę" ) {
		document.search_form.q.value = "";
	}
}
function searchIt2() {
  var errors = false;
  q = document.search_form2.q.value;
  if ( !isEmpty ( q ) || q.length < 3 ) {
  		errors = true;
  		document.search_form2.q.focus();
  		alert ( "Proszę wpisać szukaną frazę składającą się przynajmniej z 3 znaków" );
  }
  if ( errors == false ) {
  		document.search_form2.action="http://www.interwencja.pl/szukaj";
  		document.search_form2.submit();
  }
}

function pokazCzas() {
	month = new Array ("stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia")
	day = new Array ("Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota")
	var now=new Date()
   var years=now.getFullYear()
   var months=now.getMonth()
   var days=now.getDay()
   var day_n=now.getDate()
   var hrs=now.getHours()
   var min=now.getMinutes()
   var sec=now.getSeconds()
   if (hrs<10) { hrs="0"+hrs }
   if (min<10) { min="0"+min }
   if (sec<10) { sec="0"+sec }
   document.getElementById("zegar").innerHTML=day[days]+", "+day_n+" "+month[months]+" "+years
   // document.getElementById("zegar2").innerHTML=day[days]+", "+day_n+" "+month[months]+" "+years
   // document.getElementById("zegar3").innerHTML=day[days]+", "+day_n+" "+month[months]+" "+years
//   setTimeout("pokazCzas()",6000)
}
function clrLg() {
	if ( document.login_form.lg.value == "login" ) {
		document.login_form.lg.value = "";
	}
}
function clrPw() {
	if ( document.login_form.pw.value == "hasło" ) {
		document.getElementById("pass_field").innerHTML="<input type=\"password\" name=\"pw\" class=\"login_form\" value=\"\" maxlength=\"32\" onfocus=\"this.style.backgroundColor='#DCDCED';\" onblur=\"this.style.backgroundColor='#FFFFFF';\" style=\"margin-bottom: 4px;\">";
		delayPWfocus();
	}
}
function delayPWfocus() {
//	setTimeout("setPWfocus()", 10);
}
function setPWfocus() {
	document.login_form.pw.focus();
}
function clrEmail() {
	if ( document.newsletter_form.email.value == "e-mail" ) {
		document.newsletter_form.email.value = "";
	}
}
function pollValidate() {
    var cnt = -1;
    var btn = document.poll_form.pool_vote;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) {
    	document.poll_form.action = "http://www.interwencja.pl/pool_vote";
    	document.poll_form.submit();
    }
    else {
    	alert ("Przed oddaniem głosu proszę wybrać odpowiedź");
    	return;
    }
}


function closePoll() {
//	setTimeout ( "closePollWindow()", 1500 );
}
function closePollWindow() {
	window.opener.location.reload();
	self.close();
}
function popUp(URL) {
	resx = (screen.width - 400) / 2;
	resy = (screen.height - 300) / 2;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,		menubar=0,resizable=1,width=400,height=300,left = "+resx+",top = "+resy+"');");
}
function popUpFS(URL) {
	resx = screen.width;
	resy = screen.height;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,		menubar=1,resizable=1,width="+resx+",height="+resy+",left = 0,top = 0');");
}
function showPicture(id,c) {
	popUp('http://www.interwencja.pl/pokaz_zdjecie,'+id+','+c);
}
function showGallery(n_id,p_id) {
	popUp('http://www.interwencja.pl/pokaz_galerie,'+n_id+','+p_id);
}
function expandComment(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment,"+id, true);
    xml.send(null);
  }
  changeSubject(id);
  return false;
}
function changeSubject(id) {
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkComment('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkComment(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandComment('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb,"+id, true);
    xml.send(null);
  }
}
function trimComment() {
	if ( document.comments.comment.value.length > 2000 ) {
		document.comments.comment.value=document.comments.comment.value.substring(0,2000);
   	document.comments.comment.scrollTop=document.comments.comment.scrollHeight;
	}
}
function addComment() {
	trimComment();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add";
		document.comments.submit();
	}
}
function expandCommentArt(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment_art,"+id, true);
    xml.send(null);
  }
  changeSubjectArt(id);
  return false;
}
function changeSubjectArt(id) {
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkCommentArt('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_art,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkCommentArt(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandCommentArt('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_art,"+id, true);
    xml.send(null);
  }
}

function addCommentArt() {
	trimComment();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add_art";
		document.comments.submit();
	}
}
function expandCommentRev(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment_rev,"+id, true);
    xml.send(null);
  }
  changeSubjectRev(id);
  return false;
}
function changeSubjectRev(id) {
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkCommentRev('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_rev,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkCommentRev(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandCommentRev('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_rev,"+id, true);
    xml.send(null);
  }
}
function addCommentRev() {
	trimComment();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add_rev";
		document.comments.submit();
	}
}
function expandCommentBank(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment_bank,"+id, true);
    xml.send(null);
  }
  changeSubjectBank(id);
  return false;
}
function changeSubjectBank(id) {
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkCommentBank('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_bank,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkCommentBank(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandCommentBank('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_bank,"+id, true);
    xml.send(null);
  }
}
function addCommentBank() {
	trimComment();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add_bank";
		document.comments.submit();
	}
}
function expandCommentJudgement(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment_judgement,"+id, true);
    xml.send(null);
  }
  changeSubjectJudgement(id);
  return false;
}
function changeSubjectJudgement(id) {
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkCommentJudgement('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_judgement,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkCommentJudgement(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandComment_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandCommentJudgement('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_judgement,"+id, true);
    xml.send(null);
  }
}
function addCommentJudgement() {
	trimComment();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add_judgement";
		document.comments.submit();
	}
}
function showRSS(nr) {
	if (document.layers) {
 		for (i=1; i < 4; i++) {
        if ( nr == i ) {
        		document.layers["rss_"+i].display = 'block';
        		document.layers["rss_title_"+i].style.fontWeight = 'bold';
        }
        else {
        		document.layers["rss_"+i].display = 'none';
        		document.layers["rss_title_"+i].style.fontWeight = 'normal';
        }
      }
   }
   else if (document.all) {
 		for (i=1; i < 4; i++) {
        if ( nr == i ) {
        		document.all["rss_"+i].style.display = 'block';
        		document.all["rss_title_"+i].style.fontWeight = 'bold';
        }
        else {
        		document.all["rss_"+i].style.display = 'none';
        		document.all["rss_title_"+i].style.fontWeight = 'normal';
        }
      }
   }
   else if (document.getElementById) {
 		for (i=1; i < 4; i++) {
        if ( nr == i ) {
        		document.getElementById("rss_"+i).style.display = 'block';
        		document.getElementById("rss_title_"+i).style.fontWeight = 'bold';
        }
        else {
        		document.getElementById("rss_"+i).style.display = 'none';
        		document.getElementById("rss_title_"+i).style.fontWeight = 'normal';
        }
      }
   }
}
function chngRmdSubCat(nr) {
	if (document.layers) {
 		document.layers["reminder_0"].display = 'none';
 		for (i=0; i < 4; i++) {
				document.layers["reminder_"+i].display = 'none';
				document.layers["reminderSubLink_"+i].style.fontWeight = 'normal';

      }
 		document.layers["reminder_"+nr].display = 'block';
  		document.layers["reminderSubLink_"+nr].style.fontWeight = 'bold';
   }
   else if (document.all) {
 		document.all["reminder_0"].style.display = 'none';
 		for (i=0; i < 4; i++) {
				document.all["reminder_"+i].style.display = 'none';
				document.all["reminderSubLink_"+i].style.fontWeight = 'normal';
      }
 		document.all["reminder_"+nr].style.display = 'block';
  		document.all["reminderSubLink_"+nr].style.fontWeight = 'bold';
   }
   else if (document.getElementById) {
 		document.getElementById("reminder_0").style.display = 'none';
 		for (i=0; i < 4; i++) {
				document.getElementById("reminder_"+i).style.display = 'none';
				document.getElementById("reminderSubLink_"+i).style.fontWeight = 'normal';
      }
 		document.getElementById("reminder_"+nr).style.display = 'block';
  		document.getElementById("reminderSubLink_"+nr).style.fontWeight = 'bold';
   }
}
function showLeague(nr) {
	if (document.layers) {
 		if ( nr == 1 || nr == 2 ) {
 			document.layers["league_title_1"].style.fontWeight = 'bold';
      	document.layers["league_title_2"].style.fontWeight = 'normal';
      	document.layers["league_title_3"].style.fontWeight = 'normal';
      	document.layers["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 3 || nr == 4 ) {
 			document.layers["league_title_1"].style.fontWeight = 'normal';
      	document.layers["league_title_2"].style.fontWeight = 'bold';
      	document.layers["league_title_3"].style.fontWeight = 'normal';
      	document.layers["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 5 || nr == 6 ) {
 			document.layers["league_title_1"].style.fontWeight = 'normal';
      	document.layers["league_title_2"].style.fontWeight = 'normal';
      	document.layers["league_title_3"].style.fontWeight = 'bold';
      	document.layers["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 7 ) {
 			document.layers["league_title_1"].style.fontWeight = 'normal';
      	document.layers["league_title_2"].style.fontWeight = 'normal';
      	document.layers["league_title_3"].style.fontWeight = 'normal';
      	document.layers["league_title_4"].style.fontWeight = 'bold';
 		}

 		for (i=1; i < 8; i++) {
        if ( nr == i ) {
        		document.layers["league_"+i].display = 'block';
        }
        else {
        		document.layers["league_"+i].display = 'none';
        }
      }
   }
   else if (document.all) {
   	if ( nr == 1 || nr == 2 ) {
 			document.all["league_title_1"].style.fontWeight = 'bold';
      	document.all["league_title_2"].style.fontWeight = 'normal';
      	document.all["league_title_3"].style.fontWeight = 'normal';
      	document.all["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 3 || nr == 4 ) {
 			document.all["league_title_1"].style.fontWeight = 'normal';
      	document.all["league_title_2"].style.fontWeight = 'bold';
      	document.all["league_title_3"].style.fontWeight = 'normal';
      	document.all["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 5 || nr == 6 ) {
 			document.all["league_title_1"].style.fontWeight = 'normal';
      	document.all["league_title_2"].style.fontWeight = 'normal';
      	document.all["league_title_3"].style.fontWeight = 'bold';
      	document.all["league_title_4"].style.fontWeight = 'normal';
 		}
 		else if ( nr == 7 ) {
 			document.all["league_title_1"].style.fontWeight = 'normal';
      	document.all["league_title_2"].style.fontWeight = 'normal';
      	document.all["league_title_3"].style.fontWeight = 'normal';
      	document.all["league_title_4"].style.fontWeight = 'bold';
 		}

 		for (i=1; i < 8; i++) {
        if ( nr == i ) {
        		document.all["league_"+i].style.display = 'block';
        }
        else {
        		document.all["league_"+i].style.display = 'none';
        }
      }
   }
   else if (document.getElementById) {
   	if ( nr == 1 || nr == 2 ) {
 			document.getElementById("league_title_1").style.fontWeight = 'bold';
      	document.getElementById("league_title_2").style.fontWeight = 'normal';
      	document.getElementById("league_title_3").style.fontWeight = 'normal';
      	document.getElementById("league_title_4").style.fontWeight = 'normal';
 		}
 		else if ( nr == 3 || nr == 4 ) {
 			document.getElementById("league_title_1").style.fontWeight = 'normal';
      	document.getElementById("league_title_2").style.fontWeight = 'bold';
      	document.getElementById("league_title_3").style.fontWeight = 'normal';
      	document.getElementById("league_title_4").style.fontWeight = 'normal';
 		}
 		else if ( nr == 5 || nr == 6 ) {
 			document.getElementById("league_title_1").style.fontWeight = 'normal';
      	document.getElementById("league_title_2").style.fontWeight = 'normal';
      	document.getElementById("league_title_3").style.fontWeight = 'bold';
      	document.getElementById("league_title_4").style.fontWeight = 'normal';
 		}
 		else if ( nr == 7 ) {
 			document.getElementById("league_title_1").style.fontWeight = 'normal';
      	document.getElementById("league_title_2").style.fontWeight = 'normal';
      	document.getElementById("league_title_3").style.fontWeight = 'normal';
      	document.getElementById("league_title_4").style.fontWeight = 'bold';
 		}

 		for (i=1; i < 8; i++) {
        if ( nr == i ) {
        		document.getElementById("league_"+i).style.display = 'block';
        }
        else {
        		document.getElementById("league_"+i).style.display = 'none';
        }
      }
   }
}
function leagueNotVote() {
	alert ( "Aby oddać głos musisz być zalogowany" );
	return;
}
function leagueVote(vote, id) {
	var errors = false;
	var league_form_name = document.getElementById("league_vote_"+id);
	if ( league_form_name.id.selectedIndex == 0 ) {
		errors = true;
		alert ( "Proszę wybrać osobę na którą chcesz oddać głos" );
		return;
	}
	else {
		league_form_name.vote.value = vote;
//		setTimeout ( "leagueVoteSubmit("+id+")", 100 );
	}
}
function leagueVoteSubmit(id) {
	var league_form_name = document.getElementById("league_vote_"+id);
	league_form_name.action = "http://www.interwencja.pl/liga_branzowa_glosuj";
	league_form_name.submit();
}
function leagueAdd(id) {
	var league_form_name = document.getElementById("add_league_"+id);
	if ( !isEmpty ( league_form_name.league_name.value ) || league_form_name.league_name.value == "Twoja propozycja" ) {
		alert ( "Proszę wpisać swoją propozycję." );
		league_form_name.league_name.focus();
		return;
	}
	else {
		league_form_name.action = "http://www.interwencja.pl/liga_branzowa_dodaj";
		league_form_name.submit();
	}
}
function leagueClr(id) {
	var league_form_name = document.getElementById("add_league_"+id);
	if ( league_form_name.league_name.value == "Twoja propozycja" ) {
		league_form_name.league_name.value = "";
	}
}
function showFull(art_id, category) {
	move_x = ((screen.width / 2) - 400);
   move_y = ((screen.height / 2) - 300);
	day = new Date();
   id = day.getTime();
   eval("page" + id + " = window.open('http://www.interwencja.pl/"+category+"_pelny,"+art_id+"', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = "+move_x+",top = "+move_y+"');");
}
function printIt(art_id, category) {
	move_x = ((screen.width / 2) - 400);
   move_y = ((screen.height / 2) - 300);
	day = new Date();
   id = day.getTime();
   eval("page" + id + " = window.open('http://www.interwencja.pl/"+category+"_drukuj,"+art_id+"', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = "+move_x+",top = "+move_y+"');");
}
function sendIt(art_id, art_url, category) {
	move_x = ((screen.width / 2) - 200);
   move_y = ((screen.height / 2) - 150);
	day = new Date();
   id = day.getTime();
   eval("page" + id + " = window.open('http://www.interwencja.pl/"+category+"_wyslij,"+art_id+"&url="+art_url+"', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left = "+move_x+",top = "+move_y+"');");
}
function sendNotify() {
	var errors = false;
	var email = document.news_send.snd_rcp_email.value;
	if ( !isEmpty (email) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"e-mail odbiorcy\"");
		document.news_send.snd_rcp_email.focus();
		return;
	}
	else {
		chars = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;
   	if (!chars.test(email) || email.lastIndexOf("@")!= email.indexOf("@") ) {
  			errors = true;
  			alert("Adres e-mail nie jest poprawny.");
  			document.news_send.snd_rcp_email.focus();
  			return;
  		}
	}
   var snd_name = document.news_send.snd_name.value;
	if ( !isEmpty (snd_name) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"Twój podpis\"");
		document.news_send.snd_name.focus();
		return;
	}
	var snd_code = document.news_send.snd_code.value;
	if ( !isEmpty (snd_code) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"Kod zabezpieczający\"");
		document.news_send.snd_rcp_title.focus();
		return;
	}
	if ( snd_code.length != 5 ) {
		errors = true;
		alert ("Pole: \"Kod zabezpieczający\" powinno zawierać 5 znaków");
		document.news_send.snd_rcp_title.focus();
		return;
	}
	if ( errors == false ) {
		document.news_send.action = "http://www.interwencja.pl/powiadomienie_wyslij";
		document.news_send.submit();
	}
}
function validateField(field) {
  if (field!='login' && field!='email1' && field!='new_email1') return false;
  var xml = null;
  var resp = document.getElementById(field+'_v');
  var fieldValue = document.getElementById(field).value;
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/"+field+","+fieldValue, true);
    xml.send(null);
  }
  return false;
}
function requestPrint() {
//	setTimeout ( "timeoutPrint()", 1000 );
}
function timeoutPrint() {
	self.print();
}
function accountDelete() {
	var errors = false;
	var pass = document.account_delete.pass.value;
	if ( !isEmpty (pass) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"Hasło\"");
		document.account_delete.pass.focus();
		return;
	}
	if ( errors == false ) {
		conf = confirm ( "Czy na pewno chcesz usunąć swoje konto wraz z wszystkimi danymi osobowymi?" );
		if ( conf ) {
			document.account_delete.action = "http://www.interwencja.pl/konto_usun";
			document.account_delete.submit();
		}
	}
}
function accountReminder() {
	var errors = false;
	var email = document.account_reminder.email.value;
	if ( !isEmpty (email) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"e-mail\"");
		document.account_reminder.email.focus();
		return;
	}
	if ( errors == false ) {
		document.account_reminder.action = "http://www.interwencja.pl/konto_przypomnij";
		document.account_reminder.submit();
	}
}
function updatePassword() {
	errors = false;
	var pass1 = document.profile.pass1.value;
	if ( !isEmpty (pass1) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"Nowe hasło\"");
		document.profile.pass1.focus();
		return;
	}
	if ( pass1.length < 6 ) {
		errors = true;
		alert ("Hasło powinno się składać minimum z 6 znaków");
		document.profile.pass1.value = "";
		document.profile.pass2.value = "";
		document.profile.pass1.focus();
		return;
	}
	var pass2 = document.profile.pass2.value;
	if ( !isEmpty (pass2) ) {
		errors = true;
		alert ("Nie wypełniono pola: \"Powtórz nowe hasło\"");
		document.profile.pass2.focus();
		return;
	}
	if ( pass2.length < 6 ) {
		errors = true;
		alert ("Hasło powinno się składać minimum z 6 znaków");
		document.profile.pass1.value = "";
		document.profile.pass2.value = "";
		document.profile.pass1.focus();
		return;
	}
	if ( pass1 != pass2 ) {
		errors = true;
		alert ("Hasła różnią się od siebie. Proszę je poprawić.");
		document.profile.pass1.value = "";
		document.profile.pass2.value = "";
		document.profile.pass1.focus();
		return;
	}
	if ( errors == false ) {
		document.profile.action = "http://www.interwencja.pl/konto_zmiana_hasla_ok";
		document.profile.submit();
	}
}
function enlargeCover ( cid, id ) {
	popUp('http://www.interwencja.pl/pokaz_okladke,'+cid+','+id);
}
function voteVideo(id, vote) {
	var resp = document.getElementById('vid_v_'+vote+'_'+id);
	if (window.XMLHttpRequest) xml = new XMLHttpRequest();
	else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
	if (xml) {
 		xml.onreadystatechange = function() {
    		if (xml.readyState==4) {
        		if (isNumeric(xml.responseText)) {
        			resp.innerHTML = xml.responseText;
        			alert ("Dziękujemy za głos")
        		}
        		else alert ("Już oddano głos")
    		}
  		}
  		xml.open("GET", "http://www.interwencja.pl/video_vote,"+id+","+vote, true);
  		xml.send(null);
	}
}
function expandCommentVid(id) {
  var xml = null;
  var resp = document.getElementById('comment_'+id);
  resp.innerHTML = "<i>wczytuję...</i>";
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = xml.responseText;
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcomment_vid,"+id, true);
    xml.send(null);
  }
  changeSubjectVid(id);
  return false;
}
function changeSubjectVid(id) {
  var xml = null;
  var resp = document.getElementById('expandCommentVid_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="shrinkCommentVid('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_vid,"+id, true);
    xml.send(null);
  }
  return false;
}
function shrinkCommentVid(id) {
  var resp = document.getElementById('comment_'+id);
  var shrink = resp.innerHTML.substring(0,150)+" <i>(...)</i>";
  resp.innerHTML = shrink;
  var xml = null;
  var resp = document.getElementById('expandCommentVid_'+id);
  if (window.XMLHttpRequest) xml = new XMLHttpRequest();
  else if (window.ActiveXObject) xml = new ActiveXObject("Microsoft.XMLHTTP");
  if (xml) {
    xml.onreadystatechange = function() {
      if (xml.readyState==4) {
          resp.innerHTML = '<p onclick="expandCommentVid('+id+');" class="comments"><b>'+xml.responseText+'</b></p>';
      }
    }
    xml.open("GET", "http://www.interwencja.pl/expandcommentsb_vid,"+id, true);
    xml.send(null);
  }
}
function trimCommentVid() {
	if ( document.comments.comment.value.length > 2000 ) {
		document.comments.comment.value=document.comments.comment.value.substring(0,2000);
   	document.comments.comment.scrollTop=document.comments.comment.scrollHeight;
	}
}
function addCommentVid() {
	trimCommentVid();
	errors = false;
	var subject = document.comments.comment_subject.value;
	if ( !isEmpty (subject) ) {
		errors = true;
		alert ("Proszę wpisać temat");
		document.comments.comment_subject.focus();
		return;
	}
	var comment = document.comments.comment.value;
	if ( !isEmpty (comment) ) {
		errors = true;
		alert ("Proszę wpisać komentarz");
		document.comments.comment.focus();
		return;
	}
	if ( document.comments.comment_author ) {
		var author = document.comments.comment_author.value;
	   if ( !isEmpty (author) ) {
			errors = true;
			alert ("Proszę się podpisać");
			document.comments.comment_author.focus();
			return;
		}
	}
	if ( document.comments.code ) {
		var code = document.comments.code.value;
	   if ( !isEmpty (code) || code.length != 5 ) {
			errors = true;
			alert ("Proszę wpisać kod z obrazka");
			document.comments.code.focus();
			return;
		}
	}
	if ( errors == false ) {
		document.comments.action = "http://www.interwencja.pl/comment_add_vid";
		document.comments.submit();
	}
}
function reloadCode() {
	var image_o = new Image();
   var date_o  = new Date();
   var m_time  = date_o.getTime();
   image_o.src="http://www.interwencja.pl/images/kod.php?"+m_time;
   document.getElementById('img_code').src = image_o.src;
}
function switchPAC(id) {
	var PACarray = new Array ('1', '2', '3', '4', '5', '6');
	for (i=0; i < PACarray.length; i++) {
		if ( id == PACarray[i] ) {
			document.getElementById('ludzie_'+PACarray[i]).style.display='block';
		}
		else {
			document.getElementById('ludzie_'+PACarray[i]).style.display='none';
		}
	}
}
function switchCAC(id) {
	var CACarray = new Array ('1', '2', '3', '4', '5', '6');
	for (i=0; i < CACarray.length; i++) {
		if ( id == CACarray[i] ) {
			document.getElementById('firmy_'+CACarray[i]).style.display='block';
		}
		else {
			document.getElementById('firmy_'+CACarray[i]).style.display='none';
		}
	}
}
var http_request = false;
function makePOSTRequest(url, parameters, resultid) {
	  var resp = document.getElementById(resultid);
	  resp.innerHTML = '<p><img src="http://www.interwencja.pl/images/hourglass.gif" alt=""><br>Proszę czekać...</p>';
	  http_request = false;
      if (window.XMLHttpRequest) {
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) {
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Nie mogę utworzyć instancji XMLHTTP');
         return false;
      }
      http_request.onreadystatechange = function() {
	  	if (http_request.readyState == 4) {
        	if (http_request.status == 200) {
				result = http_request.responseText;
            	document.getElementById(resultid).innerHTML = result;            
         	}
			else {
            	alert('Wystąpił problem z przetworzeniem żądania.');
         	}
      	}
	  }
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
function startCallbackPeople() {
	document.getElementById('people_photo').innerHTML = '<p><img src="images/hourglass.gif" alt=""><br>Proszę czekać...</p>';
	return true;
}

function completeCallbackPeople(response) {
	document.getElementById('people_photo').innerHTML = response;
	return true;
}
function deletePeoplePhoto() {
	makePOSTRequest("people_photo_delete.php", "", "people_photo");
}
function startCallbackCompany() {
	document.getElementById('company_logo').innerHTML = '<p><img src="images/hourglass.gif" alt=""><br>Proszę czekać...</p>';
	return true;
}

function completeCallbackCompany(response) {
	document.getElementById('company_logo').innerHTML = response;
	return true;
}
function deleteCompanyLogo() {
	makePOSTRequest("company_logo_delete.php", "", "company_logo");
}
