var arrCou = new Array();
arrCou[0]="Asia|r=7";
arrCou[1]="Latin America|r=5";
arrCou[2]="Europe|r=3";
arrCou[3]="Middle East|r=8";
arrCou[4]="--------|";
arrCou[5]="Argentina|argentina";
arrCou[6]="Brazil|brazil";
arrCou[7]="Colombia|colombia";
arrCou[8]="Costa Rica|costa-rica";
arrCou[9]="Croatia|croatia";
arrCou[10]="Germany|germany";
arrCou[11]="Hungary|hungary";
arrCou[12]="India|india";
arrCou[13]="Israel|israel";
arrCou[14]="Italy|italy";
arrCou[15]="Jordan|jordan";
arrCou[16]="Lebanon|lebanon";
arrCou[17]="Macedonia|macedonia";
arrCou[18]="Malaysia|malaysia";
arrCou[19]="Malta|malta";
arrCou[20]="Mexico|mexico";
arrCou[21]="Panama|panama";
arrCou[22]="Philippines|philippines";
arrCou[23]="Poland|poland";
arrCou[24]="Portugal|portugal";
arrCou[25]="Russia|russia";
arrCou[26]="Serbia|serbia";
arrCou[27]="Singapore|singapore";
arrCou[28]="South Africa|south-africa";
arrCou[29]="Spain|spain";
arrCou[30]="Sri Lanka|sri-lanka";
arrCou[31]="Switzerland|switzerland";
arrCou[32]="Thailand|thailand";
arrCou[33]="Turkey|turkey";
arrCou[34]="Ukraine|ukraine";
var arrCat = new Array();
arrCat[0]="Addiction Treatment|18";
arrCat[1]="Aesthetics (non-surgical)|22";
arrCat[2]="Cancer Treatment|6";
arrCat[3]="Cardiac Surgery|5";
arrCat[4]="Cardiology|50";
arrCat[5]="Cosmetic Surgery|2";
arrCat[6]="Dentistry|1";
arrCat[7]="Dermatology|21";
arrCat[8]="Dialysis|20";
arrCat[9]="Ear Nose and Throat|17";
arrCat[10]="Endocrinology|28";
arrCat[11]="Eye Surgery|7";
arrCat[12]="Fertility Treatment|4";
arrCat[13]="Gastroenterology|33";
arrCat[14]="General Surgery|35";
arrCat[15]="Gynecology & Obstetrics|30";
arrCat[16]="Hair Transplant|16";
arrCat[17]="Imaging|23";
arrCat[18]="Nephrology|41";
arrCat[19]="Neurology|19";
arrCat[20]="Neurosurgery|31";
arrCat[21]="Orthopedic Surgery|3";
arrCat[22]="Pediatrics|34";
arrCat[23]="Rehabilitation|29";
arrCat[24]="Stem Cell Therapy|24";
arrCat[25]="Urology|25";
arrCat[26]="Weight Loss Surgery|8";

function SetCategories()
{
    var categorySel = document.getElementById("category");
    categorySel.length = arrCat.length+1;
    categorySel.options[0].text = "-- All Treatments --";
    categorySel.options[0].value = "";
    for (var i = 0 ; i < arrCat.length ; i++)
    {
        if (arrCat[i] != "")
        {
            var categoryValues = arrCat[i].split("|");
            categorySel.options[i+1].text = categoryValues[0];
            categorySel.options[i+1].value = categoryValues[1];
        }
    }
    categorySel.selectedIndex = 0;
}
function SetCountries()
{
    var countrySel = document.getElementById("country");
    countrySel.length = arrCou.length+1;
    countrySel.options[0].text = "-- All Countries --";
    countrySel.options[0].value = "";
    for (var i = 0 ; i < arrCou.length ; i++)
    {
        if (arrCou[i] != "")
        {
            var countryValues = arrCou[i].split("|");
            countrySel.options[i+1].text = countryValues[0];
            countrySel.options[i+1].value = countryValues[1];
        }
    }
    countrySel.selectedIndex = 0;
}
function Search()
{
    var searchUrl = "";

    var categorySel = document.getElementById("category");
    if (categorySel.value != "") 
    { searchUrl += "&ca=" + categorySel.value; }

    var countrySel = document.getElementById("country");
    if (countrySel.value.substring(0, 2) == "r=") 
    { searchUrl += "&r=" + countrySel.value.substr(2); }
    else if (countrySel.value != "") 
    { searchUrl += "&co=" + countrySel.value; }

    var treatmentSel = document.getElementById("treatment");
    if (treatmentSel.value != "" && treatmentSel.value != "0") 
    { searchUrl += "&tr=" + treatmentSel.value; }

    if (searchUrl == "") 
    { alert("Please choose treatment or country"); return;}

    if (treatmentSel.value != "" && treatmentSel.value != "0")
    { location.href = "/procedurepage.aspx?sch=1" + searchUrl; } 
    else if (categorySel.value != "" && categorySel.value != "0")
    { location.href = "/categorypage.aspx?sch=1" + searchUrl; } 
    else
    { location.href = "/search.aspx?sch=1" + searchUrl; } 
}
function SetSelectedCountry(country)
{
    var countrySel = document.getElementById("country");
    countrySel.value = country;
}
function SetSelectedCategory(category)
{
    var categorySel = document.getElementById("category");
    categorySel.value = category;
}
function SearchCountry(country, category)
{
    var searchUrl = "/search.aspx?sch=1&co=" + country;
    if (category != "") { searchUrl += "&ca=" + category; }
    location.href = searchUrl;
}
function ClearTreatment()
{
    var treatmentSel = document.getElementById("treatment");
    treatmentSel.value = "";
}

SetCategories();
SetCountries();
