// Amended by iCode/DJD 13/10/2008
// var httpBase = "http://www.allenyork-international.com/";
//var httpBase = "http://www.allen-york.com/"; 
var httpBase = window.location.protocol + "//" + window.location.host + "/";
var emailLogo = new Image();
//emailLogo.src = "http://content.allen-york.com/images/emailButton.gif";
emailLogo.src = "/files/images/emailButton.gif";

// Amended by iCode/DJD 13.10.2008
var emailLogoGone = new Image();
//emailLogoGone.src = "http://conten.allen-york.com/images/emailButtonGone.gif";
emailLogoGone.src = "/files/images/emailButtonGone.gif";

function goLite(obj)
{
   obj.style.backgroundColor = "#BBBBBB";
}
            
function goDim(obj)
{
   obj.style.backgroundColor = "#FFFFFF";
}
        
function setSelectedItem(list,toMatch) {
    for (var intI = 0; intI < list.length ; intI++) {
                if (list.options[intI].value == toMatch) {
              list.options[intI].selected = true;
        }
    }
}    

function validatePassword(frm)
{
    var pass1 = frm.password;
    var pass2 = frm.passwordConfirm;

    if ( pass1.value.length < 6 ) {
        alert("Your password must be at least 6 characters.");
        return false;
    }
    
    if ( pass1.value != pass2.value ) {
        alert("Sorry, the passwords you entered do not match.");
        return false;
    }
    
    return true;
}

function toggleBox(divname) 
{
    var style2 = document.getElementById(divname).style;
    style2.display = (style2.display != "block") ? "block":"none";
}



// Firstname,Surname,Email,Phone,Mobile,Postcode,currentSalary,benefitsValue,currentPackage,requiredSalary,canRelocate,heardAboutUs

function checkPassword(of)
{
    var validated = false;
    var pwd1 = document.getElementById('newpwd').value;
    var pwd2 = document.getElementById('cfmpwd').value;

    if ( pwd1 != pwd2 ) {
        alert('Sorry, the passwords do not match. Please re-enter your new password');
        return false;
    } 
    
    if ( pwd1.length < 6 ) {
        alert('Sorry, your new password must be at least 6 characters');
        return false;
    }
    
    return true;    
}

function checkform(of)
{
    // Test if DOM is available and there is an element called required
    if(!document.getElementById || !document.createTextNode){return;}
    if(!document.getElementById('required')){return;}

    var validated = true;

    // Define error messages and split the required fields
    var errorID='errormsg';
    var errorClass='dropDownLoadErr';
    var defaultClass = 'dropDownLoad';

    var reqfields=document.getElementById('required').value.split(',');
    

    // Insist on relocation info if canRelocate is selected    
    if (document.getElementById('canRelocate') ) {    
        if ( document.getElementById('canRelocate').selectedIndex == 1 ) {
            reqfields.push("relocateInfo");
        } else {
            document.getElementById('relocateInfo').className = defaultClass;
        }
    }
    
    // Insist on a Charity Number if applicable
    if (document.getElementById('CompanyType') ) {    
        if ( document.getElementById('CompanyType').selectedIndex == 0 ) {
            reqfields.push("CharityNo");
        } else {
            document.getElementById('CharityNo').className = defaultClass;
        }
    }

    // Check passwords map
    //if ( document.getElementById('homeEmail').value != document.getElementById('confirmEmail').value ) {
	//alert('Sorry, the email addresses do not match');
	//return false;
    //}
	

    // remove old images and classes from the required fields
    for(var i=0;i<reqfields.length;i++)
    {
        var f=document.getElementById(reqfields[i]);
        if(!f){continue;}
        if(f.previousSibling && /img/i.test(f.previousSibling.nodeName))
        {
            f.parentNode.removeChild(f.previousSibling);
        }
        f.className=defaultClass;
    }
    // loop over required fields
    for(var i=0;i<reqfields.length;i++)
    {
        // check if required field is there
        var f=document.getElementById(reqfields[i]);
        if(!f){continue;}
        // test if the required field has an error, 
        // according to its type
        switch(f.type.toLowerCase())
        {
            case 'text':
                if(f.value=='' && f.id!='Email'){cf_adderr(f)}                            
                // email is a special field and needs checking
                if(f.id=='Email' && !cf_isEmailAddr(f.value)){cf_adderr(f)}                            
                break;
            case 'file':
                if(f.value==''){cf_adderr(f)}
                break;
            case 'textarea':
                if(f.value==''){cf_adderr(f)}                            
                break;
            case 'checkbox':
                if(!f.checked){cf_adderr(f)}                            
                break;
            case 'select-one':
                if(!f.selectedIndex && f.selectedIndex==0){cf_adderr(f)}                            
                break;
        }
    }
    
    if ( !validated ) {
        alert("Please review this form and complete the fields that are marked in red.");
    }
    
    // The form has been validated, but now check they have agreed to our T's & C's

    if ( validated && (document.getElementById("agreeTCs").checked == false)) {
        alert("To complete your registration you must agree to the Allen & York Terms & Conditions");
        validated = false;
    }
    
    return validated;

    /* Tool methods */
    function cf_adderr(o)
    {
        o.className=errorClass;
        validated = false;
    }

    function cf_isEmailAddr(str) 
    {
        return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/);
    }
}    


function calcPackageValue() 
{
    var total = 0;
    var curSal = parseInt(document.getElementById("currentSalary").value);
    var benPac = parseInt(document.getElementById("benefitsValue").value);
    
    if (isNaN(curSal)==1) { curSal = 0; }
    if (isNaN(benPac)==1) { benPac = 0; }
        
    total = curSal + benPac;
    
    document.getElementById("currentPackage").value = total;
}

function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
    var numberfield = objName;
    if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
    {
        numberfield.select();
        numberfield.focus();
        return false;
    }
    else
    {
        return true;
    }
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{
    // only allow 0-9 be entered, plus any values passed
    // (can be in any order, and don't have to be comma, period, or hyphen)
    // if all numbers allow commas, periods, hyphens or whatever,
    // just hard code it here and take out the passed parameters
    var checkOK = "0123456789" + comma + period + hyphen;
    var checkStr = objName;
    var allValid = true;
    var decPoints = 0;
    var allNum = "";
    
    for (i = 0;  i < checkStr.value.length;  i++)
    {
        ch = checkStr.value.charAt(i);
        for (j = 0;  j < checkOK.length;  j++)
        if (ch == checkOK.charAt(j))
        break;
        if (j == checkOK.length)
        {
            allValid = false;
            break;
        }
        if (ch != ",")
        allNum += ch;
    }
    if (!allValid)
    {    
        alertsay = "Please enter only these values \""
        alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field."
        alert(alertsay);
        return (false);
    }
    
    // set the minimum and maximum
    var chkVal = allNum;
    var prsVal = parseInt(allNum);
    if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
    {
        alertsay = "Please enter a value greater than or "
        alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
        alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
        alert(alertsay);
        return (false);
    }
}

function actionRunSearch(id)
{
    //var url="/QuickSearch?searchId=" + id;
    var url="/job-alert?searchId=" + id;
    document.location = url;        
}

function actionToggleEmail(btn,id,summaryObj)
{
    if ( btn.value == "Don't email me" ) {
        btn.value = "Email me";
        var logo = document.getElementById("mailLogo_"+id);
        logo.src = emailLogoGone.src
        var text = document.getElementById(summaryObj).innerHTML;
        document.getElementById(summaryObj).innerHTML = text.replace("will be","will not be");
        var url = "/AccountMaintenance";
        url = url + "?a=searchEmailsOFF";
        url = url + "&id="+id;
        loadXMLDoc(url);
    } else {
        btn.value = "Don't email me";
        var logo = document.getElementById("mailLogo_"+id);
        logo.src = emailLogo.src;
        var text = document.getElementById(summaryObj).innerHTML;
        document.getElementById(summaryObj).innerHTML = text.replace("will not be","will be");
        var url = "/AccountMaintenance";
        url = url + "?a=searchEmailsON";
        url = url + "&id="+id;
        loadXMLDoc(url);
    }        
}

function actionRemoveSearch(id,divObj)
{
    // Remove it from the display
    document.getElementById(divObj).style.display = 'none';
    // Remove it from the database
    var url = "/AccountMaintenance";
    url = url + "?a=removeSearch";
    url = url + "&id="+id;
    loadXMLDoc(url);
}


function loadXMLDoc(url) 
{
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        var req = new XMLHttpRequest();
        // req.onreadystatechange = processReqChange; // We're not going to do any processing dependant on the result
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        var req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.open("GET", url, true);
            req.send();
        }
    } else {
        alert("loadXMLDoc fell through!");
    }
}

function setArchived(jobId,archive)
{
    var url = "/AmendVacancy";
    url = url + "?jobid=" + jobId;
    url = url + "&action=setArchived"
    url = url + "&status="+archive;
    loadXMLDoc(url);
    setTimeout("location.reload(true)",500);
}

function applyForJob(jobId,cbState)
{
        // Update the counter on the side as well.
        if (document.getElementById("jobcount"))
        {
            var mText = document.getElementById("jobcount").firstChild.nodeValue;
            var jobCount = parseInt(mText);

            if ( cbState == true ) {
                    jobCount++;
            } else {
                    jobCount--;
                    if ( jobCount < 0 ) {
                            jobCount = 0;
                    }
            }

            document.getElementById("jobcount").innerHTML = jobCount + '';

	    // Changed DJD/iCode Systems 17/10/2008
	    //var url = "/SendApplications";
            var url = "/JobApplication";
            url = url + "?jobid=" + jobId;
            url = url + "&status=" + cbState;
            loadXMLDoc(url);
        }
        else
        {
              var c = new Array();
              c = document.getElementsByTagName('input');
              for (var i = 0; i < c.length; i++)
              {
                if (c[i].type == "checkbox")
                  c[i].checked = false;
              }
          alert('You must be logged in to use this feature');
        }
}

function sendToAFriend(jobId,email)
{
    var url = "/SendToAFriend";
    url = url + "?jobid=" + jobId;
    url = url + "&email=" + email;
    loadXMLDoc(url);
    alert('Thank you. An email has been sent to ' + email );
}

function getobj(id)
{
    var obj = document.getElementById("int_"+id);
    var w = obj.selectedIndex;
    var selected_cur = obj.options[w].text;
    document.getElementById("t_"+id).value = selected_cur;
}

function getvals()
{
    getobj("currency");
    getobj("country");
    getobj("region");
    getobj("county");
    getobj("town");
}





function appendOptionLast(obj,name,id,selected)
{
     var elOptNew = document.createElement('option');
     elOptNew.text = name;
     elOptNew.value = id;
     if (selected)
        elOptNew.selected = true;

      try {
        obj.add(elOptNew, null); // standards compliant; doesn't work in IE
      }
      catch(ex) {
        obj.add(elOptNew); // IE only
      }
}

function displayXML(response,target,selected) {
    var customers = response.getElementsByTagName('item');
    var obj = document.getElementById("int_"+target);
    
    obj.options.length = 0;
    if ( target == "currency" ) {
        appendOptionLast(obj,"Choose currency...",-1)
    } else {
        appendOptionLast(obj,"Every " + target,-1);
    }

    for(var i=0; i<customers.length; i++) {
        var d_selected = false;
        var itemName = customers[i].getElementsByTagName('name')[0].childNodes[0].nodeValue;
        var itemID = customers[i].getElementsByTagName('id')[0].childNodes[0].nodeValue;
        if (selected == itemID) d_selected = true;
        appendOptionLast(obj,itemName,itemID,d_selected);
    }
}

function initDrop(id)
{  
    var obj = document.getElementById("int_"+id);      
    obj.options.length = 0;
    appendOptionLast(obj,"Loading...",-1)
}

function ajaxLink(url, selected) {

    if (url.indexOf("view=area") > -1)
        initDrop("area");
    if (url.indexOf("module=currency") > -1)
        initDrop("currency");
    var httpRequest;
    
    url = httpBase + url;
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        httpRequest = new XMLHttpRequest();
        if (httpRequest.overrideMimeType) {
            httpRequest.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    httpRequest.open ('GET', url, true);
    httpRequest.onreadystatechange = function() {
        if (httpRequest.readyState == 4) {
            if ( httpRequest.status == 200 ) {
                var xmlDoc;
                if(window.ActiveXObject){ // If IE Windows
                    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc.loadXML(httpRequest.responseText);
                } else {
                    xmlDoc = httpRequest.responseXML;
                }                            
                var dataTarget = xmlDoc.getElementsByTagName('list')[0].getAttribute("target");
                
                displayXML(httpRequest.responseXML,dataTarget,selected);

            } else {
                alert("Error : " + httpRequest.status);
            }
        } else {
            // document.getElementById("infoPane").innerHTML = "Loading...";                    
        }
    };
    
    httpRequest.send (null);

}

function clearDropdown(obj,target) {
    obj.options.length = 0;
    appendOptionLast(obj,"Every " + target,-1);
}

function populateDropdown(datasource,keyname,keyid) {

    var obj = document.getElementById(keyid);
    var id = obj.options[obj.selectedIndex].value;        

    if ( datasource == "area") {
        clearDropdown(document.getElementById("int_country"),"country");
        clearDropdown(document.getElementById("int_region"),"region");
        clearDropdown(document.getElementById("int_county"),"county");
        clearDropdown(document.getElementById("int_town"),"town");
    }
    
    // Need to special case a selection of 'UK'
    if ( datasource == "country") {
        if ( id == 2 ) {
            document.getElementById("uksearch").style.display="block";
            document.getElementById("townsearch").style.display="none";
        } else {
            document.getElementById("uksearch").style.display="none";
            document.getElementById("townsearch").style.display="block";
        }
        clearDropdown(document.getElementById("int_region"),"region");
        clearDropdown(document.getElementById("int_county"),"county");
        clearDropdown(document.getElementById("int_town"),"town");
    }
                    
    if ( datasource == "region") {
        clearDropdown(document.getElementById("int_county"),"county");
        clearDropdown(document.getElementById("int_town"),"town");
    }

    if ( datasource == "county") {
        clearDropdown(document.getElementById("int_town"),"town");
    }

    initDrop(datasource);
    url = "AJAXServer?module=search&view=" + datasource + "&keycol=" + keyname + "&keyid=" + id;
    ajaxLink(url);
}

function divisionDisciplines(listObj)
{
    var division = listObj.options[listObj.selectedIndex].value;
    divisionDisciplinesById(division);
}

function divisionDisciplinesById(division)
{
    var Environment = new Array("All Disciplines","",
                                "Contaminated Land/Remediation","",
                                "EIA/SEA/Landscape","",
                                "Ecology","",
                                "Water Management","",
                                "Air Pollution/Quality","",
                                "Noise/Vibration/Acoustics","",
                                "Corporate Environment","",
                                "Sustainability","",
                                "Human Health","",
                                "Other","ENV: Other",
                                "Waste","ENV: Waste",
				"Marine","ENV: Marine",
                                "Auditing, Compliance & Due Diligence","",
                                "Economics","",
                                "Overseas","",
                                "Environment Sales/BD","",
                                "EMS","",
                                "Policy & Legislation/IPC","",
                                "CSR","");
                            
    var Planning = new Array("All Disciplines","",
                                "Design - Architecture","",
                                "Design - Landscape Architecture","",
                                "Design - Urban Design","",
                                "Planning - Graduate","", 
                                "Planning - Regeneration","",
                                "Planning - Town & Country","",
                                "Planning - Transport Planning","",
                                "Planning - Public Sector","", 
                                "Private Sector","",
                                "Public Sector","", 
                                "Surveying - Building","",
                                "Surveying - General Practice","",
                                "Surveying - Project Management & Facilities","",
                                "Surveying - Quantity","",
                                "Surveying - Rural","",
                                "Surveying - Facilities Management","",
                                "Temporary or Contract","",
                                "Other Built Environment","");
                        
    var Health = new Array("All Disciplines","",
                                "Corporate HSE", "",
                                "Occupational Health & Hygiene","", 
                                "Other Health & Safety","",
                                "Quality Assurance/Systems","", 
                                "Construction HSE","",
				"Oil & Gas", "H&S: Oil & Gas",
                                "Rail","H&S: Rail");
                        
    var Energy = new Array("All Disciplines","",
                                "Carbon","",
                                "Climate Change","",
                                "Energy Management","",
                                "Wind","",
                                "Micro-renewables","",
                                "Bioenergy & EfW","",
                                "Marine","",
                                "Solar","",
                                "Heat & Power","",
                                "Policy","Energy: Policy",
                                "Energy General/Sales","",
                                "Finance","",
                                "Nuclear","",
                                "Oil & Gas","Energy: Oil & Gas", 
                                "Utilities","",
                                "Energy Buildings","",
				"CDM/JI","",
                                "Dir/Exec","");
                            
    var Waste = new Array("All Disciplines","",
                                "Minimisation","",
                                "Solid Waste Disposal / Treatment","",
                                "Planning","Waste: Planning", 
                                "Corporate Waste Management","", 
                                "Sales","Waste: Sales",
                                "Waste Water Management","",
                                "IPPC and Waste Licensing","", 
                                "Collection and Street Cleansing","", 
                                "Engineering","",
                                "Recycling","",
                                "Landfill","",
                                "Transfer","",
                                "Operations","",
                                "Other Waste","",
                                "Waste Consultancy","");
    
    
    var Engineering = new Array("All Disciplines","",
    				"Bridge","", 
    				"Building Services","", 
                                "Civil","",
                                "Design","", 
                                "Electrical","",
                                "Geotechnical","",
                                "Infrastructure","",
                                "Mechanical","",
                                "Other","Engineering: Other",
                                "Power & Energy","",
                                "Process & Chemical","",
                                "Project Management","", 
                                "Rail","Engineering: Rail", 
                                "Structural","", 
                                "Transportation","", 
                                "Tunnelling","", 
                                "Water & Wastewater","");
                            
    var CPS = new Array("All Disciplines","",
                                "Charity & Public Sector","");

	var Science = new Array("All disciplines", "",
				"Business Development","",
				"Clinical Application Support","",
				"Clinical Research Phase I","",
				"Clinical Research Phase II & III","",
				"Contracts/Legal","",
				"Data Management","",
				"Feasability","",
				"Laboratory","",
				"Medical Safety","",
				"Non-Clinical General","",
				"Post Marketing/Phase IV","",
				"Proposals","",
				"Quality Assurance","",
				"Regulatory/Submissions","",
				"Resource Management","",
				"R&D","",
				"Statistics/SAS","",
				"Training",""
				);

                                
    var All = new Array("All Disciplines","");
    
    
    var disciplineList = document.getElementById("discipline");
    
    if ( division == 1 ) {
        populateDisciplines(disciplineList,Environment);
    }
    
    if ( division == 2 ) {
        populateDisciplines(disciplineList,Health);
    }
    
    if ( division == 3 ) {
        populateDisciplines(disciplineList,Planning);
    }
    
    if ( division == 4 ) {
        populateDisciplines(disciplineList,Energy);
    }

    if ( division == 5 ) {
        populateDisciplines(disciplineList,Engineering);
    }

    if ( division == 6 ) {
        populateDisciplines(disciplineList,Waste);
    }

    if ( division == 7 ) {
        populateDisciplines(disciplineList,CPS);
    }

	if ( division == 8 ) {
		populateDisciplines(disciplineList,Science);
	}
    
    if ( division == -1 ) {
        populateDisciplines(disciplineList,All);
    }
}
function addOption(selectbox,text,value )
{
    var optn = document.createElement("option");
    optn.text = text;
    if ( value == "" ) {
        value = text;
    }
    optn.value = value;
    selectbox.options.add(optn);
}

function removeAllOptions(selectbox)
{
    var i;
    for(i=selectbox.options.length-1;i>=0;i--)
    {
        selectbox.remove(i);
    }
}

function populateDisciplines(disciplineList, disciplines)
{
    removeAllOptions(disciplineList);
    
    for (loop=0; loop < disciplines.length; loop+=2)    {
        addOption(disciplineList,disciplines[loop],disciplines[loop+1]);
    }
}

function displayXML2(response,target,selected) {   
    var customers = response.getElementsByTagName('item');
    if (target == "area2")
    {
        var obj = document.getElementById("int_area2");
        obj.options.length = 0;
        appendOptionLast(obj,"Every region",-1);
    }
    else if (target == "county2")
    {
        var obj = document.getElementById("int_country2");
        obj.options.length = 0;
        appendOptionLast(obj,"Every county",-1);
    }
    else
    {
        var obj = document.getElementById("int_country2");
        obj.options.length = 0;
        appendOptionLast(obj,"Every location",-1);
    }

    for(var i=0; i<customers.length; i++) {                                             
        var d_selected = false;
        var itemName = customers[i].getElementsByTagName('name')[0].childNodes[0].nodeValue;
        var itemID = customers[i].getElementsByTagName('id')[0].childNodes[0].nodeValue;
        if (selected == itemID) d_selected = true;
        appendOptionLast(obj,itemName,itemID,d_selected);
    }
}

function ajaxLink2(url, selected) {
    var httpRequest;
    url = httpBase + url;
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        httpRequest = new XMLHttpRequest();
        if (httpRequest.overrideMimeType) {
            httpRequest.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    httpRequest.open ('GET', url, true);
    httpRequest.onreadystatechange = function() {
        if (httpRequest.readyState == 4) {
            if ( httpRequest.status == 200 ) {
                var xmlDoc2;
                if(window.ActiveXObject){ // If IE Windows
                    xmlDoc2 = new ActiveXObject("Microsoft.XMLDOM");
                    xmlDoc2.loadXML(httpRequest.responseText);
                } else {
                    xmlDoc2 = httpRequest.responseXML;
                }               
                if (url.indexOf("view=area") > -1)
                    displayXML2(httpRequest.responseXML,"area2", selected);
                else if (url.indexOf("view=ukcounties") > -1)
                    displayXML2(httpRequest.responseXML,"county2", selected);
                else             
                    displayXML2(httpRequest.responseXML,"country2", selected);

            } else {
                alert("Error : " + httpRequest.status);
            }
        } else {
            // document.getElementById("infoPane").innerHTML = "Loading...";                    
        }
    };
    
    httpRequest.send (null);

}

function populateDropdownHome() {
    var obj = document.getElementById("int_area2");
    var id = obj.options[obj.selectedIndex].value;        
    initDrop("country2");
    if (id == 2)
        url = "AJAXServer?module=search&view=ukcounties&keycol=country&keyid=1";
    else
        url = "AJAXServer?module=search&view=country&keycol=area&keyid=" + id;
    ajaxLink2(url);
}

function submitSearch(id) {
    var obj = document.getElementById("int_country2");
    var w = obj.selectedIndex;
    var selected_cur = obj.options[w].text;
    document.getElementById("t_country2").value = selected_cur;
    document.getElementById(id).submit();
    return false;
}


function populateSearch()
{
	document.getElementById("keywords").value = "";
	setSelectedItem(document.getElementById('group'),'');
	divisionDisciplines(document.getElementById('group')); // Not an AJAX call, so runs synchronously
	setSelectedItem(document.getElementById('discipline'),'');
	setSelectedItem(document.getElementById('int_area'),'0');
	setSelectedItem(document.getElementById('int_country'),'0');
	setSelectedItem(document.getElementById('int_region'),'0');
	setSelectedItem(document.getElementById('int_county'),'0');
	document.getElementById("postcode").value = "";
	document.getElementById("minSalary").value = "0";
	setSelectedItem(document.getElementById('positionType'),'');
	setSelectedItem(document.getElementById('distance'),'0');
	setSelectedItem(document.getElementById('int_currency'),'0');
}

function login()
{
	alert('You must be logged in to use this feature');
}
