// --------------------
// wstawianie daty w formacie dd miesiąc yyyy - dzień

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 "

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 Day + " " + MonthName[Month] + "" + Year + "r."
}

// --------------------
// sprawdzanie poprawności wypełnienia pól i blokowanie kilkakrotnej wysyłki (wersja PL)

function discheckplForm(theform)
{
   if (theform.nazwisko.value == "") {
        alert( "Podaj imię i nazwisko !" );
		theform.nazwisko.focus();
        return false ;
    }
	if (theform.data.value == "kliknij tutaj...") {
        alert( "Wprowadź datę rezerwacji !" );
		theform.data.focus();
        return false ;
    }
	if (theform.noce.value == "") {
        alert( "Podaj ilość nocy !" );
		theform.noce.focus();
        return false ;
    }
	if (theform.osoby.value == "") {
        alert( "Podaj ilość osób !" );
		theform.osoby.focus();
        return false ;
    }
	if (theform.pokoj.value == "5") {
        alert( "Wybierz pokój !" );
		theform.pokoj.focus();
        return false ;
    }
	txt=theform.mail.value;
	if (txt.indexOf("@")<3) {
	   alert("Wpisz poprawnie adres e-mail !");
	   theform.mail.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.mail.focus();
	   return false;
	   }
	if (theform.tel.value == "") {
        alert( "Podaj telefon kontaktowy !" );
		theform.tel.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;
   }
}

// --------------------
// sprawdzanie poprawności wypełnienia pól i blokowanie kilkakrotnej wysyłki (wersja EN)

function discheckenForm(theform)
{
   if (theform.nazwisko.value == "") {
        alert( "It serve name and surname !" );
		theform.nazwisko.focus();
        return false ;
    }
	if (theform.data.value == "click this...") {
        alert( "It introduce date of booking  !" );
		theform.data.focus();
        return false ;
    }
	if (theform.noce.value == "") {
        alert( "It serve amount of night !" );
		theform.noce.focus();
        return false ;
    }
	if (theform.osoby.value == "") {
        alert( "It serve amount of person  !" );
		theform.osoby.focus();
        return false ;
    }
	if (theform.pokoj.value == "5") {
        alert( "Select room !" );
		theform.pokoj.focus();
        return false ;
    }
	txt=theform.mail.value;
	if (txt.indexOf("@")<3) {
	   alert("It inscribe e-mail correctly !");
	   theform.mail.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("It inscribe e-mail correctly !");
	   theform.mail.focus();
	   return false;
	   }
	if (theform.tel.value == "") {
        alert( "It serve contact phone  !" );
		theform.tel.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;
   }
}

// --------------------
// otwieranie nowego okna

var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus,scroll,res) {
   if(pos=="random") {myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
   if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
   else if((pos!='center' && pos!="random") || pos==null){myleft=10;mytop=10}
   settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=" +scroll + ",location=no,directories=no,status=no,menubar=no,toolbar=no" + ",resizable=" +res ; win=window.open(mypage,myname,settings);
   win.focus();
   }

// --------------------
// 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;


// --------------------
// migotanie tekstu

function flash(id, kolor, czas, kolor2, czas2)
{
  if (document.getElementById)
  {
    document.getElementById(id).style.color = kolor;
    setTimeout('flash("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ')', czas);
  }
  else if (document.all)
  {
    document.all[id].style.color = kolor;
    setTimeout('flash("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ')', czas);
  }
}
