function imgover(anchor) {
    var img = anchor.firstChild;
    img.src = img.src.replace(".gif","_over.gif");
}

function imgout(anchor) {
    var img = anchor.firstChild;
    img.src = img.src.replace("_over.gif",".gif");
}

function verifyAndSubmitSignUp(form) {
    if (form.first_name.value != "" && form.last_name.value != "" && form.email.value != "")
        form.submit();
    else
        document.getElementById("error").style.display = "block";
}

function verifyAndSubmitRegistration(form) {
    if (form.full_name.value != "" && form.serial_num.value != "" && form.hwkey.value != "")
        form.submit();
    else {
        if (form.full_name.value == "") {
            if (document.getElementById("fullNameLabel").className.indexOf("error")<0)
                document.getElementById("fullNameLabel").className = "error";
        }
        else
            document.getElementById("fullNameLabel").className = "";
        if (form.serial_num.value == "") {
            if (document.getElementById("serialLabel").className.indexOf("error")<0)
                document.getElementById("serialLabel").className = "error";
        }
        else
            document.getElementById("serialLabel").className = "";
        if (form.hwkey.value == "") {
            if (document.getElementById("hwLabel").className.indexOf("error")<0)
                document.getElementById("hwLabel").className = "error";
        }
        else
            document.getElementById("hwLabel").className = "";
        if (document.getElementById("reqLabel").className.indexOf("error")<0)
            document.getElementById("reqLabel").className = "error";
    }
}

function verifyAndSubmitRefer(form) {
    var allEmpty = true;
    var showError = false;
    for (var i=1;i<=3;i++) {
        var fn = eval("form.fName"+i+".value");
        var ln = eval("form.lName"+i+".value");
        var em = eval("form.email"+i+".value");
        if (fn != "" && ln != "" && em != "") {
            allEmpty = false;
            continue;
        }
        else if (fn == "" && ln == "" && em == "")
            continue;
        else
            showError = true;
    }
    if (allEmpty || showError)
        document.getElementById("error").style.display = "block";
    else
        form.submit();
}

function verifyAndSubmitProblem(form) {
    if (form.product.value != "" && form.subject.value != "" && form.email.value != "" && form.email.value.indexOf('@')>0 && form.phone.value != "" && form.message.value != "")
        form.submit();
    else {
        if (form.product.value == "") {
            if (document.getElementById("productLabel").className.indexOf("error")<0)
                document.getElementById("productLabel").className = "error";
        }
        else
            document.getElementById("productLabel").className = "";
        if (form.subject.value == "") {
            if (document.getElementById("subjectLabel").className.indexOf("error")<0)
                document.getElementById("subjectLabel").className = "error";
        }
        else
            document.getElementById("subjectLabel").className = "";
        if (form.email.value == "" || form.email.value.indexOf('@') <= 0) {
            if (document.getElementById("emailLabel").className.indexOf("error")<0)
                document.getElementById("emailLabel").className = "error";
        }
        else
            document.getElementById("emailLabel").className = "";
        if (form.phone.value == "") {
            if (document.getElementById("phoneLabel").className.indexOf("error")<0)
                document.getElementById("phoneLabel").className = "error";
        }
        else
            document.getElementById("phoneLabel").className = "";
        if (form.message.value == "") {
            if (document.getElementById("messageLabel").className.indexOf("error")<0)
                document.getElementById("messageLabel").className = "error";
        }
        else
            document.getElementById("messageLabel").className = "";
        if (document.getElementById("reqLabel").className.indexOf("error")<0)
            document.getElementById("reqLabel").className = "error";
    }
}

function verifyAndSubmitReview(form) {
    if (form.name.value != "" && form.city.value != "" && form.country.value != "" && form.comment.value != "")
        form.submit();
    else {
        if (form.name.value == "") {
            if (document.getElementById("nameLabel").className.indexOf("error")<0)
                document.getElementById("nameLabel").className = "error";
        }
        else
            document.getElementById("nameLabel").className = "";
        if (form.city.value == "") {
            if (document.getElementById("cityLabel").className.indexOf("error")<0)
                document.getElementById("cityLabel").className = "error";
        }
        else
            document.getElementById("cityLabel").className = "";
        if (form.country.value == "") {
            if (document.getElementById("countryLabel").className.indexOf("error")<0)
                document.getElementById("countryLabel").className = "error";
        }
        else
            document.getElementById("countryLabel").className = "";
        if (form.comment.value == "") {
            if (document.getElementById("commentLabel").className.indexOf("error")<0)
                document.getElementById("commentLabel").className = "error";
        }
        else
            document.getElementById("commentLabel").className = "";
        if (document.getElementById("reqLabel").className.indexOf("error")<0)
            document.getElementById("reqLabel").className = "error";
    }
}

function verifyAndSubmitBuy(form) {
    if (parseInt(form.wtf.value) || parseInt(form.sports.value) || parseInt(form.bundle.value))
        form.submit();
    else
        alert("Please enter at least 1 item in either Windows or MacOSX");
    if (form.greeting.value.length > 256)
        alert("Please limit greeting to 256 characters");
}

function toggleGreeting(greeting,turnOn) {
    var defTxt = {'en':"Type your gift note here",'fr':'Tapez votre paiement de cadeau ici'};
    var isIE = (navigator.userAgent.toLowerCase().match('msie') != null);
    if (turnOn) {
        greeting.disabled = false;
        if (isIE) {
            if (greeting.innerHTML == "")
                greeting.innerHTML = defTxt[lang];
        }
        else {
            if (greeting.value == "")
                greeting.value = defTxt[lang];
        }
        greeting.select();
        greeting.focus();
    }
    else {
        var temp = isIE ? greeting.innerHTML : greeting.value;
        if (isIE) {
            greeting.innerHTML = "";
            greeting.select();
            if (temp != defTxt[lang])
                greeting.innerHTML = temp;
        }
        else {
            greeting.value = "";
            greeting.select();
            if (temp != defTxt[lang])
                greeting.value = temp;
        }
        greeting.disabled = true;
    }
}

function checkAndSubmitCCForm(sid,download,lang) {
    var frm = document.forms[0];
    if (frm.cctype.value=="PayPal") {
        location.href="paypal_express.php?sid="+sid+ (lang ? "&lang="+lang : "");
        return true;
    }
    var error = "";
    if (!parseInt(frm.ccnum.value) || frm.ccnum.value.length<15)
        error += "Credit card number.\n";
    var month = frm.ccmonth.value;
    if (month.indexOf('0')==0 && month.length>1)
        month = month.substring(1);
    var mm = parseInt(month);
    if (!mm || mm<1 || mm>12)
        error += "Expiration month.\n";
    var yy = parseInt(frm.ccyear.value);
    if (!yy || yy<2005)
        error += "Expiration year.\n";
    if (frm.ccfname.value == "")
        error += "First name.\n";
    if (frm.cclname.value == "")
        error += "Last name.\n";
    if (frm.ccaddress1.value == "")
        error += "Address 1.\n";
    if (frm.cccity.value == "")
        error += "City.\n";
    if (frm.ccstate.value == "") {
        if (frm.cccountry.value == "US")
            error += "State.\n";
        else if (frm.cccountry.value == "CA" || frm.cccountry.value == "ES" || frm.cccountry.value == "IT" || frm.cccountry.value == "NL")
            error += "Province.\n";
        else if (frm.cccountry.value == "AU")
            error += "Territory.\n";
        else if (frm.cccountry.value == "GB")
            error += "County.\n";
        else if (frm.cccountry.value == "JP")
            error += "Prefecture.\n";
    }
    if (frm.cczip.value == "")
        error += "ZIP Code.\n";
    if (frm.email.value == "" || frm.email.value.indexOf("@")<1)
        error += "Email.\n";
    
    if (error.length > 0)
        alert("Please correct the following field(s):\n"+error);
    else {
        frm.cccountryfull.value = frm.cccountry.options[frm.cccountry.selectedIndex].text;
        if (download || frm.sameasbilling.checked)
            shipsame(frm);
        frm.submit();
    }
}

function shipsame(form) {
    form.action = "buy4.php";
    form.country.value = form.cccountry.value;
    form.fname.value = form.ccfname.value;
    form.lname.value = form.cclname.value;
    form.address1.value = form.ccaddress1.value;
    form.address2.value = form.ccaddress2.value;
    form.city.value = form.cccity.value;
    form.state.value = form.ccstate.value;
    form.zip.value = form.cczip.value;
    form.countryfull.value = form.cccountryfull.value;
}

function toggleForm(sel) {
    var dis = sel.options[sel.selectedIndex].value == "PayPal";
    var frm = document.forms[0];
    frm.ccnum.disabled = dis;
    frm.ccmonth.disabled = dis;
    frm.ccyear.disabled = dis;
    frm.cvv2.disabled = dis;
    frm.ccfname.disabled = dis;
    frm.cclname.disabled = dis;
    frm.ccaddress1.disabled = dis;
    frm.ccaddress2.disabled = dis;
    frm.cccity.disabled = dis;
    frm.ccstate.disabled = dis;
    frm.cczip.disabled = dis;
    frm.cccountry.disabled = dis;
    frm.email.disabled = dis;
}

function checkAndSubmitShippingForm() {
    var frm = document.forms[0];
    var error = "";
    if (frm.fname.value == "")
        error += "First name.\n";
    if (frm.lname.value == "")
        error += "Last name.\n";
    if (frm.address1.value == "")
        error += "Address 1.\n";
    if (frm.city.value == "")
        error += "City.\n";
    if (frm.state.value == "") {
        if (frm.country.value == "US")
            error += "State.\n";
        else if (frm.country.value == "CA" || frm.country.value == "ES" || frm.country.value == "IT" || frm.country.value == "NL")
            error += "Province.\n";
        else if (frm.country.value == "AU")
            error += "Territory.\n";
        else if (frm.country.value == "GB")
            error += "County.\n";
        else if (frm.country.value == "JP")
            error += "Prefecture.\n";
    }
    if (frm.zip.value == "")
        error += "ZIP Code.\n";
    
    if (error.length > 0)
        alert("Please correct the following field(s):\n"+error);
    else {
        frm.countryfull.value = frm.country.options[frm.country.selectedIndex].text;
        frm.submit();
    }
}

var USStates = "<OPTION value='' selected></OPTION>" +
"<OPTION value=AL>AL</OPTION>" +
"<OPTION value=AK>AK</OPTION>" +
"<OPTION value=AZ>AZ</OPTION>" +
"<OPTION value=AR>AR</OPTION>" +
"<OPTION value=CA>CA</OPTION>" +
"<OPTION value=CO>CO</OPTION>" +
"<OPTION value=CT>CT</OPTION>" +
"<OPTION value=DE>DE</OPTION>" +
"<OPTION value=FL>FL</OPTION>" +
"<OPTION value=GA>GA</OPTION>" +
"<OPTION value=HI>HI</OPTION>" +
"<OPTION value=ID>ID</OPTION>" +
"<OPTION value=IL>IL</OPTION>" +
"<OPTION value=IN>IN</OPTION>" +
"<OPTION value=IA>IA</OPTION>" +
"<OPTION value=KS>KS</OPTION>" +
"<OPTION value=KY>KY</OPTION>" +
"<OPTION value=LA>LA</OPTION>" +
"<OPTION value=ME>ME</OPTION>" +
"<OPTION value=MD>MD</OPTION>" +
"<OPTION value=MA>MA</OPTION>" +
"<OPTION value=MI>MI</OPTION>" +
"<OPTION value=MN>MN</OPTION>" +
"<OPTION value=MS>MS</OPTION>" +
"<OPTION value=MO>MO</OPTION>" +
"<OPTION value=MT>MT</OPTION>" +
"<OPTION value=NE>NE</OPTION>" +
"<OPTION value=NV>NV</OPTION>" +
"<OPTION value=NH>NH</OPTION>" +
"<OPTION value=NJ>NJ</OPTION>" +
"<OPTION value=NM>NM</OPTION>" +
"<OPTION value=NY>NY</OPTION>" +
"<OPTION value=NC>NC</OPTION>" +
"<OPTION value=ND>ND</OPTION>" +
"<OPTION value=OH>OH</OPTION>" +
"<OPTION value=OK>OK</OPTION>" +
"<OPTION value=OR>OR</OPTION>" +
"<OPTION value=PA>PA</OPTION>" +
"<OPTION value=RI>RI</OPTION>" +
"<OPTION value=SC>SC</OPTION>" +
"<OPTION value=SD>SD</OPTION>" +
"<OPTION value=TN>TN</OPTION>" +
"<OPTION value=TX>TX</OPTION>" +
"<OPTION value=UT>UT</OPTION>" +
"<OPTION value=VT>VT</OPTION>" +
"<OPTION value=VA>VA</OPTION>" +
"<OPTION value=WA>WA</OPTION>" +
"<OPTION value=DC>DC</OPTION>" +
"<OPTION value=WV>WV</OPTION>" +
"<OPTION value=WI>WI</OPTION>" +
"<OPTION value=WY>WY</OPTION>" +
"<OPTION value=AA>AA</OPTION>" +
"<OPTION value=AE>AE</OPTION>" +
"<OPTION value=AP>AP</OPTION>" +
"<OPTION value=AS>AS</OPTION>" +
"<OPTION value=FM>FM</OPTION>" +
"<OPTION value=GU>GU</OPTION>" +
"<OPTION value=MH>MH</OPTION>" +
"<OPTION value=MP>MP</OPTION>" +
"<OPTION value=PR>PR</OPTION>" +
"<OPTION value=PW>PW</OPTION>" +
"<OPTION value=VI>VI</OPTION>" +
"</SELECT>"; 

var sel = "<SELECT id='statesSel' name=state style='margin-right: 20px;'>";
var ccSel = "<SELECT id='statesSel' name=ccstate style='margin-right: 20px;'>";

var CAProvinces = "<OPTION value='' selected></OPTION>" +
"<OPTION value=AB>AB</OPTION>" +
"<OPTION value=BC>BC</OPTION>" +
"<OPTION value=MB>MB</OPTION>" +
"<OPTION value=NB>NB</OPTION>" +
"<OPTION value=NF>NF</OPTION>" +
"<OPTION value=NT>NT</OPTION>" +
"<OPTION value=NS>NS</OPTION>" +
"<OPTION value=NU>NU</OPTION>" +
"<OPTION value=ON>ON</OPTION>" +
"<OPTION value=PE>PE</OPTION>" +
"<OPTION value=QC>QC</OPTION>" +
"<OPTION value=SK>SK</OPTION>" +
"<OPTION value=YT>YT</OPTION>" +
"</SELECT>";

var AUTerritories = "<option value='' selected></option>" +
"<option value='Australian Capital Territory'>Australian Capital Territory</option>" +
"<option value='New South Wales'>New South Wales</option>" +
"<option value='Northern Territory'>Northern Territory</option>" +
"<option value='Queensland'>Queensland</option>" +
"<option value='South Australia'>South Australia</option>" +
"<option value='Tasmania'>Tasmania</option>" +
"<option value='Victoria'>Victoria</option>" +
"<option value='Western Australia'>Western Australia</option>" +
"</SELECT>";

var ESProvinces = "<option value='' selected></option>" +
"<option value='Alava'>Álava</option>" +
"<option value='Albacete'>Albacete</option>" +
"<option value='Alicante'>Alicante</option>" +
"<option value='Almeria'>Almería</option>" +
"<option value='Asturias'>Asturias</option>" +
"<option value='Avila'>Ávila</option>" +
"<option value='Badajoz'>Badajoz</option>" +
"<option value='Barcelona'>Barcelona</option>" +
"<option value='Burgos'>Burgos</option>" +
"<option value='Caceres'>Cáceres</option>" +
"<option value='Cadiz'>Cádiz</option>" +
"<option value='Cantabria'>Cantabria</option>" +
"<option value='Castellon'>Castellón</option>" +
"<option value='Ceuta'>Ceuta</option>" +
"<option value='Ciudad Real'>Ciudad Real</option>" +
"<option value='Cordoba'>Córdoba</option>" +
"<option value='Cuenca'>Cuenca</option>" +
"<option value='Guadalajara'>Guadalajara</option>" +
"<option value='Gerona'>Girona</option>" +
"<option value='Granada'>Granada</option>" +
"<option value='Guipuzcoa'>Guipúzcoa</option>" +
"<option value='Huelva'>Huelva</option>" +
"<option value='Huesca'>Huesca</option>" +
"<option value='Islas Baleares'>Islas Baleares</option>" +
"<option value='Jaen'>Jaén</option>" +
"<option value='La Coruna'>La Coruña</option>" +
"<option value='Las Palmas'>Las Palmas</option>" +
"<option value='La Rioja'>La Rioja</option>" +
"<option value='Leon'>León</option>" +
"<option value='Lerida'>Lérida</option>" +
"<option value='Lugo'>Lugo</option>" +
"<option value='Madrid'>Madrid</option>" +
"<option value='Malaga'>Málaga</option>" +
"<option value='Melilla'>Melilla</option>" +
"<option value='Murcia'>Murcia</option>" +
"<option value='Navarra'>Navarra</option>" +
"<option value='Orense'>Orense</option>" +
"<option value='Palencia'>Palencia</option>" +
"<option value='Pontevedra'>Pontevedra</option>" +
"<option value='Salamanca'>Salamanca</option>" +
"<option value='Santa Cruz de Tenerife'>Santa Cruz de Tenerife</option>" +
"<option value='Segovia'>Segovia</option>" +
"<option value='Sevilla'>Sevilla</option>" +
"<option value='Soria'>Soria</option>" +
"<option value='Tarragona'>Tarragona</option>" +
"<option value='Teruel'>Teruel</option>" +
"<option value='Toledo'>Toledo</option>" +
"<option value='Valencia'>Valencia</option>" +
"<option value='Valladolid'>Valladolid</option>" +
"<option value='Vizcaya'>Vizcaya</option>" +
"<option value='Zamora'>Zamora</option>" +
"<option value='Zaragoza'>Zaragoza</option>" +
"</select>";

var ITProvinces = "<option value='' selected></option>" +
"<option value='Agrigento'>Agrigento</option>" +
"<option value='Alessandria'>Alessandria</option>" +
"<option value='Ancona'>Ancona</option>" +
"<option value='Aosta'>Aosta</option>" +
"<option value='L'Aquila'>L'Aquila</option>" +
"<option value='Arezzo'>Arezzo</option>" +
"<option value='Ascoli Piceno'>Ascoli Piceno</option>" +
"<option value='Asti'>Asti</option>" +
"<option value='Avellino'>Avellino</option>" +
"<option value='Bari'>Bari</option>" +
"<option value='Belluno'>Belluno</option>" +
"<option value='Benevento'>Benevento</option>" +
"<option value='Bergamo'>Bergamo</option>" +
"<option value='Biella'>Biella</option>" +
"<option value='Bologna'>Bologna</option>" +
"<option value='Bolzano'>Bolzano</option>" +
"<option value='Brescia'>Brescia</option>" +
"<option value='Brindisi'>Brindisi</option>" +
"<option value='Cagliari'>Cagliari</option>" +
"<option value='Caltanissetta'>Caltanissetta</option>" +
"<option value='Campobasso'>Campobasso</option>" +
"<option value='Caserta'>Caserta</option>" +
"<option value='Catania'>Catania</option>" +
"<option value='Catanzaro'>Catanzaro</option>" +
"<option value='Chieti'>Chieti</option>" +
"<option value='Como'>Como</option>" +
"<option value='Cosenza'>Cosenza</option>" +
"<option value='Cremona'>Cremona</option>" +
"<option value='Crotone'>Crotone</option>" +
"<option value='Cuneo'>Cuneo</option>" +
"<option value='Enna'>Enna</option>" +
"<option value='Ferrara'>Ferrara</option>" +
"<option value='Firenze'>Firenze</option>" +
"<option value='Foggia'>Foggia</option>" +
"<option value='Forli'>Forli</option>" +
"<option value='Frosinone'>Frosinone</option>" +
"<option value='Genova'>Genova</option>" +
"<option value='Gorizia'>Gorizia</option>" +
"<option value='Grosseto'>Grosseto</option>" +
"<option value='Imperia'>Imperia</option>" +
"<option value='Isernia'>Isernia</option>" +
"<option value='Latina'>Latina</option>" +
"<option value='Lecce'>Lecce</option>" +
"<option value='Lecco'>Lecco</option>" +
"<option value='Livorno'>Livorno</option>" +
"<option value='Lodi'>Lodi</option>" +
"<option value='Lucca'>Lucca</option>" +
"<option value='Macerata'>Macerata</option>" +
"<option value='Mantova'>Mantova</option>" +
"<option value='Massa Carrara'>Massa Carrara</option>" +
"<option value='Matera'>Matera</option>" +
"<option value='Messina'>Messina</option>" +
"<option value='Milano'>Milano</option>" +
"<option value='Modena'>Modena</option>" +
"<option value='Napoli'>Napoli</option>" +
"<option value='Novara'>Novara</option>" +
"<option value='Nuoro'>Nuoro</option>" +
"<option value='Oristano'>Oristano</option>" +
"<option value='Padova'>Padova</option>" +
"<option value='Palermo'>Palermo</option>" +
"<option value='Parma'>Parma</option>" +
"<option value='Pavia'>Pavia</option>" +
"<option value='Perugia'>Perugia</option>" +
"<option value='Pesaro'>Pesaro</option>" +
"<option value='Pescara'>Pescara</option>" +
"<option value='Piacenza'>Piacenza</option>" +
"<option value='Pisa'>Pisa</option>" +
"<option value='Pistoia'>Pistoia</option>" +
"<option value='Pordenone'>Pordenone</option>" +
"<option value='Potenza'>Potenza</option>" +
"<option value='Prato'>Prato</option>" +
"<option value='Ragusa'>Ragusa</option>" +
"<option value='Ravenna'>Ravenna</option>" +
"<option value='Reggio Calabria'>Reggio Calabria</option>" +
"<option value='Reggio Emilia'>Reggio Emilia</option>" +
"<option value='Rieti'>Rieti</option>" +
"<option value='Rimini'>Rimini</option>" +
"<option value='Roma'>Roma</option>" +
"<option value='Rovigo'>Rovigo</option>" +
"<option value='Salerno'>Salerno</option>" +
"<option value='Sassari'>Sassari</option>" +
"<option value='Savona'>Savona</option>" +
"<option value='Siena'>Siena</option>" +
"<option value='Siracusa'>Siracusa</option>" +
"<option value='Sondrio'>Sondrio</option>" +
"<option value='La Spezia'>La Spezia</option>" +
"<option value='Taranto'>Taranto</option>" +
"<option value='Teramo'>Teramo</option>" +
"<option value='Terni'>Terni</option>" +
"<option value='Torino'>Torino</option>" +
"<option value='Trapani'>Trapani</option>" +
"<option value='Trento'>Trento</option>" +
"<option value='Treviso'>Treviso</option>" +
"<option value='Trieste'>Trieste</option>" +
"<option value='Udine'>Udine</option>" +
"<option value='Varese'>Varese</option>" +
"<option value='Venezia'>Venezia</option>" +
"<option value='Verbania-Cusio-Ossola'>Verbania-Cusio-Ossola</option>" +
"<option value='Vercelli'>Vercelli</option>" +
"<option value='Verona'>Verona</option>" +
"<option value='Vibo Valentia'>Vibo Valentia</option>" +
"<option value='Vicenza'>Vicenza</option>" +
"<option value='Viterbo'>Viterbo</option>" +
"</select>";

var NLProvinces = "<option value='' selected></option>" +
"<option value='Drenthe'>Drenthe</option>" +
"<option value='Flevoland'>Flevoland</option>" +
"<option value='Friesland'>Friesland</option>" +
"<option value='Gelderland'>Gelderland</option>" +
"<option value='Groningen'>Groningen</option>" +
"<option value='Limburg'>Limburg</option>" +
"<option value='Noord-Brabant'>Noord-Brabant</option>" +
"<option value='Noord-Holland'>Noord-Holland</option>" +
"<option value='Overijssel'>Overijssel</option>" +
"<option value='Utrecht'>Utrecht</option>" +
"<option value='Zeeland'>Zeeland</option>" +
"<option value='Zuid-Holland'>Zuid-Holland</option>" +
"</select>";

var GBCounties = "<option value='' selected>-- England --</option>" +
"<option value='Avon'>Avon</option>" +
"<option value='Bedfordshire'>Bedfordshire</option>" +
"<option value='Berkshire'>Berkshire</option>" +
"<option value='Bristol'>Bristol</option>" +
"<option value='Buckinghamshire'>Buckinghamshire</option>" +
"<option value='Cambridgeshire'>Cambridgeshire</option>" +
"<option value='Cheshire'>Cheshire</option>" +
"<option value='Cleveland'>Cleveland</option>" +
"<option value='Cornwall'>Cornwall</option>" +
"<option value='Cumbria'>Cumbria</option>" +
"<option value='Derbyshire'>Derbyshire</option>" +
"<option value='Devon'>Devon</option>" +
"<option value='Dorset'>Dorset</option>" +
"<option value='Durham'>Durham</option>" +
"<option value='East Riding of Yorkshire'>East Riding of Yorkshire</option>" +
"<option value='East Sussex'>East Sussex</option>" +
"<option value='Essex'>Essex</option>" +
"<option value='Gloucestershire'>Gloucestershire</option>" +
"<option value='Greater Manchester'>Greater Manchester</option>" +
"<option value='Hampshire'>Hampshire</option>" +
"<option value='Herefordshire'>Herefordshire</option>" +
"<option value='Hertfordshire'>Hertfordshire</option>" +
"<option value='Humberside'>Humberside</option>" +
"<option value='Isle of Wight'>Isle of Wight</option>" +
"<option value='Isles of Scilly'>Isles of Scilly</option>" +
"<option value='Kent'>Kent</option>" +
"<option value='Lancashire'>Lancashire</option>" +
"<option value='Leicestershire'>Leicestershire</option>" +
"<option value='Lincolnshire'>Lincolnshire</option>" +
"<option value='London'>London</option>" +
"<option value='Merseyside'>Merseyside</option>" +
"<option value='Middlesex'>Middlesex</option>" +
"<option value='Norfolk'>Norfolk</option>" +
"<option value='North Yorkshire'>North Yorkshire</option>" +
"<option value='Northamptonshire'>Northamptonshire</option>" +
"<option value='Northumberland'>Northumberland</option>" +
"<option value='Nottinghamshire'>Nottinghamshire</option>" +
"<option value='Oxfordshire'>Oxfordshire</option>" +
"<option value='Rutland'>Rutland</option>" +
"<option value='Shropshire'>Shropshire</option>" +
"<option value='Somerset'>Somerset</option>" +
"<option value='South Yorkshire'>South Yorkshire</option>" +
"<option value='Staffordshire'>Staffordshire</option>" +
"<option value='Suffolk'>Suffolk</option>" +
"<option value='Surrey'>Surrey</option>" +
"<option value='Tyne and Wear'>Tyne and Wear</option>" +
"<option value='Warwickshire'>Warwickshire</option>" +
"<option value='West Midlands'>West Midlands</option>" +
"<option value='West Sussex'>West Sussex</option>" +
"<option value='West Yorkshire'>West Yorkshire</option>" +
"<option value='Wiltshire'>Wiltshire</option>" +
"<option value='Worcestershire'>Worcestershire</option>" +
"<option value=''>-- Northern Ireland --</option>" +
"<option value='Antrim'>Antrim</option>" +
"<option value='Armagh'>Armagh</option>" +
"<option value='Down'>Down</option>" +
"<option value='Fermanagh'>Fermanagh</option>" +
"<option value='Londonderry'>Londonderry</option>" +
"<option value='Tyrone'>Tyrone</option>" +
"<option value=''>-- Scotland --</option>" +
"<option value='Aberdeen City'>Aberdeen City</option>" +
"<option value='Aberdeenshire'>Aberdeenshire</option>" +
"<option value='Angus'>Angus</option>" +
"<option value='Argyll and Bute'>Argyll and Bute</option>" +
"<option value='Borders'>Borders</option>" +
"<option value='Clackmannan'>Clackmannan</option>" +
"<option value='Dumfries and Galloway'>Dumfries and Galloway</option>" +
"<option value='East Ayrshire'>East Ayrshire</option>" +
"<option value='East Dunbartonshire'>East Dunbartonshire</option>" +
"<option value='East Lothian'>East Lothian</option>" +
"<option value='East Renfrewshire'>East Renfrewshire</option>" +
"<option value='Edinburgh City'>Edinburgh City</option>" +
"<option value='Falkirk'>Falkirk</option>" +
"<option value='Fife'>Fife</option>" +
"<option value='Glasgow'>Glasgow</option>" +
"<option value='Highland'>Highland</option>" +
"<option value='Inverclyde'>Inverclyde</option>" +
"<option value='Midlothian'>Midlothian</option>" +
"<option value='Moray'>Moray</option>" +
"<option value='North Ayrshire'>North Ayrshire</option>" +
"<option value='North Lanarkshire'>North Lanarkshire</option>" +
"<option value='Orkney'>Orkney</option>" +
"<option value='Perthshire and Kinross'>Perthshire and Kinross</option>" +
"<option value='Renfrewshire'>Renfrewshire</option>" +
"<option value='Shetland'>Shetland</option>" +
"<option value='South Ayrshire'>South Ayrshire</option>" +
"<option value='South Lanarkshire'>South Lanarkshire</option>" +
"<option value='Stirling'>Stirling</option>" +
"<option value='West Dunbartonshire'>West Dunbartonshire</option>" +
"<option value='West Lothian'>West Lothian</option>" +
"<option value='Western Isles'>Western Isles</option>" +
"<option value=''>-- Unitary Authorities of Wales --</option>" +
"<option value='Blaenau Gwent'>Blaenau Gwent</option>" +
"<option value='Bridgend'>Bridgend</option>" +
"<option value='Caerphilly'>Caerphilly</option>" +
"<option value='Cardiff'>Cardiff</option>" +
"<option value='Carmarthenshire'>Carmarthenshire</option>" +
"<option value='Ceredigion'>Ceredigion</option>" +
"<option value='Conwy'>Conwy</option>" +
"<option value='Denbighshire'>Denbighshire</option>" +
"<option value='Flintshire'>Flintshire</option>" +
"<option value='Gwynedd'>Gwynedd</option>" +
"<option value='Isle of Anglesey'>Isle of Anglesey</option>" +
"<option value='Merthyr Tydfil'>Merthyr Tydfil</option>" +
"<option value='Monmouthshire'>Monmouthshire</option>" +
"<option value='Neath Port Talbot'>Neath Port Talbot</option>" +
"<option value='Newport'>Newport</option>" +
"<option value='Pembrokeshire'>Pembrokeshire</option>" +
"<option value='Powys'>Powys</option>" +
"<option value='Rhondda Cynon Taff'>Rhondda Cynon Taff</option>" +
"<option value='Swansea'>Swansea</option>" +
"<option value='Tofaen'>Tofaen</option>" +
"<option value='The Vale of Glamorgan'>The Vale of Glamorgan</option>" +
"<option value='Wrexham'>Wrexham</option>" +
"<option value=''>-- UK Offshore Dependencies --</option>" +
"<option value='Channel Islands'>Channel Islands</option>" +
"<option value='Isle of Man'>Isle of Man</option>" +
"</select>";

var JPPrefectures = "<option value='' selected></option>" +
"<option value='Aichi'>Aichi</option>" +
"<option value='Akita'>Akita</option>" +
"<option value='Aomori'>Aomori</option>" +
"<option value='Chiba'>Chiba</option>" +
"<option value='Ehime'>Ehime</option>" +
"<option value='Fukui'>Fukui</option>" +
"<option value='Fukuoka'>Fukuoka</option>" +
"<option value='Fukushima'>Fukushima</option>" +
"<option value='Gifu'>Gifu</option>" +
"<option value='Gunma'>Gunma</option>" +
"<option value='Hiroshima'>Hiroshima</option>" +
"<option value='Hokkaido'>Hokkaido</option>" +
"<option value='Hyogo'>Hyogo</option>" +
"<option value='Ibaraki'>Ibaraki</option>" +
"<option value='Ishikawa'>Ishikawa</option>" +
"<option value='Iwate'>Iwate</option>" +
"<option value='Kagawa'>Kagawa</option>" +
"<option value='Kagoshima'>Kagoshima</option>" +
"<option value='Kanagawa'>Kanagawa</option>" +
"<option value='Kochi'>Kochi</option>" +
"<option value='Kumamoto'>Kumamoto</option>" +
"<option value='Kyoto'>Kyoto</option>" +
"<option value='Mie'>Mie</option>" +
"<option value='Miyagi'>Miyagi</option>" +
"<option value='Miyazaki'>Miyazaki</option>" +
"<option value='Nagano'>Nagano</option>" +
"<option value='Nagasaki'>Nagasaki</option>" +
"<option value='Nara'>Nara</option>" +
"<option value='Niigata'>Niigata</option>" +
"<option value='Oita'>Oita</option>" +
"<option value='Okayama'>Okayama</option>" +
"<option value='Okinawa'>Okinawa</option>" +
"<option value='Osaka'>Osaka</option>" +
"<option value='Saga'>Saga</option>" +
"<option value='Saitama'>Saitama</option>" +
"<option value='Shiga'>Shiga</option>" +
"<option value='Shimane'>Shimane</option>" +
"<option value='Shizuoka'>Shizuoka</option>" +
"<option value='Tochigi'>Tochigi</option>" +
"<option value='Tokushima'>Tokushima</option>" +
"<option value='Tokyo'>Tokyo</option>" +
"<option value='Tottori'>Tottori</option>" +
"<option value='Toyama'>Toyama</option>" +
"<option value='Wakayama'>Wakayama</option>" +
"<option value='Yamagata'>Yamagata</option>" +
"<option value='Yamaguchi'>Yamaguchi</option>" +
"<option value='Yamanashi'>Yamanashi</option>" +
"</select>";

var generalInput = "<input id='stateInp' class=txtField name='state' style='width: 240px;'>";
var ccInput = "<input id='stateInp' class=txtField name='ccstate' style='width: 240px;'>";
function updateStaticCountry(sel) {
    document.getElementById('ccCountryText').innerHTML = sel.options[sel.selectedIndex].innerHTML;
}

function updateStates(code,cc,selState) {
    var statesLabel = document.getElementById('stateslabel');
    var statesCell = document.getElementById('statesinput');
    var selectBox = true;
    if (code=="US") {
        statesLabel.innerHTML = "State:";
        statesCell.innerHTML = (cc ? ccSel : sel) + USStates;
    }
    else if (code=="CA") {
        statesLabel.innerHTML = "Province:";
        statesCell.innerHTML = (cc ? ccSel : sel) + CAProvinces;
    }
    else if (code=="ES") {
        statesLabel.innerHTML = "Province:";
        statesCell.innerHTML = (cc ? ccSel : sel) + ESProvinces;
    }
    else if (code=="IT") {
        statesLabel.innerHTML = "Province:";
        statesCell.innerHTML = (cc ? ccSel : sel) + ITProvinces;
    }
    else if (code=="NL") {
        statesLabel.innerHTML = "Province:";
        statesCell.innerHTML = (cc ? ccSel : sel) + NLProvinces;
    }
    else if (code=="AU") {
        statesLabel.innerHTML = "Territory:";
        statesCell.innerHTML = (cc ? ccSel : sel) + AUTerritories;
    }
    else if (code=="GB") {
        statesLabel.innerHTML = "County:";
        statesCell.innerHTML = (cc ? ccSel : sel) + GBCounties;
    }
    else if (code=="JP") {
        statesLabel.innerHTML = "Prefecture:";
        statesCell.innerHTML = (cc ? ccSel : sel) + JPPrefectures;
    }
    else {
        statesLabel.innerHTML = "Region:";
        statesCell.innerHTML = cc ? ccInput : generalInput;
        selectBox = false;
    }
    if (selState) {
        if (selectBox) {
            var opts = document.getElementById('statesSel').options;
            for(i=0;i<opts.length;i++) {
                var o = opts[i];
                if (o.value == selState) {
                    o.selected = true;
                    break;
                }
            }
        }
        else {
            document.getElementById('stateInp').value = selState;
        }
    }
}

<!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL:  http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL, width, height) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height );");
}
var currentCite = 0;
var currentOffset = 0;
var initialAnimDelay = 3000;
var animDelay = 10000;

function animateCitesFunc() {
    var targetOffset = currentCite * 171;
    if (currentOffset < targetOffset) {
        currentOffset += 10;
        if (currentOffset > targetOffset) currentOffset = targetOffset;
        document.getElementById('cite0').style.marginTop = '-'+currentOffset+'px';
        setTimeout('animateCitesFunc()',50);
    }
    else {
        currentCite++;
        if (currentCite==4) {
            currentCite = 0;
            currentOffset = -1;
        }
        setTimeout('animateCitesFunc()',animDelay);
    }
}

function verifyAndSubmitLogin(form) {
    if (form.email.value != "" && form.email.value.indexOf('@')>0 && form.schoolcode.value != "")
        form.submit();
    else {
        if (form.email.value == "" || form.email.value.indexOf('@') <= 0) {
            if (document.getElementById("emailLabel").className.indexOf("error")<0)
                document.getElementById("emailLabel").className = "error";
        }
        else
            document.getElementById("emailLabel").className = "";
        if (form.schoolcode.value == "") {
            if (document.getElementById("schoolcodeLabel").className.indexOf("error")<0)
                document.getElementById("schoolcodeLabel").className = "error";
        }
        else
            document.getElementById("schoolcodeLabel").className = "";
        if (document.getElementById("reqLabel").className.indexOf("error")<0)
            document.getElementById("reqLabel").className = "error";
    }
}

function verifyAndSubmitPartnerRegistration(form) {
    if (form.first_name.value != "" && form.last_name.value != "" &&
        form.dan_degree.value != "" &&
        form.email.value != "" &&
        form.dojo_name.value != "" && form.dojo_address.value != "" && form.dojo_city.value != "" &&
        form.dojo_zipcode != "" && form.dojo_country.value != "" &&
        ((form.dojo_country.value != "US" && form.dojo_country.value != "CA") || form.dojo_state.value != "") &&
        form.phone.value != "") {
        form.submit();
    }
    else {
        if (form.first_name.value == "") {
            if (document.getElementById("firstNameLabel").className.indexOf("error")<0)
                document.getElementById("firstNameLabel").className = "error";
        }
        else
            document.getElementById("firstNameLabel").className = "";
        if (form.last_name.value == "") {
            if (document.getElementById("lastNameLabel").className.indexOf("error")<0)
                document.getElementById("lastNameLabel").className = "error";
        }
        else
            document.getElementById("lastNameLabel").className = "";
        if (form.dan_degree.value == "") {
            if (document.getElementById("danDegreeLabel").className.indexOf("error")<0)
                document.getElementById("danDegreeLabel").className = "error";
        }
        else
            document.getElementById("danDegreeLabel").className = "";
        if (form.email.value == "") {
            if (document.getElementById("emailLabelReg").className.indexOf("error")<0)
                document.getElementById("emailLabelReg").className = "error";
        }
        else
            document.getElementById("emailLabel").className = "";
        if (form.dojo_name.value == "") {
            if (document.getElementById("dojoLabel").className.indexOf("error")<0)
                document.getElementById("dojoLabel").className = "error";
        }
        else
            document.getElementById("dojoLabel").className = "";
        if (form.dojo_address.value == "") {
            if (document.getElementById("dojoAddressLabel").className.indexOf("error")<0)
                document.getElementById("dojoAddressLabel").className = "error";
        }
        else
            document.getElementById("dojoAddressLabel").className = "";
        if (form.dojo_city.value == "") {
            if (document.getElementById("dojoCityLabel").className.indexOf("error")<0)
                document.getElementById("dojoCityLabel").className = "error";
        }
        else
            document.getElementById("dojoCityLabel").className = "";
        if (form.dojo_state.value == "" && form.dojo_country.value != "" && (form.dojo_country.value == "US" || form.dojo_country.value == "CA")) {
            if (document.getElementById("dojoStateLabel").className.indexOf("error")<0)
                document.getElementById("dojoStateLabel").className = "error";
        }
        else
            document.getElementById("dojoStateLabel").className = "";
        if (form.dojo_zipcode.value == "") {
            if (document.getElementById("dojoZipcodeLabel").className.indexOf("error")<0)
                document.getElementById("dojoZipcodeLabel").className = "error";
        }
        else
            document.getElementById("dojoZipcodeLabel").className = "";
        if (form.dojo_country.value == "") {
            if (document.getElementById("dojoCountryLabel").className.indexOf("error")<0)
                document.getElementById("dojoCountryLabel").className = "error";
        }
        else
            document.getElementById("dojoCountryLabel").className = "";
        if (form.phone.value == "") {
            if (document.getElementById("phoneLabel").className.indexOf("error")<0)
                document.getElementById("phoneLabel").className = "error";
        }
        else
            document.getElementById("phoneLabel").className = "";
        if (document.getElementById("reqLabelReg").className.indexOf("error")<0)
            document.getElementById("reqLabelReg").className = "error";
    }
}

function updateStateStar(code) {
    var star = document.getElementById('stateStar');
    if (code=="US" || code=="CA")
        star.style.display = "inline";
    else
        star.style.display = "none";
}

purchaseHistory = function(lastPayDate) {
    this.lastPayDate = lastPayDate;
    this.totalPaidTxns = 0;
    this.newTxns = 0;
    this.data = new Array();
};

purchaseHistory.prototype.addTransaction = function(paymentDate, item, amount) {
    space = paymentDate.indexOf(' ');
    if (space > 0)
        paymentDate = paymentDate.substring(0,space);
    var month = paymentDate.substring(0,7);
    if (!this.data[month])
        this.data[month] = 0;
        
    this.totalPaidTxns += amount;
    this.data[month] += amount;
    if (paymentDate > this.lastPayDate) {
        this.newTxns += amount;
    }
};

purchaseHistory.prototype.showAll = function() {
    document.getElementById('paidTxns').style.display = 'block';
    for (m in this.data) {
        document.getElementById(m).style.display = 'block';
    }
    document.getElementById('paidAmount').innerHTML = "\$" + this.totalPaidTxns;
}

purchaseHistory.prototype.showMonth = function(sel) {
    var selMonth = sel.options[sel.selectedIndex].value;
    if (selMonth == '')
        return;
    document.getElementById('showAll').checked = false;    
    document.getElementById('showSince').checked = false;    
    document.getElementById('paidTxns').style.display = 'block';
    document.getElementById(selMonth).style.display = 'block';
    for (m in this.data) {
        if (m != selMonth)
            document.getElementById(m).style.display = 'none';
    }
    document.getElementById('paidAmount').innerHTML = "\$" + this.data[selMonth];
}

purchaseHistory.prototype.showSince = function() {
    for (m in this.data) {
        document.getElementById(m).style.display = 'block';
    }
    document.getElementById('paidTxns').style.display = 'none';
    document.getElementById('paidAmount').innerHTML = "\$" + this.newTxns;
}

// End -->


