function sayit()
{ if (window.getSelection) // recent Mozilla versions
{ var selectedString = window.getSelection(); }
else if (document.all) // MSIE 4+
{ rng = document.selection.createRange(); selectedString=rng.text; }
else if (document.getSelection) //older Mozilla versions
{ var selectedString = document.getSelection(); }
document.rs_form.rstext.value = selectedString;
document.rs_form.url.value = document.location.href; }

function ns_css() 
{
  if ((navigator.appName.indexOf("scape") != -1) && 
      parseFloat(navigator.appVersion)<5) {
    document.write('<link rel="stylesheet" type="text/css" media="screen" href=');
    document.write('"/css/ns_isvcss.css"'); 
    document.write(' />');
  }
}

// name - name of the cookie
// value - value of the cookie
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value)+
    ((expires) ? "; expires=" + expires.toGMTString() : "")+
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var prefix = name + "=";
  var cookieStartIndex = document.cookie.indexOf(prefix);
  if (cookieStartIndex == -1)
    return null;
  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
  if (cookieEndIndex == -1)
    cookieEndIndex = document.cookie.length;
  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function chooseColor(value)
{
  if(navigator.cookieEnabled){
    var exptime = new Date();
    exptime.setTime(exptime.getTime() + 31 * 24 * 60 * 60 * 1000);
    setCookie("isvmenucolor", value, exptime,"/");
    //    document.body.style.class=value;
    location.reload();
  }
  else
    confirm("Please enable cookies to change menu colour");
  return;
}

function createPopup(choose,red,grey,white)
{
  if ((navigator.appName.indexOf("scape") != -1) && 
      parseFloat(navigator.appVersion)<5) {
    return false;
  }
  if(navigator.cookieEnabled){
    var color = getCookie("isvmenucolor");
    if (!color) color="red";
    document.write("<div class=\"colpopup\">");
    document.write(choose);
//     if (color!="red")
//       document.write("<img src=\"/img/redbutton.gif\" onClick=chooseColor(\"red\")>&nbsp;");
//     if (color!="grey")
//       document.write("<img src=\"/img/greybutton.gif\" onClick=chooseColor(\"grey\")>&nbsp;");
//     if (color!="white")
//       document.write("<img src=\"/img/whitebutton.gif\" onClick=chooseColor(\"white\")>");
    document.write("<form name=\"test\">");
    document.write("<select name=color onchange=chooseColor(document.test.color.value)>");
    document.write("<option value=\"red\"");
    if(color=="red") document.write(" selected");
    document.write(">"+red);
    document.write("<option value=\"grey\"");
    if(color=="grey") document.write(" selected");
    document.write(">"+grey);
    document.write("<option value=\"white\"");
    if(color=="white") document.write(" selected");
    document.write(">"+white);
    document.write("</select>");
    document.write("</form>");
    document.write("</div>");
  }
  else {
    document.write("<div class=\"colpopup\">");
    document.write("Enable cookies to change menu color");
    document.write("</div>");
  }
  return true;
}

function put_color() {
  if(navigator.cookieEnabled){
    var color = getCookie("isvmenucolor");
    if (!color) color="red";
  }
  else color="red";
  document.body.id=color;
}

function change(id) {
  if (document.getElementById(id).style.display=="block") {
    document.getElementById(id).style.display="none";
  } else {
    document.getElementById(id).style.display="block";
  }
}

