// JavaScripts for Meda.se (below)
// (c) 2007-11-01 by Charlie Elgholm @ All Ready Solutions AB

function printMe(url)
{
  var pw=window.open(url+"?print=1", "winPrint", "toolbar=yes,scrollbars=yes,resizable=yes,height=600,width=735");
  if(!pw){
    alert(i18n.unable_to_open_print_window);
    return;
  }
  pw.focus();
}

function initPage()
{
  var sf=document.getElementById("frmSearchField");
  if(sf){
    if(sf.value=="" || sf.value==i18n.write_searchwords_here){
      sf.value=i18n.write_searchwords_here;
      sf.style.color="#999999";
      if(document.attachEvent){
      sf.attachEvent("onfocus", function(){
        if(sf.value==i18n.write_searchwords_here){
          sf.value="";
          sf.style.color="";
        }
      });
      }
    }
  }
}

function checkTopSearchField()
{
  var sf=document.getElementById("frmSearchField");
  if(sf){
    if(sf.value=="" || sf.value==i18n.write_searchwords_here){
      alert(i18n.must_write_searchwords);
      return false;
    }
  }
  return true;
}

function openWin(url, width, height)
{
  var w=window.open(url, "EssWindow", "toolbar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height);
  if(w){
    w.focus();
  }else{
    alert(i18n.unable_to_open_window);
  }
}

function scrollTo(obj){
  if(typeof(obj)=="string") obj=document.getElementById(obj);
  if(!obj) return;
  obj.scrollIntoView(true);
}

