function SWP()
{
    l = document.WineParadeForm.language.value;
    w1 = document.WineParadeForm.wine1.value;
    w2 = document.WineParadeForm.wine2.value;
    w3 = document.WineParadeForm.wine3.value;
    a1 = document.WineParadeForm.year1.value;
    a2 = document.WineParadeForm.year2.value;
    a3 = document.WineParadeForm.year3.value;
    p1 = document.WineParadeForm.prod1.value;
    p2 = document.WineParadeForm.prod2.value;
    p3 = document.WineParadeForm.prod3.value;

    v1="";
    v2="";
    v3="";

    if(w1!="")
    {
        v1 = w1;
        if(a1!="")
            v1=v1+" "+a1;
        v1 = v1+", "+p1;
    }

    if(w2!="")
    {
        v2 = w2;
        if(a2!="")
            v2=v2+" "+a2;
        v2 = v2+", "+p2;
    }

    if(w3!="")
    {
        v3 = w3;
        if(a3!="")
            v3=v3+" "+a3;
        v3 = v3+", "+p3;
    }

    if((w1=="" || p1=="") && (w2=="" || p2=="") && (w3=="" || p3==""))
    {
        if(l=="it")
            m="Inserire almeno un vino e il suo produttore";
        else
            m="Enter at least one wine and its producer";

        alert(m);

        document.WineParadeForm.item1.focus();

        return;
    }

    if((w1!="" && p1=="") || (w2!="" && p2=="") || (w3!="" && p3==""))
    {
        if(l=="it")
            m="Per ogni vino va indicato anche il produttore";
        else
            m="For every wine must be specified its producer";

        alert(m);

        document.WineParadeForm.item1.focus();

        return;
    }

    if((w1!="" && (v1==v2 || v1==v3)) ||
        (w2!="" && v2==v3))
    {
        if(l=="it")
            m="Un vino può essere votato solamente una volta";
        else
            m="A wine can be voted just once";

        alert(m);

        document.WineParadeForm.item1.focus();

        return;
    }

    if(l=="it")
    {
        m="Conferma votazione\n\n";
        m+="Vino n°1: " + v1 + "\n";
        m+="Vino n°2: " + v2 + "\n";
        m+="Vino n°3: " + v3 + "\n\n";
    }
    else
    {
        m="Confirm your vote\n\n";
        m+="Wine n°1: " + v1 + "\n";
        m+="Wine n°2: " + v2 + "\n";
        m+="Wine n°3: " + v3 + "\n\n";
    }

    if(confirm(m))
        document.WineParadeForm.submit();
    else
        return;
}

function FB()
{
    l = document.Feedback.language.value;
    n = document.Feedback.username.value;
    m = document.Feedback.message.value;
    e = document.Feedback.email.value;

    if(n=="")
    {
        if(l=="it")
            m="Inserire il proprio nome";
        else
            m="Enter your name";

        alert(m);

        document.Feedback.username.focus();

        return;
    }

    if(e=="")
    {
        if(l=="it")
            m="Inserire il proprio indirizzo E-Mail";
        else
            m="Enter your E-Mail address";

        alert(m);

        document.Feedback.email.focus();

        return;
    }

    if(chkem(e)==false)
    {
        if(l=="it")
            m="Inserire un indirizzo E-Mail valido";
        else
            m="Enter a valid E-Mail address";

        alert(m);

        document.Feedback.email.focus();

        return;
    }

    if(m=="")
    {
        if(l=="it")
            m="Inserire il testo del messaggio";
        else
            m="Enter a message";

        alert(m);

        document.Feedback.message.focus();

        return;
    }

    if(l=="it")
        c="Si conferma l'invio di questo messaggio?";
    else
        c="Confirm sending this message?";

    if(confirm(c))
        document.Feedback.submit();
    else
        return;
}

function MB()
{
    l = document.MailBox.language.value;
    n = document.MailBox.username.value;
    t = document.MailBox.city.value;
    c = document.MailBox.country.value;
    e = document.MailBox.email.value;
    m = document.MailBox.message.value;

    if(n=="")
    {
        if(l=="it")
            m="Inserire il proprio nome";
        else
            m="Enter your name";

        alert(m);

        document.MailBox.username.focus();

        return;
    }

    if(t=="")
    {
        if(l=="it")
            m="Inserire la propria città";
        else
            m="Enter your city";

        alert(m);

        document.MailBox.city.focus();

        return;
    }

    if(c=="")
    {
        if(l=="it")
            m="Inserire la propria nazione";
        else
            m="Enter your country";

        alert(m);

        document.MailBox.country.focus();

        return;
    }

    if(e=="")
    {
        if(l=="it")
            m="Inserire il proprio indirizzo E-Mail";
        else
            m="Enter your E-Mail address";

        alert(m);

        document.MailBox.email.focus();

        return;
    }

    if(chkem(e)==false)
    {
        if(l=="it")
            m="Inserire un indirizzo E-Mail valido";
        else
            m="Enter a valid E-Mail address";

        alert(m);

        document.MailBox.email.focus();

        return;
    }

    if(m=="")
    {
        if(l=="it")
            m="Inserire il testo della lettera";
        else
            m="Enter your letter";

        alert(m);

        document.MailBox.message.focus();

        return;
    }

    if(l=="it")
        m="Si conferma l'invio della lettera?";
    else
        m="Confirm sending your letter?";

    if(confirm(m))
        document.MailBox.submit();
    else
        return;
}

function MBF(l,x,y)
{
    if(l == "it")
    {
        nametag = "Nome Cognome";
        citytag = "Citt&agrave;";
        countrytag = "Nazione";
        lettertag = "Lettera";
        sendtag = "Invia";
    }
    else
    {
        nametag = "Full Name";
        citytag = "City";
        countrytag = "Country";
        lettertag = "Letter";
        sendtag = "Send";
    }

    document.write("<form action=\"/actions/Mail" + "Box.php\" name=\"MailBox\" method=\"POST\">\n");
    document.write("<input type=\"hidden\" name=\"language\" value=\"" + l + "\">\n");
    document.write("<input type=\"hidden\" name=\"x\" value=\"" + x + "\">\n");
    document.write("<input type=\"hidden\" name=\"y\" value=\"" + y + "\">\n");
    document.write("<table align=\"center\" width=\"640\" border=\"0\" bgcolor=\"#ffffd8\" class=\"large\"><tbody>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">" + nametag + "</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"username\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">" + citytag + "</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"city\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">" + countrytag + "</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"country\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">E-Mail</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"email\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" valign=\"top\" width=\"20%\">" + lettertag + "</td>\n");
    document.write("<td width=\"80%\"><textarea name=\"message\" class=\"large\" style=\"width: 500px; height: 200px\"></textarea></td>\n</tr>\n");
    document.write("<tr><td align=\"center\" colspan=\"2\"><br class=\"tskip\">\n");
    document.write("<input type=\"button\" name=\"send\" value=\"" + sendtag + "\" onclick=\"MB()\"></td>\n");
    document.write("</tr>\n</tbody></table>\n");
    document.write("</form>\n");
}

function FBF(l,x,y)
{
    if(l == "it")
    {
        nametag = "Nome";
        subjtag = "Soggetto";
        msgtag = "Messaggio";
        sendtag = "Invia";
        opt1 = "Commento";
        opt2 = "Suggerimento";
        opt3 = "Problemi con il sito";
        opt4 = "Problemi con il prelievo della rivista PDF";
        opt5 = "Problemi con la lettura della rivista";
        opt6 = "Altri problemi";
    }
    else
    {
        nametag = "Name";
        subjtag = "Subject";
        msgtag = "Message";
        sendtag = "Send";
        opt1 = "Comment";
        opt2 = "Suggestion";
        opt3 = "Problems with the site";
        opt4 = "Problems with downloading the PDF magazine";
        opt5 = "Problemi with reading the magazine";
        opt6 = "Other problems";
    }

    document.write("<form action=\"/actions/Send" + "FB.php\" name=\"Feedback\" method=\"POST\">\n");
    document.write("<input type=\"hidden\" name=\"language\" value=\"" + l + "\">\n");
    document.write("<input type=\"hidden\" name=\"x\" value=\"" + x + "\">\n");
    document.write("<input type=\"hidden\" name=\"y\" value=\"" + y + "\">\n");
    document.write("<table align=\"center\" width=\"640\" border=\"0\" bgcolor=\"#ffffd8\" class=\"large\"><tbody>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">" + nametag + "</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"username\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">E-Mail</td>\n");
    document.write("<td width=\"80%\"><input type=\"text\" name=\"email\" class=\"large\" style=\"width: 500px\"></td>\n</tr>\n");
    document.write("<tr><td align=\"left\" width=\"20%\">" + subjtag + "</td>\n");
    document.write("<td width=\"80%\"><select name=\"subject\" size=\"1\" class=\"large\">\n");
    document.write("<option value=\"1\">" + opt1 + "</option>\n");
    document.write("<option value=\"2\">" + opt2 + "</option>\n");
    document.write("<option value=\"3\">" + opt3 + "</option>\n");
    document.write("<option value=\"4\">" + opt4 + "</option>\n");
    document.write("<option value=\"5\">" + opt5 + "</option>\n");
    document.write("<option value=\"6\">" + opt6 + "</option>\n");
    document.write("</select></td>\n</tr>\n");
    document.write("<tr>\n<td align=\"left\" valign=\"top\" width=\"20%\">" + msgtag + "</td>\n");
    document.write("<td width=\"80%\"><textarea name=\"message\" class=\"large\" style=\"width: 500px; height: 200px\"></textarea></td>\n</tr>\n");
    document.write("<tr><td align=\"center\" colspan=\"2\"><br class=\"tskip\">\n");
    document.write("<input type=\"button\" name=\"send\" value=\"" + sendtag + "\" onclick=\"FB()\">\n</td>\n");
    document.write("</tr></tbody></table>\n</form>\n");
}

function WPF(l,x,y)
{
    var i;

    if(l == "it")
    {
        winetag = "Vino";
        vintag = "Annata";
        prodtag = "Produttore";
        sendtag = "Invia";
    }
    else
    {
        winetag = "Wine";
        vintag = "Vintage";
        prodtag = "Producer";
        sendtag = "Send";
    }

    document.write("<form action=\"/actions/Wine" + "Parade.php\" name=\"WineParadeForm\" method=\"POST\">\n");
    document.write("<input type=\"hidden\" name=\"language\" value=\"" + l + "\">\n");
    document.write("<input type=\"hidden\" name=\"x\" value=\"" + x + "\">\n");
    document.write("<input type=\"hidden\" name=\"y\" value=\"" + y + "\">\n");
    document.write("<table align=\"center\" width=\"95%\" border=\"0\" class=\"large\"><tbody>\n");
    document.write("<tr>\n<td>&nbsp;</td><td class=\"smallhead\">" + winetag + "</td>\n");
    document.write("<td class=\"smallhead\">" + vintag + "</td>\n");
    document.write("<td class=\"smallhead\">" + prodtag + "</td>\n</tr>\n");

    for(i=1; i<=3; i++)
    {
        document.write("<tr>\n");

        document.write("<td align=\"right\" width=\"2%\">" + i + "</td>\n");
        document.write("<td align=\"left\" width=\"45%\"><input type=\"text\" name=\"wine" + i + "\" size=\"36\" class=\"large\"></td>\n");
        document.write("<td align=\"left\" width=\"8%\"><input type=\"text\" name=\"year" + i + "\" size=\"5\" class=\"large\"></td>\n");
        document.write("<td align=\"left\" width=\"45%\"><input type=\"text\" name=\"prod" + i + "\" size=\"36\" class=\"large\"></td>\n");
        document.write("<tr></tr>\n");
    }

    document.write("<tr>\n");
    document.write("<td align=\"center\" colspan=\"4\"><br class=\"tskip\">");
    document.write("<input type=\"button\" name=\"send\" value=\"" + sendtag + "\" onclick=\"SWP()\">\n");
    document.write("</td>\n</tr>\n");
    document.write("</tbody>\n</table>\n");
    document.write("</form>\n");
}

