d = document;
var opera = Boolean(window["opera"]);
var MSIE = (navigator.userAgent.indexOf("MSIE") != -1) && !opera;

function set_ch(src) {
    // empty function
}

function set_sel(id) {
    if (MSIE) {document.fl.SetVariable('ch_flag2', id)} else {document['f2'].SetVariable('ch_flag2', id)};
    return false;
}

function dis(src) {
    for (var i=0; i<src.length; i++) {
        if (src[i] != 2) {
            d.getElementById("d"+i).className = (src[i] == 0) ? 'd' : '';
            d.getElementById("mapchk"+i).disabled = (src[i] == 0) ? true : false;
        }
    }
}

function goSearch() {
    var sbox = d.getElementById('search_response');
    sbox.style.display = '';
    sbox.innerHTML = '<img src=/images/mapicons/indicator.white.gif border=0>';
    var sstring = d.getElementById('searchstring');
    $("#search_response").load("/map/search", {s: sstring.value});
}

function set_link(src) {
    document.getElementById("link").innerHTML='<a id="linka" href="http://'+location.hostname+location.pathname+src+'">http://'+location.hostname+location.pathname+src+'</a>';
    //document.getElementById("linkinput").value='http://'+location.hostname+location.pathname+src;
}

function setSearch(s) {
    var sstring = d.getElementById('searchstring');
    sstring.value = s;
    goSearch();
}

function copy2clip(text2copy) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="/images/_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}