
function create_mailto(mailto, address, link) {
  if (link == undefined)
    link = mailto + "@" + address;
  
  document.write("<a href=\"mailto:" + mailto + "@" + address + "\">" + link + "</a>");  
}


function toggleLayer(layerName) {
  if (document.getElementById(layerName).style.display=="none")
    document.getElementById(layerName).style.display="inline";
  else
    document.getElementById(layerName).style.display="none";
}   

function changeTextareaSize(layerName, incVal) {  
  lastVal = parseInt(document.getElementById(layerName).style.height);
  document.getElementById(layerName).style.height = lastVal + incVal;
  return true;
}

function hilite(layerName, colorVal) {
  document.getElementById(layerName).style.backgroundColor=colorVal; 
}

function setClass(layerName, newClassName) {
  document.getElementById(layerName).className = newClassName;
}

function setTextareaSize(layerName, setVal) {    
  document.getElementById(layerName).style.height = setVal;
  return true;
}

function nWin(winUrl,winWidth,winHeight) {    
  height=screen.height/2-winHeight/2;
  width=screen.width/2-winWidth/2;
  window.open (winUrl,"_BLANK","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,top=0,left=0,height="+winHeight+",width="+winWidth+",top="+height+",left="+width)
}

// ToolTip

// --------------------------------------- Hiiren roskat
// Hakee hiiren X ja Y koordinaatit globaaleihin
// tempX ja tempY muuttujiin

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  
  return true;
}

// ----------------------------------------- end of Hiiren roskat

function showToolTip(layerName) {

  document.getElementById(layerName).style.left= tempX;
  document.getElementById(layerName).style.top= tempY;
  document.getElementById(layerName).style.display= "inline";
}

function hideToolTip(layerName) {

  document.getElementById(layerName).style.display= "none";       
} 


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/* RAVINTOLA-ARVOSTELUT */

function arvioi(luku) {
  if (luku==1) {
    document.images['eka'].src="images/star.gif";
  }
  if (luku==2) {
      document.images['eka'].src="images/star.gif";
      document.images['toka'].src="images/star.gif";
  }
  if (luku==3) {
        document.images['eka'].src="images/star.gif";
        document.images['toka'].src="images/star.gif";
        document.images['kolmas'].src="images/star.gif";
  }
if (luku==4) {
        document.images['eka'].src="images/star.gif";
        document.images['toka'].src="images/star.gif";
        document.images['kolmas'].src="images/star.gif";
        document.images['neljas'].src="images/star.gif";
  }
  if (luku==5) {
          document.images['eka'].src="images/star.gif";
          document.images['toka'].src="images/star.gif";
          document.images['kolmas'].src="images/star.gif";
          document.images['neljas'].src="images/star.gif";
          document.images['viides'].src="images/star.gif";
  }
}
function clearall() {
  document.images['eka'].src="images/star-emp.gif";
  document.images['toka'].src="images/star-emp.gif";
  document.images['kolmas'].src="images/star-emp.gif";
  document.images['neljas'].src="images/star-emp.gif";
  document.images['viides'].src="images/star-emp.gif";
}