bannedips=["139.84.", "66.194.", "208.125.", "131.238.","64.93","132.174.255.54", "66.11.2.179", "149.137.", "188.222.194.214","195.112.46.179","203.90.30.242","132.174.255.54", "198.30.116", "70.60.31.250", "198.30.145.100",  "163.200", "196.21", "203.176.187.205", "24.89.156.62","74.82.32.38", "130.179.164.41", "130.179.16.201", "130.179.164.42", "130.179.16.202", "209.76.204.", "207.213.200.", "64.162.196.", "64.162.197.", "199.88.72.5", "64.174.157.", "199.88.91.114", "205.227.90.159", "173.11.74.233", "12.96.232.", "147.134.","129.100.","202.83.93.34", "194.213.204", "216.49.106.", "209.239.96.6", "198.62.84.118", "198.143.", "218.214.146.28","192.168", "64.49", "192.87.50.", "194.104.224.254", "163.1.34", "202.173.189.32", "192.245.136.3", "136.242.", "208.125", "66.194", "64.83.234", "152.65.", "194.81", "194.36", "194.80", "130.209.", "134.48", "152.97.", "67.159.64", "152.16", "152.3.", "66.251.112", "129.74", "66.254", "129.97", "12.4.242.224", "149.68", "198.30", "70.60.31.250", "169.130.90.18", "150.108", "75.149", "64.69", "213.6.95.70", "134.2.", "192.148.", "203.10.", "78.137.130.100", "142.3.", "136.167."];


function paypalInfo()
{
win = open('paypal.htm', 'paypalwin', 'width=400,height=400,top=0,left=0');

}


function databaseInfo()
{
win = open('database instructions.htm', 'paypalwin', 'width=900,height=500,top=0,left=0');

}

function doMail(whc)
{

url = 'http://www.theway.org.uk/efriend.htm?' + whc ;
win1 = open(url, 'efriendwin', 'width=400,height=800,top=0,left=0');

}



function doList()
{
url = 'http://www.theway.org.uk/mailinglist.htm';
win2 = open(url, 'listwin', 'width=400,height=800,top=0,left=0');

}

function doFeedback()
{
url = 'http://www.theway.org.uk/feed_back.htm';
win3 = open(url, 'feedbackwin', 'width=400,height=800,top=0,left=0');

}
function isEmpty( str){
    strRE = new RegExp( );
    strRE.compile( '^[\s ]*$', 'gi' );
    return strRE.test( str.value );
}


function validate_form ( )
{
    valid = true;

    if ( document.subsform.forename.value == "" )
    {
        alert ("Please fill in the 'forename' box.");
        valid = false;
    }

    
if ( document.subsform.surname.value == "" )
    {
        alert ( "Please fill in the 'surname' box." );
        valid = false;
    }

if ( document.subsform.email.value == "" )
    {
        alert ( "Please fill in the 'e-mail address' box." );
        valid = false;
    }
    

if ( document.subsform.street.value == "" )
    {
        alert ( "Please fill in the 'street address' box." );
        valid = false;
    }

    


if ( document.subsform.town.value == "" )
    {
        alert ( "Please fill in the 'town' box." );
        valid = false;
    }

    


if ( document.subsform.country.value == "" )
    {
        alert ( "Please fill in the 'country' box, even if you live in the UK. It is needed to work out your subscription rate." );
        valid = false;
    }

    


if ( document.subsform.postcode.value == "" && document.subsform.country.value == "UNITED STATES" )
    {
		alert ( "Please fill in your zip code." );
        valid = false;
    }

   
if ( document.subsform.postcode.value == "" && document.subsform.country.value == "UNITED KINGDOM" )
    {
        alert ( "Please fill in your postcode." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipforename.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's forename." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" &&  document.subsform.shipsurname.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's surname." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" &&  document.subsform.shipstreet.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's street address." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shiptown.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's town." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's country." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "UNITED STATES" && document.subsform.shippostcode.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's zip code." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "UNITED KINGDOM" && document.subsform.shippostcode.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's postcode." );
        valid = false;
    }


    return valid;

}

function validate_renew ( )
{
    valid = true;

    if ( document.subsform.name.value == "" && document.subsform.org.value == "" )
    {
        alert ("Please fill in the 'name' box or the 'organization' box.");
        valid = false;
    }

      

if ( document.subsform.street.value == "" )
    {
        alert ( "Please fill in the 'street address' box." );
        valid = false;
    }

    
if ( document.subsform.email.value == "" )
    {
        alert ( "Please fill in the 'e-mail address' box." );
        valid = false;
    }

if ( document.subsform.town.value == "" )
    {
        alert ( "Please fill in the 'town' box." );
        valid = false;
    }

    


if ( document.subsform.country.value == "" )
    {
        alert ( "Please fill in the 'country' box, even if you live in the UK. It is needed to work out your subscription rate." );
        valid = false;
    }

    


if ( document.subsform.postcode.value == "" && document.subsform.country.value == "UNITED STATES" )
    {
		alert ( "Please fill in your zip code." );
        valid = false;
    }

   
if ( document.subsform.postcode.value == "" && document.subsform.country.value == "UNITED KINGDOM" )
    {
        alert ( "Please fill in your postcode." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipname.value == "" && document.subsform.shiporg.value == "")
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's name or organization." );
        valid = false;
    }

    

 


if ( document.subsform.gift.value == "1" &&  document.subsform.shipstreet.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's street address." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shiptown.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's town." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's country." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "UNITED STATES" && document.subsform.shippostcode.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's zip code." );
        valid = false;
    }

    


if ( document.subsform.gift.value == "1" && document.subsform.shipcountry.value == "UNITED KINGDOM" && document.subsform.shippostcode.value == "" )
    {
        alert ( "If you are giving a gift subscription, please fill in the recipient's postcode." );
        valid = false;
    }


    return valid;

}

function validate_sub ( ) {
	valid = true;
	letter = document.renewsub.cu.value
	
	if ( letter.slice(0,2) == "cu"  ||	 letter.slice(0,2) == "CU" ||   letter.slice(0,2) == "WB" ||  letter.slice(0,2) == "wb")
    {
        alert ( "Please just enter the numbers from you password, without the CU- or WB-. Thank you." );
        valid = false;
    }


    return valid;

}

function IP( ){

var ip = '<!--#echo var="REMOTE_ADDR"-->'

var handleips=bannedips.join("|")
handleips=new RegExp(handleips, "i")

if (ip.search(handleips)!=-1){ 

document.theform.action = "subs.asp";
document.theform.submit();

} else {window.location.replace("http://www.theway.org.uk/websubs/websubgateway.asp");
}
}

function validate_various ( ) {
	valid = true;
	
	
	if ( document.various.email.value == "" )
    {
        alert ( "Please enter an e-mail address. Thank you." );
        valid = false;
    }


    return valid;

}


function fixAccents(french) {

french = french.replace(/á/g,"a");
french = french.replace(/â/g,"a");
french = french.replace(/à/g,"a");
french = french.replace(/ä/g,"a");
french = french.replace(/ã/g,"a");
french = french.replace(/å/g,"a");
french = french.replace(/æ/g,"ae");
french = french.replace(/ç/g,"c");
french = french.replace(/é/g,"e");
french = french.replace(/ê/g,"e");
french = french.replace(/è/g,"e");
french = french.replace(/ë/g,"e");
french = french.replace(/í/g,"i");
french = french.replace(/ï/g,"i");
french = french.replace(/ì/g,"i");
french = french.replace(/î/g,"i");
french = french.replace(/ñ/g,"n");
french = french.replace(/ó/g,"o");
french = french.replace(/ô/g,"o");
french = french.replace(/ö/g,"o");
french = french.replace(/õ/g,"o");
french = french.replace(/ò/g,"o");
french = french.replace(/ø/g,"o");
french = french.replace(/œ/g,"oe");
french = french.replace(/ß/g,"ss");
french = french.replace(/þ/g,"th");
french = french.replace(/ð/g,"th");
french = french.replace(/ú/g,"u");
french = french.replace(/û/g,"u");
french = french.replace(/ü/g,"u");
french = french.replace(/ù/g,"u");


}


function get_cookie(cookie_name)
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 46 || charCode > 57))
            return false;

         return true;
      }


