DayName = new Array(7)
DayName[0] = "Niedziela "
DayName[1] = "Poniedziałek "
DayName[2] = "Wtorek "
DayName[3] = "Środa "
DayName[4] = "Czwartek "
DayName[5] = "Piątek "
DayName[6] = "Sobota "
MonthName = new Array(12)
MonthName[0] = "stycznia "
MonthName[1] = "lutego "
MonthName[2] = "marca "
MonthName[3] = "kwietnia "
MonthName[4] = "maja "
MonthName[5] = "czerwca "
MonthName[6] = "lipca "
MonthName[7] = "sierpnia "
MonthName[8] = "września "
MonthName[9] = "października "
MonthName[10] = "listopada "
MonthName[11] = "grudnia "
MonthN = new Array(12)
MonthN[0] = "01"
MonthN[1] = "02"
MonthN[2] = "03"
MonthN[3] = "04"
MonthN[4] = "05"
MonthN[5] = "06"
MonthN[6] = "07"
MonthN[7] = "08"
MonthN[8] = "09"
MonthN[9] = "10"
MonthN[10] = "11"
MonthN[11] = "12"

// --------------------
// pobieranie daty w formacie Dzień DD miesiąc YYYYr

function getDateStr(){
    var Today = new Date()
    var WeekDay = Today.getDay()
    var Month = Today.getMonth()
    var Day = Today.getDate()
    var Year = Today.getFullYear()
    if(Year <= 99)
        Year += 1900
    return "" + DayName[WeekDay] + Day + " " + MonthName[Month] + "" + Year + "r"
}

// --------------------
// pobieranie daty w formacie DD.MM.YYYYr.

function getDate(){
    var Today = new Date()
    var WeekDay = Today.getDay()
    var Month = Today.getMonth()
    var Day = Today.getDate()
    var Year = Today.getFullYear()
    if(Year <= 99)
        Year += 1900
    return "" + Day + "." + MonthN[Month] + "." + Year + "r."
}

// --------------------
// sprawdzanie poprawności wypełnienia pól i blokowanie kilkakrotnej wysyłki

function discheckForm(theform)
{
   if (theform.nick.value == "") {
        alert( "Wypełnij wszystkie wymagane pola" );
		theform.nick.focus();
        return false ;
    }
	if (theform.miasto.value == "") {
        alert( "Wypełnij wszystkie wymagane pola" );
		theform.miasto.focus();
        return false ;
    }
	if (theform.opinia.value == "") {
        alert( "Wypełnij wszystkie wymagane pola" );
		theform.opinia.focus();
        return false ;
    }
	if (document.all || document.getElementById) {
	   for (i = 0; i < theform.length; i++) {
	   var tempobj = theform.elements[i];
	   if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
	   tempobj.disabled = true;
	   }
   setTimeout('', 2000);
   return true;
   } else {
	  return false;
   }
}

// --------------------
// podstawienie zmiennych do stage

function su(theform)
{
    if (theform.lista.value == "sub") {
       theform.stage.value = 1;
       return true ;
    } else {
	   theform.stage.value = 2;
	}
	return true ;
}

// --------------------
// sprawdzenie poprawności wpisania adresu e-mail oraz blokowanie kilkakrotnej wysyłki

function subcheckForm(theform)
{
    txt=theform.subs.value;
	if (txt.indexOf("@")<3) {
	   alert("Wpisz poprawnie adres e-mail");
	   theform.subs.focus();
	   return false;
	   }
    if ((txt.indexOf(".com")<5)
	&&(txt.indexOf(".org")<5)
	&&(txt.indexOf(".gov")<5)
	&&(txt.indexOf(".net")<5)
	&&(txt.indexOf(".mil")<5)
	&&(txt.indexOf(".edu")<5)
	&&(txt.indexOf(".pl")<5)) {
	   alert("Wpisz poprawnie adres e-mail");
	   theform.subs.focus();
	   return false;
	   }
	if (document.all || document.getElementById) {
	   for (i = 0; i < theform.length; i++) {
	   var tempobj = theform.elements[i];
	   if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
	   tempobj.disabled = true;
	   }
   setTimeout('', 2000);
   return true;
   } else {
	  return false;
   }
}

// --------------------
// blokada wysyłki pustego formularza i blokowanie kilkakrotnej wysyłki

function mescheckForm(theform)
{
   if (theform.temat.value == "") {
        alert( "Wypełnij wszystkie pola formularza formularza" );
		theform.temat.focus();
        return false ;
    }
	if (theform.tekst.value == "") {
        alert( "Wypełnij wszystkie pola formularza formularza" );
		theform.tekst.focus();
        return false ;
    }
	if (document.all || document.getElementById) {
	   for (i = 0; i < theform.length; i++) {
	   var tempobj = theform.elements[i];
	   if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
	   tempobj.disabled = true;
	   }
   setTimeout('', 2000);
   return true;
   } else {
	  return false;
   }
}

// --------------------
// blokada prawego przycisku myszki

if (window.Event)
	document.captureEvents(Event.MOUSEUP);
function nocontextmenu() {
	event.cancelBubble = true
	event.returnValue = false;
	return false;
	}
function norightclick(e) {
if (window.Event){
	if (e.which == 2 || e.which == 3)
	return false;
	}
else
	if (event.button == 2 || event.button == 3) {
		event.cancelBubble = true
		event.returnValue = false;
		return false;
		}
}
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
