function clickedColor(rgb) {
    changeColor(rgb);
}

function clickedColor2(rgb) {
    changeColor2(rgb);
}

function unclickColor(type) {
    var url = '/colorsearch'
    var type = getType();
    if (type != '') { url += '?type=' + type; }
    visit(url);
}

function changeColor(rgb) {
    var url = '/colorsearch?rgb=' + rgb;
    var type = getType();
    if (type != '') { url += '&type=' + type; }
    visit(url);
}

function changeColor2(rgb2) {
    var url = '/colorsearch?rgb=' + getRgb();
    url += '&rgb2=' + rgb2;
    var type = getType();
    if (type != '') { url += '&type=' + type; }
    visit(url);
}

function getRgb() {
    var rgb = '';
    var elm = document.getElementById('selected');
    if (elm) { rgb = elm.title; }
    return rgb;
}

function visit(url) {
    document.location.href = url;
}

function getType() {
    var elm = document.getElementById('type');
    return elm.value;
}

function selectChange() {
    var elm = document.getElementById('selected');
    if (elm) { changeColor(elm.title ); }
}
