function imgOn(source, id) {
  document.getElementById(id).src=source;
}

function imgOff(source, id) {
  document.getElementById(id).src=source;
}

function bookmark(url, description) {
  var netscape="Tryck först på OK och sedan på CTRL+D for att lägga till 118110.se bland dina bokmärken.";

  if (navigator.appName=='Microsoft Internet Explorer') {
    window.external.AddFavorite(url, description);
  }
  else if (navigator.appName=='Netscape') {
    alert(netscape);
  }
}

/* Return a mail address link for the recepient at 118110.se */
function mailLink (recipient)
{
  var addr = recipient  + "@" + "118110.se";
  return "<a href=\"mailto:" + addr +"\">" + addr + "</a>";
}

/* Return a mail address link for the recepient at given domain */
function mailLinkExtern (recipient, domain)
{
  var addr = recipient  + "@" + domain;
  return "<a href=\"mailto:" + addr +"\">" + addr + "</a>";
}

/* Set the visibility property of the given element name to 'hidden' */
function hideElement (elemId)
{
    if (document.getElementById)
        document.getElementById (elemId).style.visibility = "hidden";
    else if (document.all)
        document.all[elemId].style.visibility = 'hidden';
    else if (document.layers && document.layers[elemId])
        document.layers[elemId].visibility = 'hidden';
}

/* Set the visibility property of the given element name to 'visible' */
function showElement (elemId)
{
    if (document.getElementById)
        document.getElementById (elemId).style.visibility = "visible";
    else if (document.all)
        document.all[elemId].style.visibility = 'visible';
    else if (document.layers && document.layers[elemId])
        document.layers[elemId].visibility = 'visible';
}

function validateEventSearch(form)
{
    if (form.region.value < 1) {
        alert("Välj först vilken stad du vill söka i!");
        return false;
    }
    return true;
}

/* Open window displaying picture */
function showImage (type, image)
{
    height = 800;

    if (type == 'album') {
        width      = 1000;
        windowName = 'PhotoViewer';
    }
    else {
        width = 750;
        windowName = 'ImageViewer';
    }

    openWindow('show_image.php?' + type + '=' + image,
               windowName,
               'height=' + height + ',width=' + width + 
               ',scrollbars=yes,resizable=yes');
}

