//var tekstmaila
//--------------------------------------------------------------------------------------------------
function AlertEmail()
{
    alert("Podany adres email nie jest prawidłowy!");
};
//--------------------------------------------------------------------------------------------------
function ObslugaTekstu()
{
    // sprawdzanie danych
    if( document.ZakupProgramu.imie.value == "")
    {
        alert("Podaj poprawne imię.");
        return;
    };
    if( document.ZakupProgramu.nazwisko.value == "")
    {
        alert("Podaj poprawne nazwisko.");
        return;
    };
    if( document.ZakupProgramu.kraj.value == "")
    {
        alert("Podaj kraj zamieszkania.");
        return;
    };
    if( document.ZakupProgramu.kod.value == "")
    {
        alert("Podaj poprawny kod pocztowy.");
        return;
    };
    if( document.ZakupProgramu.poczta.value == "")
    {
        alert("Podaj miejscowość zamieszkania.");
        return;
    };
    if( document.ZakupProgramu.ulica.value == "")
    {
        alert("Podaj ulicę zamieszkania.");
        return;
    };
    if( document.ZakupProgramu.dom.value == "")
    {
        alert("Wpisz numer lokalu zamieszkania.");
        return;
    };
    var semail = document.ZakupProgramu.email.value;
    if(( semail.indexOf( " ") != -1))
    {
        AlertEmail();
        return;
    };
    if(( semail.indexOf( "@") == -1))
    {
        AlertEmail();
        return;
    };
    if( semail.indexOf("@") < 2)
    {
        AlertEmail();
        return;
    };
// sklejanie tekstu
    var ind;
    var program = document.ZakupProgramu.program.value;
//ceny programów
    var cena = new Array("20", "30", "20", "30");
//nazwyprogramów
    var programy = new Array("PriorAcc v2.11", "eInstall v1.51", "UniHotKey v2.00", "SecuringFolders v1.10");
    for( ind = 0; ind < programy.length; ++ind)
    {
        if( program.indexOf( programy[ind]) != -1) break;
    };
    var mieszkanie = document.ZakupProgramu.mieszkanie.value;
    if( mieszkanie == "") var przez = "";
    else var przez = "/";
    var data = new Date();
    var temp1;
    var temp2 = "";
    var temp3;
    var temp4 = "";
    var temp5;
    var temp6 = "";
    temp1 = data.getDate();
    if( temp1 < 10) temp2 = "0";
    temp3 = data.getMonth()+ 1;
    if( temp3 < 10) temp4 = "0";
    temp5 = data.getFullYear() - 2000;
    if( temp5 < 10) temp6 = "0";
    var kupujacy = document.ZakupProgramu.kupujacy.value;
    var index;
    var numer = new String( "");
    for( index = kupujacy.length; index < 6; index++)
    {
        numer = numer + "0";
    };
    numer = numer + kupujacy;
    var NRklienta = new String( temp2 + temp1 + temp4 + temp3 + temp6 + temp5 + "/NK/" + numer);
    document.ZakupProgramu.seria.value = NRklienta;
    var str = new String("\tDziękuję za zgłoszenie zakupu programu "+program+
                         ". Kod aktywacyjny programu zostanie przesłany na wskazany adres email po otrzymaniu potwierdzenia wpłaty w wysokości "+
                         cena[ind]+"PLN, na konto numer: 16-1140-2004-0000-3502-5925-2991.W tytule wpłaty proszę wpisać numer klienta.\n\n"+
                         "Numer klienta: " + NRklienta + "\n\n" +
                         document.ZakupProgramu.organizacja.value+"\n"+
                         document.ZakupProgramu.imie.value+" "+document.ZakupProgramu.nazwisko.value+"\n"+
                         document.ZakupProgramu.kraj.value+"\n"+
                         document.ZakupProgramu.kod.value+" "+document.ZakupProgramu.poczta.value+"\n"+
                         document.ZakupProgramu.ulica.value+" "+document.ZakupProgramu.dom.value+przez+mieszkanie+
                         "\n\nTen email został wygenerowany automatycznie, proszę na niego nie odpowiadać.\n\nSławomir Łaptos"
                         );
    document.ZakupProgramu.tresc.value = str;
    document.ZakupProgramu.send.focus();
    document.ZakupProgramu.send.click();
};
//--------------------------------------------------------------------------------------------------
function WyszukajNaStronie()
{
    document.SzukanieNaStronie.sa.focus();
    document.SzukanieNaStronie.sa.click();
};
//--------------------------------------------------------------------------------------------------
function maildoklienta()
{
    document.AutoMail.send2.focus();
    document.AutoMail.send2.click();
};
//--------------------------------------------------------------------------------------------------
function usunnapis()
{
    var polewyszukaj = document.SzukanieNaStronie.q.value;
    if(( polewyszukaj.indexOf( "Wyszukaj...") == -1)) return;
    document.SzukanieNaStronie.q.value = "";
};
//--------------------------------------------------------------------------------------------------
function FormularzWyszukiwania()
{
    var IE;
    if( navigator.appName.indexOf( "Internet Explorer") != -1) IE = 1;
    else IE = -1;
    document.writeln("<form name=\"SzukanieNaStronie\" method=\"get\" action=\"http://www.google.com/custom\"><fieldset style=\"border: 0px;\">");
    if( IE != -1) document.writeln("<div id=\"search1\">");
    else document.writeln("<div id=\"search2\">");
    document.writeln("<input name=\"q\" maxlength=\"255\" value=\"Wyszukaj...\" type=\"text\" style=\"border-style: solid; border-color: rgb(200, 200, 255); width: 110px; height: 24px; text-align: left; background-color: rgb(255, 255, 255);\"");
    document.writeln(" onClick=\"usunnapis()\"></div>");
    if( IE != -1) document.writeln("<div id=\"searchico1\">");
    else document.writeln("<div id=\"searchico2\">");
    document.writeln("<img style=\"border: 0px solid ; width: 42px; height: 42px;\" title=\"Wyszukaj\" src=\"img/1c.ico\" onmouseover=\"this.src='img/2c.ico'\" onmouseout=\"this.src='img/1c.ico'\" hspace=\"0\" vspace=\"0\" onclick=\"WyszukajNaStronie()\">");
    document.writeln("</div><input name=\"domains\" value=\"kateos.org\" type=\"hidden\">");
    document.writeln("<div id=\"niewidoczny\"><input name=\"sa\" type=\"submit\">");
    document.writeln("<input name=\"sitesearch\" value=\"www.slaptos.com\" checked=\"checked\" type=\"radio\"></div></fieldset></form>");
};
//--------------------------------------------------------------------------------------------------
function DownloadIco()
{
    document.writeln("<img style=\"border: 0px solid ; width: 42px; height: 42px;\" title=\"Pobierz program\" src=\"img/1.ico\" onmouseover=\"this.src='img/2.ico'\" onmouseout=\"this.src='img/1.ico'\" hspace=\"0\" vspace=\"0\">");
};
//--------------------------------------------------------------------------------------------------
function BuyIco()
{
    document.writeln("<img style=\"border: 0px solid ; width: 42px; height: 42px;\" title=\"Zakup licencję\" src=\"img/1b.ico\" onmouseover=\"this.src='img/2b.ico'\" onmouseout=\"this.src='img/1b.ico'\" hspace=\"0\" vspace=\"0\">");
};
//--------------------------------------------------------------------------------------------------
function TopButtons()
{
document.writeln("<td style=\"text-align: center;\"><a href=\"index.html\"><img style=\"border: 0px solid ; width: 140px; height: 21px;\" alt=\"O stronie\" src=\"img/bt1.jpg\" onmouseover=\"this.src='img/bt1l.jpg'\" onmouseout=\"this.src='img/bt1.jpg'\" hspace=\"0\" vspace=\"0\"></a></td>");
document.writeln("<td style=\"text-align: center;\"><a href=\"kontakt.html\"><img style=\"border: 0px solid ; width: 140px; height: 21px;\" alt=\"Kontakt\" src=\"img/bt3.jpg\" onmouseover=\"this.src='img/bt3l.jpg'\" onmouseout=\"this.src='img/bt3.jpg'\" hspace=\"0\" vspace=\"0\"></a></td>");
document.writeln("<td style=\"text-align: center;\"><a href=\"partnerzy.html\"><img style=\"border: 0px solid ; width: 140px; height: 21px;\" alt=\"Partnerzy\" src=\"img/bt2.jpg\" onmouseover=\"this.src='img/bt2l.jpg'\" onmouseout=\"this.src='img/bt2.jpg'\" hspace=\"0\" vspace=\"0\"></a></td>");
};
//--------------------------------------------------------------------------------------------------