function setAction() {
    xGetElementById('action').value = 'Search';
 
    var country = '';
    var locurl = '';
    var loccount = 0;
    var rurl = '';
    var isempty = true;
    if(!xGetElementById('location0').checked) {
if(xGetElementById("location0").checked) {    loccount++;
    isempty = false;
    rurl="any";
    locurl+= "&location0=Any";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location1").checked) {    loccount++;
    isempty = false;
    rurl="sydney";
    locurl+= "&location1=Sydney";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location2").checked) {    loccount++;
    isempty = false;
    rurl="melbourne";
    locurl+= "&location2=Melbourne";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location3").checked) {    loccount++;
    isempty = false;
    rurl="brisbane";
    locurl+= "&location3=Brisbane";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location4").checked) {    loccount++;
    isempty = false;
    rurl="perth";
    locurl+= "&location4=Perth";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location5").checked) {    loccount++;
    isempty = false;
    rurl="adelaide";
    locurl+= "&location5=Adelaide";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location6").checked) {    loccount++;
    isempty = false;
    rurl="canberra";
    locurl+= "&location6=Canberra";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location7").checked) {    loccount++;
    isempty = false;
    rurl="hobart";
    locurl+= "&location7=Hobart";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location8").checked) {    loccount++;
    isempty = false;
    rurl="darwin";
    locurl+= "&location8=Darwin";
   if(country == "" || country == "Australia") { rurl+= "-au"; country = "Australia"; } else { country = "ALL"; }}
if(xGetElementById("location9").checked) {    loccount++;
    isempty = false;
    rurl="north";
    locurl+= "&location9=North Island";
   if(country == "" || country == "New Zealand") { rurl+= "-nz"; country = "New Zealand"; } else { country = "ALL"; }}
if(xGetElementById("location10").checked) {    loccount++;
    isempty = false;
    rurl="south";
    locurl+= "&location10=South Island";
   if(country == "" || country == "New Zealand") { rurl+= "-nz"; country = "New Zealand"; } else { country = "ALL"; }}
if(xGetElementById("location11").checked) {    loccount++;
    isempty = false;
    rurl="abroad";
    locurl+= "&location11=Other";
   if(country == "") { rurl+= "-os"; country = "Overseas"; } else { country = "ALL"; }}
    } else {
        country = 'ALL';
    }
    if(loccount != 1) rurl = ""; else locurl = "";
    
    var allsites = true;
    var sitesurl = '';
if(true) {    sitesurl+= "&sites0=on";
} else {
    allsites=false;
}
if(true) {    sitesurl+= "&sites1=on";
} else {
    allsites=false;
}
if(true) {    sitesurl+= "&sites3=on";
} else {
    allsites=false;
}
if(true) {    sitesurl+= "&sites4=on";
} else {
    allsites=false;
}
if(true) {    sitesurl+= "&sites5=on";
} else {
    allsites=false;
}
    if(allsites) sitesurl = '';
    var catrurl = '';
    var catsidx = xGetElementById('catsel').selectedIndex; 
    if(catsidx > 0) {
        isempty = false;
        catrurl = xGetElementById('catsel').options[catsidx].value; 
    }
    
    xGetElementById('country').value = country;
    
    var mainurl = "";
    
    var k = new String();
    if(document.forms[0].keywords) {
        k = document.forms[0].keywords.value;
        if(document.forms[0].keywords.className == 'empty') {
        	k = '';
        }
    } else {
        k = xGetElementById('keywords').value;
        if(xGetElementById('keywords').className == 'empty') {
        	k = '';
        }
    }
    if(k != "") {
        isempty = false;
        k = k.replace(/:/g, "%3A");
        k = k.replace(/\|/g, "%7C");
        k = k.replace(/\?/g, "%3F");
        k = k.replace(/</g, "%3C");
        k = k.replace(/>/g, "%3E");
        k = k.replace(/"/g, "%22");
        k = escape(k);
        k = k.replace(/\-/g, "-");
        k = k.replace(/%20/g, "-");
        mainurl+= k + "-";
    }
    if(catrurl != "") {
        mainurl+= catrurl + "-";
    }
    
    if(rurl != "") {
        mainurl+= rurl + '-';
    }
    mainurl = mainurl.replace(/\+/g, "%252B");
    mainurl = mainurl.replace(/\//g, "%252F");
    mainurl = mainurl.replace(/%5C/g, "%255C");
    mainurl = mainurl.replace(/%26/g, "%2526");
    mainurl = mainurl.replace(/%23/g, "%2523");
    mainurl = mainurl.replace(/\*/g, "%252A");
    // + - * / . _ @
    
    // |-_
    
    var dopts = selectValue('jtype') + selectValue('jsort') + selectValue('jage');
 
    mainurl+= dopts + (catrurl != "" ? "list.html" : "listall.html");
    var vk = "";
    if(locurl != "" || sitesurl != "" || vk) {
        var turl = locurl + sitesurl + (locurl ? '&country=' + country : '') + vk;
        mainurl+= "?" + turl.substring(1);
    }
    if(isempty) {
        alert("Please enter some search criteria.  \n\n");
        return;
    }
    
    // grab the tab from the # value
    var idx = window.location.href.lastIndexOf("#");
    
    // if we don't have the current tab, check the url value
    if(idx < 0) {
    	idx = window.location.href.indexOf("?tab=");
    	if(idx < 0) {
    		idx = window.location.href.indexOf("&tab=");
    	}
    	if(idx >= 0) {
    		idx+= 4;
    	}
    }
    
    if(idx >= 0) {
    	if(mainurl.indexOf("?") >= 0) {
    		mainurl+= "&";
    	} else {
    		mainurl+= "?";
    	}
    	mainurl+= "tab=" + window.location.href.substr(idx + 1);
    }
    
    // perform search
    self.location.href = mainurl;
}
 
 
function selloc(lid) {
  if(lid == 0) {
    country = 'ALL';
    document.forms[0].location1.checked = false;
    document.forms[0].location2.checked = false;
    document.forms[0].location3.checked = false;
    document.forms[0].location4.checked = false;
    document.forms[0].location5.checked = false;
    document.forms[0].location6.checked = false;
    document.forms[0].location7.checked = false;
    document.forms[0].location8.checked = false;
    document.forms[0].location9.checked = false;
    document.forms[0].location10.checked = false;
    document.forms[0].location11.checked = false;
 
  } else {
    document.forms[0].location0.checked = false;
  } 
}
 
var siteStats = new Array();
function setSiteLabel(sitecode, label) {
    var sid = -1;
    switch(sitecode) {
        case "mycareer":
            xSetInnerHTML(xGetElementById("sites0_label").firstChild.nextSibling.firstChild, "(" + label + ")");
            break;
        case "careerone":
            xSetInnerHTML(xGetElementById("sites1_label").firstChild.nextSibling.firstChild, "(" + label + ")");
            break;
        case "jobsjobsjobs":
            xSetInnerHTML(xGetElementById("sites3_label").firstChild.nextSibling.firstChild, "(" + label + ")");
            break;
        case "linkme":
            xSetInnerHTML(xGetElementById("sites4_label").firstChild.nextSibling.firstChild, "(" + label + ")");
            break;
        case "jobg8":
            xSetInnerHTML(xGetElementById("sites5_label").firstChild.nextSibling.firstChild, "(" + label + ")");
            break;
                     
    }
}
function clearSiteStats(init) {
    siteStats["mycareer"]=0;
    if(!init) {
        setSiteLabel("mycareer", "...");
    } else { xSetInnerHTML("sites0_label", "MyCareer"); }    siteStats["careerone"]=0;
    if(!init) {
        setSiteLabel("careerone", "...");
    } else { xSetInnerHTML("sites1_label", "CareerOne"); }    siteStats["jobsjobsjobs"]=0;
    if(!init) {
        setSiteLabel("jobsjobsjobs", "...");
    } else { xSetInnerHTML("sites3_label", "jobsjobsjobs"); }    siteStats["linkme"]=0;
    if(!init) {
        setSiteLabel("linkme", "...");
    } else { xSetInnerHTML("sites4_label", "LinkMe"); }    siteStats["jobg8"]=0;
    if(!init) {
        setSiteLabel("jobg8", "...");
    } else { xSetInnerHTML("sites5_label", "Jobg8"); }}
 
 
