// Search routines

var healer = new Array();

// ("link page","Therapies","Company","Contact","Address","email","website","phone");

c=0; healer[c]=new Array("healers/healer1.htm","Usui & Karuna Reiki, healing and training","The Colours of the Dawn","Richard Jones","49 Woodland Road, Norton Lees, Sheffield, England S8 8PD","colours@thedawn.co.uk","http://www.thedawn.co.uk","0114 258 2055");
c++; healer[c]=new Array("healers/healer2.htm","Dhaxem healing","Centre of Healing","Dr Dagmar Ebster Grosz","27 New Barn Avenue, Prestbury, Cheltenham England GL52 3LL","dagmar@dhaxem.com","http://www.dhaxem.com","01242 580 287");
c++; healer[c]=new Array("","Reiki, Karuna Reiki,  Massage, Reflexology, Aromatherapy, Indian Head Massage","The Peak School of Reiki","Christine Brady","179 Thanet Street, Clay Cross, Chesterfield, Derbyshire England S45 9JU","reiki.chris@btopenworld.com","http://www.peakreiki.org","01246 864 793");
c++; healer[c]=new Array("","Reiki healing, Colour Reiki healing","The Peak School of Reiki","Janet Roome & Christine Brady","Omega House Church Lane Rowsley Matlock Derbyshire England DE4 2EA","peakreiki@omega-house.freeserve.co.uk","http://www.peakrieki.org","01629 733227 or 01246 864793");
c++; healer[c]=new Array("","Reflexology, Reiki, Colour Reiki, Relax-ology (Reiki & individually channelled meditation), Hopi Ear Candles, Indian Head Massage, Meridian Therapy (EMT)","Healing into Wholeness","Janet Roome","Omega House Church Lane Rowsley Matlock Derbyshire England DE4 2EA","healingintowholeness@omega.freeserve.co.uk","http://www.healingintowholeness.org","01629 733227");
c++; healer[c]=new Array("","Reiki Master, Mentor","","Marina Blyth","32 Edgehill Rd, Bridport, Dorset England DT6 5BD","biddyb@onetel.net.uk","","01308 427895");
c++; healer[c]=new Array("","Reiki","","Kirsty Norton","42 Vereker Road, London England W14 9SJ","kirstynorton@yahoo.co.uk","http://www.kirstynorton.co.uk","07986616590");
c++; healer[c]=new Array("","Reiki, Aromatherapy Massage, Aromatherapy Blending, Indian Head Massage, Reflexology, Hot Stone Massage","Savasana","Vicki Poole","10 Owlswood, Salisbury, Wiltshire England SP2 8DN","vicki@savasana-satsang.com","http://www.savasana-satsang.com","07881 814008");
c++; healer[c]=new Array("","Yoga Therapy, Psychic Healing, Reiki Healing, Psychic Counselling, One to one Yoga, Chakra Balancing, Meditation and relaxation Techniques, Independant advisor for Endometriosis (see website)","Alternatively Endo","Tammy Majchrzak","10 Alaska Place, Chapel , Allerton, Leeds, West Yorkshire England LS7 4LT","tammy@alternatively-endo.com","http://www.alternatively-endo.com","07711 524853");
c++; healer[c]=new Array("","Reiki  Healing & Reiki Classes - All Levels, (Usui Reiki)","","Colleen Farrell","4 Wellcome Avenue, Dartford, Kent England DA1 5JW","colleen21@btinternet.com","","01322 226 875");
c++; healer[c]=new Array("healers/healer4.htm","Reiki Training, Reiki Treatments, Reflexology Treatments, Indian Head Massage, NLP for Self Transformation Self Empowerment Developing your Potential","Holistic Dimensions","Eileen Woodfield","Warndon Villages, Worcester England","eileen@holisticdimensions.co.uk","http://www.holisticdimensions.co.uk","01905 613 975");
c++; healer[c]=new Array("","Reiki healing, Tarot readings, Thought Field Therapy, past life regression and counselling, Reflexology","Panceptions","Liz Davies","40 Blewitts Cottages, New Road, Rainham, Essex England RM13 8SL","liz_m_davies@yahoo.co.uk","","01708 553 361");
c++; healer[c]=new Array("","Reiki, Bowen therapy, Metamorphic technique, Lifestyle advice","","Pam Worthington","Gwelfor, Llanfair Road, Abergele, Conwy, Wales LL22 8DH","pam@ll228dh.fsnet.co.uk","","01745 827634");
c++; healer[c]=new Array("healers/healer5.htm","Reiki training & therapy, Indian Head Massage, Meridian Therapies, Shiatsu","Janette Kidd","Janette Kidd","Stronachie Lodge, near Forgandenny, Perthshire Scotland PH2 9DW","janette@holistic-reiki.com","http://www.holistic-reiki.com","01577 865 796");
c++; healer[c]=new Array("","Reiki Healing and Teaching, Reflexology, including vertical reflexology","Haven of Light","Lisa Moseley","28 Cotswold Close, Verwood, Dorset England BH31 6UJ","havenoflight@aol.com","","07732 974 628");
c++; healer[c]=new Array("","Reiki Master/Teacher, Reflexology,Indian head massage,Swedish Body Massage","S & R Therapy's","Steven Rudelhoff","167,Cavalry Park, March, Cambridgeshire PE15 9DL","srudelhoff@aol.com","","01354 658 244");
c++; healer[c]=new Array("","Reiki treatments and attunements, Aromatherapy, Bowen technique Hopi ear candle","Jan LLoyd","Jan LLoyd","Warwick","Janetlloyd@supanet.com","","01926498949");
c++; healer[c]=new Array("","Australian Bush Flower Essences, Reiki Treatments","","Carol Dalton","85 Old Retford Road, Handsworth, Sheffield S13 9QY","cdalton@tiscali.co.uk","","0114 2548820");
c++; healer[c]=new Array("","l offer a comprehensive dowsing service in the UK/europe creating healing environments for homes/businesses with positive results.","The Osteopathic Health Care Centre","Khalid Haq","70 Mayfield Road South Croydon Surrey CR2 0BF","info@yourbackonline.com","http://www.yourbackonline.com","0208 651 4071");

function healersearch(frm) {

    txtname = frm.nameval.value.toLowerCase().split(" ");  found1 = new Array();  fields1 = new Array(2, 3); 
    txtdisc = frm.discval.value.toLowerCase().split(" ");  found2 = new Array();  fields2 = new Array(1, 1);
    txtloca = frm.locaval.value.toLowerCase().split(" ");  found3 = new Array();  fields3 = new Array(4, 4);
    total=0; 
    
    header();

    for (i = 0; i < healer.length; i++) {
        found1[i] = 0;
        for (j = 0; j < fields1.length; j++)
        for (k = 0; k < txtname.length; k++)
            if (healer[i][fields1[j]].toLowerCase().indexOf(txtname[k]) > -1 && txtname[k] != "") found1[i] += (j+1);
    }
     for (i = 0; i < healer.length; i++) {
        found2[i] = 0;
        for (j = 0; j < fields2.length; j++)
        for (k = 0; k < txtdisc.length; k++)
            if (healer[i][fields2[j]].toLowerCase().indexOf(txtdisc[k]) > -1 && txtdisc[k] != "") found2[i] += (j+1);
    }    
    for (i = 0; i < healer.length; i++) {
        found3[i] = 0;
        for (j = 0; j < fields3.length; j++)      
        for (k = 0; k < txtloca.length; k++)
            if (healer[i][fields3[j]].toLowerCase().indexOf(txtloca[k]) > -1 && txtloca[k] != "") found3[i] += (j+1);
    }   
    for (i = 0; i < healer.length; i++) {
        w1=0; w2=0; w3=0;
        if (txtname == "") w1 = 1;
        if (txtdisc == "") w2 = 1;
        if (txtloca == "") w3 = 1;
        found = 0

        for (j = 0; j < found1.length; j++)
            if (found1[i] >0) w1++;
        for (j = 0; j < found2.length; j++)
            if (found2[i] > 0) w2++;
        for (j = 0; j < found3.length; j++)
            if (found3[i] > 0) w3++;
            
        if (w1 > 0) ++ found
        if (w2 > 0) ++ found
        if (w3 > 0) ++ found
       
   if (found == 3)  total += display(i, win); 

    }
    footer();
}


function header() {
    page = "<html>\n  <head>\n  <title>Search Results</title>\n";
    page += "    <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>\n";
    page += "    <link rel='stylesheet' href='thehealers.css' type='text/css'>\n  </head>\n";
    page += "  <body background='images/bg6.jpg'>\n";
    
    page += "    <table width='95%' border='0' align='center'>\n";
    page += "      <tr>\n";
    page += "        <td width='25%'>\n";
    page += "          <div align='center'>\n";
    page += "            <p><a href='directory.htm'>\n";
    page += "              <img name='back11' border='0' src='images/search%20back.gif' width='80' height='40' align='absmiddle' alt='Back to search the directory'></a><br>\n";
    page += "              <span class='articletextboldCentre'> to Search</span>\n";
    page += "            </p>\n";
    page += "          </div>\n"; 
    page += "        </td>\n";
    page += "        <td width='370'> <img src='images/title.gif' width='370' height='75'></td>\n";
    page += "        <td width='25%'>&nbsp;</td>\n";
    page += "      </tr>\n";
    page += "    </table>\n"; 

    win = window.open("","_parent","s");
    win.document.write(page);
    win.document.write("    <div align='center'><span class='banner_text'>Search Results</span></div><br><br>\n");
}


function footer() {
    win.document.write("    <br>\n");


    win.document.write("    <div align='center'><span class='banner_text'>Total found: " + total + "</span></div><br>\n");
    win.document.write("    <div align='center'>\n");
    win.document.write("      <a href='directory.htm'>\n");
    win.document.write("        <img name='back11' border='0' src='images/search%20back.gif' width='80' height='40' align='absmiddle' alt='Back to search the directory'>\n");
    win.document.write("      </a><br>\n");
    win.document.write("      <span class='articletextboldCentre'> to Search</span>\n");
    win.document.write("    </div>\n");
    win.document.write("  </body>\n</html>\n");
    win.document.close();
}


function display(which,wind) {

    line =  "    <table width='85%' border='3' cellpadding='5' align='center' class='table_fixed' cellspacing='2' bordercolor='#003300' bgcolor='#FFFFCC'>\n";
    line += "      <tr>\n";
    line += "        <td>Name: <span class='table_variable'>" + healer[which][3] + "</span></td>\n";    
    line += "        <td colspan='2'>Company: <span class='table_variable'>" + healer[which][2] + "</span></td>\n";
    line += "      </tr>\n";
    line += "      <tr>\n";
    line += "        <td colspan='3'>Address: <span class='table_variable'>" + healer[which][4] + "</span></td>\n";
    line += "      </tr>\n";
    line += "      <tr>\n";
    line += "        <td>Phone: <span class='table_variable'>" + healer[which][7] + "</span></td>\n";
    line += "        <td>email: <span class='table_variable'><a href='mailto:" +  healer[which][5] + "'>" + healer[which][5] + "</a></span></td>\n";
    line += "        <td>Website: <span class='table_variable'><a href='" +  healer[which][6] + "'>" + healer[which][6] + "</a></span></td>\n";
    line += "      </tr>\n";
    line += "      <tr>\n";
    line += "        <td colspan='3'>Services: <span class='table_variable'>" + healer[which][1] + "</span></td>\n";
    line += "      </tr>\n";
        
    if (healer[which][0] > "") { 
      line += "      <tr>\n";
      line += "        <td colspan='3'>\n";
      line += "          <div align='center'><img src='images/flash.gif'><a href='" + healer[which][0] + "'>  This Healer has a bespoke web page - please click here  </a><img src='images/flash.gif'></div>\n";
      line += "        </td>\n";
      line += "      </tr>\n";
    }
    line += "    </table><br><br>\n";
    
    wind.document.write(line);
    return 1;
}
