function contentfit()
{
  if(window.navigator.userAgent.search("MSIE") != -1)
  {
    document.getElementById("content").style.height = parseFloat(document.body.offsetHeight-189)+"px";
  }
  else
  {
    document.getElementById("content").style.height = parseFloat(window.innerHeight-200)+"px";
  }
}

function clearcont(fieldid)
{
  document.getElementById(fieldid).innerHTML = '&nbsp;';
}

function addcont(fieldid,string)
{
  document.getElementById(fieldid).innerHTML = '';
  document.getElementById(fieldid).innerHTML = string;
}

function news_switch(thisid,new_content)
{
  for(i=0;i<=3;i+=1)
  {
    objid = "new_"+i;
    document.getElementById(objid).className = "newstop_inactive";
  }
  thisid.className = 'newstop_active';
  document.getElementById('curnews').innerHTML = new_content;
}

function expand(eid)
{
  obj = document.getElementById(eid);
  if(obj.style.display == 'none')
  {
    obj.style.display = 'block';
  }
  else   
  {
    obj.style.display = 'none';
  }
}


function guestbook_form_focus(element_id,default_value)
{
  obj = document.getElementById(element_id);
  if(obj.value == default_value || obj.innerHTML == default_value)
  {
    obj.value = '';
    obj.style.color = 'black';
  }
}

function guestbook_form_blur(element_id,default_value)
{
  obj = document.getElementById(element_id);
  if(obj.value == '')
  {
    obj.value = default_value;
    obj.style.color = 'darkgray';
  }
}

function popup_window_fit()
{
  newheight = self.document.body.clientHeight+54;
  if(newheight >> 500){newheight = 500;}
  window.resizeTo(400,newheight);
}

function loader(whereToShow,small)
{
  add = "";
  if(small) add = "?small=1";
  new Ajax.Updater(whereToShow, "js/ajax/loader.php"+add);
}

function isNumberKey(evt)
{
  var charCode = (evt.which) ? evt.which : evt.keyCode
  if (charCode > 31 && (charCode < 48 || charCode > 57))
    return false;
  
  return true;
}