ï»¿function onLoadService() {
	//alert("ADAD");
	preloadImages('img/t_menuOfirmie_ov.jpg','img/t_menuNaszapublikacje_ov.jpg','img/t_menuSiecsprzedazy_ov.jpg',
				'img/t_menuDlaautorow_ov.jpg','img/t_menuPraca_ov.jpg','img/t_menuKontakt_ov.jpg',
				'img/b_wychowanie_przedszkolne_ov.jpg','img/b_szkola_podstawowa_klasy_1_3_ov.jpg','img/b_szkola_podstawowa_klasy_4_6_ov.jpg',
				'img/b_gimnazjum_ov.jpg','img/b_liceum_ov.jpg'
				);
}

function preloadImages() {
	var d=document;
	if (d.images){
		if (!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=preloadImages.arguments;
		for (i=0; i<a.length; i++){
			//alert(a[i]);
			if (a[i].indexOf("#")!=0){
				d.MM_p[j]=new Image;
				d.MM_p[j++].src=a[i];
			}
		}
	}
}

//otwiera nowe okno popup
var newWindow=null;
function popup(file, h, w) {
	if (newWindow!=null) {
		newWindow.close();
	}
	//polozenie okna
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2-50;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	//parametry
	var param = 'height=' + h + ',';
		param += 'width=' + w + ',';
		param += 'top=' + wint + ',';
		param += 'left=' + winl + ',';
		param += 'toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=no';
	//wywolanie nowego okna	
	newWindow = window.open(file,'Reklama',param);
	newWindow.window.focus();
}

//obsluga reklamy na glownej stronie
var heightAdv = 0;
var shown = false;
function adv(cycle){
//cycle = 5;
	if (!shown){
		var closeAdv = "<span style='float:right; margin-right:5px'><a href='' onClick='hideAdv();'>zamknij</a></span><br />";
		var link = "";
		var name = "";		
		var title = "";
		switch (cycle){
			case 0:
				name = "klucze";
				link = "nowe,gimnazjum.html#klucze";
				title = "Klucze do kultury";
			break;		
			case 1:
				name = "wtcs"
				link = "nowe,gimnazjum.html#wtcs";
				title = "W tym caÅ‚a sztuka";
			break;
			case 2:
				name = "przygoda"
				link = "nowe,gimnazjum.html#przygoda";
				title = "Przygoda z pisaniem / Przygoda z czytaniem";
			break;
			case 3:
				name = "ms"
				link = "nowe,gimnazjum.html#ms";
				title = "Muzyczny Å›wiat";
			break;
			case 4:
				name = "swzr"
				link = "nowe,gimnazjum.html#swzr";
				title = "Sztuka w zasiÄ™gu rÄ™ki";
			break;
			case 5:
				name = "znrz"
				link = "nowe,gimnazjum.html#znrz";
				title = "Z natury rzeczy";
			break;
			case 6:
				name = "ntw"
				link = "nowe,gimnazjum.html#ntw";
				title = "Nie tylko wynik";
			break;			
		}
		var el = document.getElementById('advert');		
		//el.innerHTML = closeAdv + "<a href=" + link + " title='" + title + "'><img id='advPicture' src='UserFiles/Image/reklamy/" + name + ".jpg' /></a>";
		//el.innerHTML = '<a href=' + link + ' title="' + title + '"><img id="advPicture" src="UserFiles/Image/reklamy/' + name + '.jpg" /><div style="background:white; z-index:5; position:relative;top:-305px;height:305px">' + closeAdv + '<object classid="clsid:d27cdb6e-ae6d-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="844 height="300" id="juzwsprzedazy" align="middle"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="UserFiles/Flash/reklamy/' + name + '.swf"><param name="quality" value="high"><PARAM NAME="bgcolor" VALUE="#ffffff"><PARAM NAME="menu" value="false"><param name="wmode" value="transparent"><param name="flashvars" value="link=' + link + '"><!--[if !IE]> <--><object data="UserFiles/Flash/reklamy/' + name + '.swf" width="844" height="300" type="application/x-shockwave-flash"><param name="quality" value="high"><PARAM NAME="bgcolor" VALUE="#ffffff"><PARAM NAME="menu" value="false"><param name="wmode" value="transparent"><param name="flashvars" value="link=' + link + '"><param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"></object><!--> <![endif]--></object></div></a>';
		el.innerHTML = '<div style="background:white;">' + closeAdv + '<object classid="clsid:d27cdb6e-ae6d-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="844" height="300" id="juzwsprzedazy" align="middle"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="UserFiles/Flash/reklamy/' + name + '.swf"><param name="quality" value="high"><PARAM NAME="bgcolor" VALUE="#ffffff"><PARAM NAME="menu" value="false"><param name="wmode" value="transparent"><!--[if !IE]> <--><object data="UserFiles/Flash/reklamy/' + name + '.swf" width="844" height="300" type="application/x-shockwave-flash"><param name="quality" value="high"><PARAM NAME="bgcolor" VALUE="#ffffff"><PARAM NAME="menu" value="false"><param name="wmode" value="transparent"><param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"></object><!--> <![endif]--></object></div>';

		setTimeout("showAdv()",2000);
	}	
}
//pokazuje okno reklamy na glownej stronie
function showAdv(){
	var el = document.getElementById('advert');
	el.style.display = 'block';	
	if (heightAdv < 330){
		heightAdv += 30;
		setTimeout("showAdv()",50);
	}else{
		heightAdv = 330;
		shown = true;
		//setTimeout("hideAdv()",10000);		
	}
	el.style.height = parseInt(heightAdv)+"px";	
}
//ukrywa okno reklamy na glownej stronie
function hideAdv(){
	var el = document.getElementById('advert');
	el.innerHTML = "";
	if (heightAdv > 0){
		heightAdv -= 60;
		setTimeout("hideAdv()",50);
	}else{
		heightAdv = 0;
		el.style.display = 'none';
	}
	el.style.height = parseInt(heightAdv)+"px";	
}
//------------------------ koniec obslugi reklamy na stronie glownej ------------

// funkcja odÅ›wierza listÄ™ przedmiotÃ³w
function refreshSubject(level_id, temp){
  if(temp.value!="0"){
    window.location = 'nasze_publikacje,'+level_id+','+temp.value+'.html';
  }
}
// funkcja odÅ›wierza listÄ™ przedmiotÃ³w
function remaindPass(level_id, temp){
  document.getElementById('formLogin').style.display="none";
  document.getElementById('formRemeind').style.display="block";
}
// funkcja odÅ›wierza listÄ™ przedmiotÃ³w
function refreshCycle(level_id, subject_id, temp){
  if(temp.value!="0"){
    window.location = 'nasze_publikacje,'+level_id+','+subject_id+','+temp.value+'.html';
  }
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu select
function checkAllSelect(isGood){
  var selectList = document.getElementsByTagName('select');
  for(i=0; i <selectList.length; i++){
	//alert (selectList[i].name);  
    if (selectList[i].title =='wymagany' && selectList[i].value=="w"){
        temp = selectList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
  }
  return isGood;
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu text i checkbox
function checkAllInputText(isGood){
  var inputList = document.getElementsByTagName('input');
  for(i=0; i <inputList.length; i++){
	//alert (inputList[i].name);  
    if (inputList[i].title =='wymagany' && inputList[i].value=="" && inputList[i].type=="text"){
        temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
    if (inputList[i].title =='wymagany' && !inputList[i].checked && inputList[i].type=="checkbox"){
        temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
  }
  return isGood;
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu textarea
function checkAllTextarea(isGood){
  var inputList = document.getElementsByTagName('textarea');
  for(i=0; i <inputList.length; i++){
	//alert (inputList[i].name);  
    if (inputList[i].title =='wymagany' && inputList[i].value==""){
	    temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
  }
  return isGood;
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu textarea
function checkPassword(isGood){
  var inputList = document.getElementsByTagName('input');
  for(i=0; i <inputList.length && i <= 10; i++){
    if (inputList[i].value==""  && inputList[i].type=="password"){
      temp = inputList[i].name+"IncorectDate";
      document.getElementById(temp).innerHTML = "Pole wymagane";
      isGood = false;
    }
  }
  
  if(isGood && document.getElementById('formHaslo').value!=document.getElementById('formPowtorzHaslo').value){
      document.getElementById('formHasloIncorectDate').innerHTML = "Wprowadzone hasÅ‚a nie zgadzajÄ… siÄ™";
      isGood = false;
  }
  return isGood;
}
// sprawdza poprawnoÅ›Ä‡ zgÅ‚aszania promozycji
function checkFormPropozycje(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  
  isGood = isEmailAddress(isGood, 'formEmail');
  isGood = isPhoneNumber(isGood, 'formTelefon');
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza kontaktowego
function checkFormKontakt(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllSelect(isGood);
  
  isGood = isEmailAddress(isGood, 'formEmail');
  isGood = isPhoneNumber(isGood, 'formTelefon');

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}
// sprawdza poprawnoÅ›Ä‡ formularza kontaktowego
function checkFormRekrutacja(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllSelect(isGood);
  var fileName = document.getElementById('forumFile').value;
  
  if(fileName!=""){
    var splitted = fileName.split(".");
    lastElement = splitted.length-1;
    if(splitted[lastElement]=="doc" ||splitted[lastElement]=="docx" ||splitted[lastElement]=="pdf" ){
    
    }
    else{
      var isGood = false;
      alert('Dozwolone pliki to: *.doc, *.docx, *.pdf');
    }
  }
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}



// sprawdza poprawnoÅ›Ä‡ formularza rejestracyjnego
function checkRegrisedForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkPassword(isGood);
  isGood = isEmailAddress(isGood, 'formEmail');
  isGood = isPhoneNumber(isGood, 'formTelefon');

  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}
// sprawdza poprawnoÅ›Ä‡ formularza rejestracyjnego
function checkPrzygodaRegrisedForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
 var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = isEmailAddress(isGood, 'formEmail');
  isGood = isPhoneNumber(isGood, 'formTelefon');

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza dodawania warsztatu
function checkAddWorkshopForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
 var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = isPhoneNumber(isGood, 'formPhone');
  isGood = isNumber(isGood, 'formNbOfPeople');  
  isGood = checkAllSelect(isGood);
  isGood = isDate(isGood, 'formDate');
  isGood = isTime(isGood, 'formTime');    

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza darmowego podrecznika
function checkDarmowyPodrecznikForm(type){
//alert (type);
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
 var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isEmailAddress(isGood, 'formNauczycielEmail');
  isGood = isPhoneNumber(isGood, 'formNauczycielTelefon');
  isGood = isPostCode(isGood, 'formNauczycielKodPocztowy');
  isGood = isPostCode(isGood, 'formSzkolaKodPocztowy');
  isGood = checkAdresWysylkiRadio(isGood, 'formAdresWysylka');

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza dodania wsparcia sprzedazy
function checkAddSalesSupportForm(){
//alert ("sprawdzam poprawnosc");
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
 var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isPostCode(isGood, 'formSzkolaKodPocztowy');
  isGood = isEmailAddress(isGood, 'formNauczycielEmail');
  isGood = isPhoneNumber(isGood, 'formNauczycielTelefon');  
  isGood = isNumber(isGood, 'formA1LiczbaKlas');
  isGood = checkArticleMinNbClasses(isGood, 1);
  isGood = checkArticleMinNbClasses(isGood, 2);
  isGood = checkArticleMinNbClasses(isGood, 3);
  
  if (document.getElementById('formAInny').value != ""){
	isGood = isNumber(isGood, 'formAInnyCena');
	isGood = isNumber(isGood, 'formAInnyLiczbaKlas');
	isGood = checkSelect(isGood, 'formAInnyPrzedmiot');
  }    

//  var inputList = document.getElementsByTagName('input');
//  var pom = "";
//  for(i=0; i <inputList.length; i++){
//    pom += inputList[i].name + ": " + inputList[i].type + ", " + inputList[i].value + ", " + inputList[i].checked + "\n";
//  }
//  alert(pom);  

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza rejestracyjnego
function checkUpdateRegrisedForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = isPhoneNumber(isGood, 'formTelefon');

  if(document.getElementById('formHaslo').value!=document.getElementById('formPowtorzHaslo').value){
      document.getElementById('formHasloIncorectDate').innerHTML = "Wprowadzone hasÅ‚a nie zgadzajÄ… siÄ™";
      isGood = false;
  }

  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

  // sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ poprawny adres email
function isEmailAddress(isGood, formName){
//  var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
  var dobryEmail=/^[a-z0-9\-\._]+@([a-z0-9\-_]+\.)+[a-z]{2,4}$/i;
  
  val = document.getElementById(formName).value;
  
  if (dobryEmail.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny adres e-mail";
    return false;
  }
}

  // sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ poprawny telefon
  
function isPhoneNumber(isGood, formName){
//  var dobryNumer=/[0-9\b]+$/;
  var dobryNumer=/^[0-9()\- ]{7,}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryNumer.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny nr telefonu";
    return false;
  }
}

  // sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ poprawny telefon
  
function isRightFormatedPhoneNumber(isGood, formName, format){
  var dobryNumer = "";
  if (!format){
	dobryNumer=/^([0-9]{3})\-([0-9]{3})\-([0-9]{3})$/;
  }else{
	if (format==1){//stacjonarny
		dobryNumer=/^([0-9]{2})\-([0-9]{7})$/;
	}else if(format==2){//komorkowy
		dobryNumer=/^([0-9]{3})\-([0-9]{3})\-([0-9]{3})$/;
	}else if(format==3){//stacjonarny np z dopisanym wewnetrznym
		dobryNumer=/^([0-9]{2})\-([0-9]{7})(.*)$/;
	}
  }
  
  val = document.getElementById(formName).value;
  
  //alert (dobryNumer+" | "+val);
  
  if (dobryNumer.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny nr telefonu";
    return false;
  }
}

  // sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ liczbe / cyfre
  
function isNumber(isGood, formName){
  var dobryNumer=/^[0-9]{1,}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryNumer.test(val)){
    return isGood;
  }
  else{  
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawna wartoÅ›Ä‡";
    return false;
  }
}

  // sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ liczbe / liczbe zmiennoprzecinkowa
  
function isFloatNumber(isGood, formName){
  var dobryNumer=/^[0-9,]{1,}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryNumer.test(val)){
    return isGood;
  }
  else{  
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawna wartoÅ›Ä‡ (miejsca dziesiÄ™tne po przecinku";
    return false;
  }
}

  // sprawdza poprawnosc formatu kodu pocztowego
  
function isPostCode(isGood, formName){
  var dobryKod=/\d{2}-\d{3}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryKod.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny format kodu pocztowego";
    return false;
  }
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu radio
function checkAdresWysylkiRadio(isGood, formName){
  var inputList = document.getElementsByTagName('input');
  ok = false;   
  for(i=0; i <inputList.length; i++){
    if ((inputList[i].name == formName) && (inputList[i].checked == true)) ok = true;
  }
  if (ok){
	return isGood;  
  }else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Musisz zaznaczyÄ‡ adres wysyÅ‚ki";
    temp = formName+"2IncorectDate";
    document.getElementById(temp).innerHTML = "&nbsp;";	
    return false;
  }  
}

// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu radio
function checkRadio(isGood, formName){
  var inputList = document.getElementsByTagName('input');
  ok = false;   
  for(i=0; i <inputList.length; i++){
    if ((inputList[i].name == formName) && (inputList[i].checked == true)) ok = true;
  }
  if (ok){
	return isGood;  
  }else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Musisz zaznaczyÄ‡ odpowiedÅº";
    //temp = formName+"2IncorectDate";
    //document.getElementById(temp).innerHTML = "&nbsp;";	
    return false;
  }  
}

  // sprawdza poprawnosc formatu daty
  
function isDate(isGood, formName){
  var dobryKod=/^\d{4}-\d{2}-\d{2}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryKod.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny format daty";
    return false;
  }
}

  // sprawdza poprawnosc formatu godziny
  
function isTime(isGood, formName){
  var dobryKod=/^\d{2}:\d{2}$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryKod.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny format godziny";
    return false;
  }
}

  // sprawdza, czy przynajmniej jedno pole wypelnione 
  
function oneFieldNotEmpty(isGood, formName1, formName2, value){
  
  val1 = document.getElementById(formName1).value;
  val2 = document.getElementById(formName2).value;
  
// alert(val1+" "+val2);
  
  if ((val1 != value) || (val2 != value)){
    return isGood;
  }
  else{
    temp = formName1+"IncorectDate";
    document.getElementById(temp).innerHTML = "Jedno z pÃ³l musi mieÄ‡ wartoÅ›Ä‡ innÄ… niÅ¼ "+value;
    return false;
  }
}

// lista artyklulow

	var articles = new Array();
//			"w"=>"puste",
	articles['w'] = new Array();
	articles['w'][0] = "";
	articles['w'][1] = "";	
//			"4"=>"Tablice matematyczne",
	articles[4] = new Array();
	articles[4][0] = 99;
	articles[4][1] = 3;
//			"5"=>"DVD + film",
	articles[5] = new Array();
	articles[5][0] = 150;
	articles[5][1] = 1;
//			"6"=>"Przybory tablicowe drewniane (linijka+cyrkiel+k±tomierz)",
	articles[6] = new Array();
	articles[6][0] = 270;
	articles[6][1] = 3;
//			"7"=>"Drukarka laserowa",
	articles[7] = new Array();
	articles[7][0] = 300;
	articles[7][1] = 3;
//			"8"=>"Mikroskop prosty",
	articles[8] = new Array();
	articles[8][0] = 300;
	articles[8][1] = 3;
//			"9"=>"Zestaw linijka + 2 ekierki + k±tomierz (plastikowe)",
	articles[9] = new Array();
	articles[9][0] = 360;
	articles[9][1] = 3;
//			"10"=>"Kamera do mikroskopu",
	articles[10] = new Array();
	articles[10][0] = 450;
	articles[10][1] = 3;
//			"11"=>"Mikroskop pod³±czany do komputera",
	articles[11] = new Array();
	articles[11][0] = 520;
	articles[11][1] = 3;
//			"12"=>"Rzutnik pisma",
	articles[12] = new Array();
	articles[12][0] = 700;
	articles[12][1] = 4;
//			"13"=>"Mikroskop z wyswietlaczem LCD",
	articles[13] = new Array();
	articles[13][0] = 700;
	articles[13][1] = 4;
//			"14"=>"Wycieczka do Drezna",
	articles[14] = new Array();
	articles[14][0] = 1200;
	articles[14][1] = 6;
//			"15"=>"Rzutnik",
	articles[15] = new Array();
	articles[15][0] = 1300;
	articles[15][1] = 6;
//			"16"=>"Laptop",
	articles[16] = new Array();
	articles[16][0] = 1400;
	articles[16][1] = 6;
//			"17"=>"Ksero laserowe (dzia³a bez komputera)",
	articles[17] = new Array();
	articles[17][0] = 1450;
	articles[17][1] = 6;

  // wybranie artykulu z listy 
function chooseArticle(article_no){

//  alert(articles);
//  return;

	var articleName = document.getElementById('formA'+article_no);
	var articlePrice = document.getElementById('formA'+article_no+'Cena');
	var articleNbClasses = document.getElementById('formA'+article_no+'LiczbaKlas');
	
	articlePrice.value = articles[articleName.value][0];
	if (articleName.value != "w"){
		articlePrice.value += " zÅ‚";
	}
	articleNbClasses.value = articles[articleName.value][1];	
}

  // sprawdzenie min liczby klas 
function checkArticleMinNbClasses(isGood, article_no){

	var articleName = document.getElementById('formA'+article_no);
	if (articleName.value == "w") return isGood;
	
	var articleNbClasses = document.getElementById('formA'+article_no+'LiczbaKlas');	
	
	if (articleNbClasses.value >= articles[articleName.value][1]){
		return isGood;
	}
	else{
		temp = "formA"+article_no+"LiczbaKlasIncorectDate";
		document.getElementById(temp).innerHTML = "Niepoprawna liczba klas (min. to "+articles[articleName.value][1]+")";
    	return false;
	}	
}


// sprawdza poprawnoÅ›Ä‡ formularza logowania na stronie dodania wsparcia sprzedazy
function checkLoginSalesSupportForm(){
//alert ("sprawdzam poprawnosc");
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
  }
  
 var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = isConsultantNumber(isGood, 'formKonsultantTelefon');

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

function checkSelect(isGood, formName){
  var selectField = document.getElementById(formName);
  if (selectField.value=="w"){
    temp = selectField.name+"IncorectDate";
    document.getElementById(temp).innerHTML = "Pole wymagane";
    isGood = false;
  }
  return isGood;
}

// sprawdza poprawnoÅ›Ä‡ formularza wysylania linka strony do znajomego
function checkInviteFriendForm(){
  //var spanList = eval("document."+formName+".getElementsByTagName('span')");
  //var spanList = document.friend.getElementsByTagName('span');
  var spanList = document.getElementsByTagName('span');  
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
  }
  
  var isGood = true;
  isGood = checkAllFormInputText(isGood, 'friend');
  isGood = isEmailAddress(isGood, 'formNauczycielEmail');
  isGood = isEmailAddress(isGood, 'formPrzyjacielEmail');  

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza wysylania linka strony do znajomego
function checkInviteConsultantForm(){
//  var spanList = eval("document."+formName+".getElementsByTagName('span')");
//  var spanList = document.consultant.getElementsByTagName('span');
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
	  //alert(spanList[i].innerHTML);
  }
  
  var isGood = true;
  isGood = checkAllFormInputText(isGood, 'consultant');
  isGood = isPhoneNumber(isGood, 'formKNauczycielTelefon');
  if (document.getElementById('formKNauczycielWojewodztwo').value == "w"){
    document.getElementById('formKNauczycielWojewodztwoIncorectDate').innerHTML = "Pole wymagane";  
  	isGood = false;
  }
  if (document.getElementById('formKNauczycielPrzedmiot').value == "w"){
    document.getElementById('formKNauczycielPrzedmiotIncorectDate').innerHTML = "Pole wymagane";  
  	isGood = false;
  }

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}


// funkcja sprawdzajÄ…ca wszyskie wymagane pola typu text i checkbox
function checkAllFormInputText(isGood, formName){
//alert(formName);
  var inputList = eval("document."+formName+".getElementsByTagName('input')");  
  for(i=0; i <inputList.length; i++){
    if (inputList[i].title =='wymagany' && inputList[i].value=="" && inputList[i].type=="text"){
        temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
    if (inputList[i].title =='wymagany' && !inputList[i].checked && inputList[i].type=="checkbox"){
        temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
  }
  return isGood;
}

// funkcja sprawdzajÄ…ca pole typu text
function checkInputText(isGood, formName){
//alert(formName);
  var inputField = document.getElementById(formName);  
  if (inputField.value==""){
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Pole wymagane";
    isGood = false;
  }
  return isGood;
}

//przeszukiwanie tablicy
function in_array(array, value)
{
   for (var i=0; i<array.length; ++i) {
      if (array[i] == value)
         return true;
   }
   return false;
}

//funkcja sprawdzajaca popranosc koncowki numeru konsultanta
function isConsultantNumber(isGood, formName){
	var numbers = new Array('002','005','006','007','008','009','010','013','014','015','020','021','022','023','024','026',
		'028','029','030','035','037','038','041','043','046','047','049','050','054','056','057','058','061','062','067','070',
		'073','075','080','084','085','087','089','090','091','092','093','099','101','102','104','105','106','109','111','112',
		'114','115','116','120','123','124','129','130','131','132','133','135','138','139','140','141','193','202','204','205',
		'207','208','210','211','213','306','309','316','317','332','663','219','171'
	);
	nb = document.getElementById(formName).value;
	if (!in_array(numbers, nb)){
        temp = formName+"IncorectDate";
        document.getElementById(temp).innerHTML = "BÅ‚Ä™dny numer konsultanta";
        isGood = false;
    }
	return isGood;
}

// sprawdza poprawnoÅ›Ä‡ formularza udany start
function checkUdanyStartForm(){
  var spanList = document.getElementsByTagName('span');  
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
  }
  
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isPostCode(isGood, 'formSzkolaKodPocztowy');
  isGood = isPhoneNumber(isGood, 'formSzkolaTelefon');
  isGood = isEmailAddress(isGood, 'formSzkolaEmail');  
  isGood = isPhoneNumber(isGood, 'formDyrektorTelefon');
  if (document.getElementById('formDyrektorTelefonKom').title == "wymagany") isGood = isPhoneNumber(isGood, 'formDyrektorTelefonKom');
  isGood = isEmailAddress(isGood, 'formDyrektorEmail');        

  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

function zablokujPole(pole){
	var field = document.getElementById(pole);
	field.title="";
	if (field.type == "text") field.value = "pole nieaktywne";	
	field.disabled = true;
	
	document.getElementById('przyciskBlokujPole').style.display = "none";
	document.getElementById('przyciskOdblokujPole').style.display = "inline";	
}

function odblokujPole(pole, wymagane){
	var field = document.getElementById(pole);
	if (field.type == "text") field.value = "";
	if (wymagane) field.title="wymagany";
	field.disabled = false;
	
	document.getElementById('przyciskOdblokujPole').style.display = "none";
	document.getElementById('przyciskBlokujPole').style.display = "inline";		
}

// sprawdza poprawnoÅ›Ä‡ formularza zmiany hasla (kluby nauczyciela)
function checkUpdatePasswordChangeForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  var inputList = document.getElementsByTagName('input');
  for(i=0; i <inputList.length; i++){
    if (inputList[i].title =='wymagany' && inputList[i].value==""){
        temp = inputList[i].name+"IncorectDate";
        document.getElementById(temp).innerHTML = "Pole wymagane";
        isGood = false;
    }
  }
  
  if(document.getElementById('formHaslo').value!=document.getElementById('formPowtorzHaslo').value){
      document.getElementById('formHasloIncorectDate').innerHTML = "Wprowadzone hasÅ‚a nie zgadzajÄ… siÄ™";
	  document.getElementById('formPowtorzHasloIncorectDate').innerHTML = "Wprowadzone hasÅ‚a nie zgadzajÄ… siÄ™";
      isGood = false;
  }
 
  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza Radosna szkola - dane uzytkownika
function checkRadosnaSzkolaNewUserForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isPhoneNumber(isGood, 'formTelefon');
  isGood = isEmailAddress(isGood, 'formEmail');

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza, czy uÅ¼ytkownik wprowadziÅ‚ poprawny telefon w dobrym formacie
  
function isFormatedPhoneNumber(isGood, formName){
  var dobryNumer=/([0-9]{3})\-([0-9]{3})\-([0-9]{3})$/;
  
  val = document.getElementById(formName).value;
  
  if (dobryNumer.test(val)){
    return isGood;
  }
  else{
    temp = formName+"IncorectDate";
    document.getElementById(temp).innerHTML = "Niepoprawny nr telefonu";
    return false;
  }
}

// sprawdza numer telefonu w Klubie Humanisty
function checkKlubHumanistyPhoneForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = isFormatedPhoneNumber(isGood, 'formTelefon');

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza adres email w newslleterze w Radosnej szkole
function checkRadosnaSzkolaNewsletterForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = isEmailAddress(isGood, 'formEmail');

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}


// sprawdza poprawnoÅ›Ä‡ formularza Radosna szkola - proœba o katalog
function checkRadosnaSzkolaKatalogForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkRadio(isGood, "formOdp1");
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isPhoneNumber(isGood, 'formTelefon');
  isGood = isEmailAddress(isGood, 'formEmail');

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}


// sprawdza poprawnoÅ›Ä‡ formularza Radosna szkola - proœba o kontak konsultanta
function checkRadosnaSzkolaWizytaForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  isGood = checkAllTextarea(isGood);
  isGood = checkAllSelect(isGood);
  isGood = isPhoneNumber(isGood, 'formTelefon');

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}


// sprawdza poprawnoÅ›Ä‡ formularza Radosna szkola - pobierz gotowy wniosek
function checkRadosnaSzkolaGotowyWniosekForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  
  var isGood = true;
  
  isGood = checkAllSelect(isGood);

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

function moveGingerbreadBell(index, visible){
	//alert('Index: '+index+"; visible: "+visible);
	var id = index;
	if (visible){
		var pierniczek = document.getElementById('piernik');
		var top = Math.floor(Math.random()*900);
		pierniczek.style.top = top
		if (top > 600){
			pierniczek.style.left = Math.floor(Math.random()*800);
		}else{
			pierniczek.style.left = Math.floor(Math.random()*170);
		}
		pierniczek.style.display = 'block';
		++id;
		if (id == positions.length) id = 0;
		setTimeout("moveGingerbreadBell("+id+", false)",5000);
	}else{
		document.getElementById('piernik').style.display = 'none';
		setTimeout("moveGingerbreadBell("+id+", true)",1000);
	}
}

// sprawdza poprawnoÅ›Ä‡ formularza rejestracji do konkursu Czarodziejski kod
function checkCzarodziejskiKodCzesciForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  //alert ("sprawdzone inputy");  

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza rejestracji do konkursu Czarodziejski kod
function checkCzarodziejskiKodSloganForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  //alert ("sprawdzone inputy");  

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}

// sprawdza poprawnoÅ›Ä‡ formularza rejestracji do konkursu Czarodziejski kod
function checkCzarodziejskiKodRejestracjaForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  var isGood = true;
  
  isGood = checkAllInputText(isGood);
  //alert ("sprawdzone inputy");  
  isGood = checkAllTextarea(isGood);
  //alert ("sprawdzone textaree");  
  isGood = checkAllSelect(isGood);
  //alert ("sprawdzone selecty");    
  isGood = isRightFormatedPhoneNumber(isGood, 'formNauczycielTelefonKomorkowy', 2);
  isGood = isRightFormatedPhoneNumber(isGood, 'formSzkolaTelefon', 1);
  isGood = isRightFormatedPhoneNumber(isGood, 'formSzkolaFaks', 3);
  //alert ("sprawdzone telefony");   
  isGood = isNumber(isGood, 'formSzkolaLiczbaNuczycieli');  
  isGood = isNumber(isGood, 'formSzkolaLiczbaUczniow'); 

  //isGood = false;
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}
// funkcja ukrywania/pokazywania elementu na stronie
function showHide(elemToShow, elemToHide){
  //alert ("pokazac: "+elemToShow+", ukryc: "+elemToHide);
  var elementsToShow = elemToShow.split(";");
  for(i=0; i< elementsToShow.length; i++){
    document.getElementById(elementsToShow[i]).style.display="block";
  }
  var elementsToHide = elemToHide.split(";");
  for(i=0; i< elementsToHide.length; i++){
    document.getElementById(elementsToHide[i]).style.display="none";
  }  
}

// sprawdza poprawnoÅ›Ä‡ ankiety o multimediach
function checkAnkietaMultimediaForm(){
  var spanList = document.getElementsByTagName('span');
  for(i=0; i <spanList.length; i++){
    if (spanList[i].className =='incorectDate')
      spanList[i].innerHTML = "";
      
  }
  var isGood = true;
  
  isGood = isEmailAddress(isGood, 'formQM5');
  
  if (isGood == true){
    return true;
  }
  else{
    alert('Popraw informacje wprowadzone do formularza');
    return false;
  }
}