function openWindow(link) // inspired by porneL - http://pornel.net/pups/
{
  try
  {
    var new_window = window.open(link, '_blank');
    if(new_window) return false;
  }
  catch(e){}
  return true;
}

function bgSize() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //inne niż IE
    myHeight = window.innerHeight - 15;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ i podobne
    myHeight = document.documentElement.clientHeight - 15;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 i podobne
    myHeight = document.body.clientHeight - 15;
  }
  
  document.getElementById('dom-kolping-intro-bg').style.height=myHeight+'px';
}

function checkRequiredFields(form_id)
{
  ok = true;
  fields = document.getElementsByTagName('input');
  for(var i in fields) if(fields[i].className=='text required')
  {
    if(fields[i].parentNode.parentNode.parentNode.id==form_id && !fields[i].value) ok = false;
  }
  fields = document.getElementsByTagName('textarea');
  for(var i in fields) if(fields[i].className=='required')
  {
    if(fields[i].parentNode.parentNode.parentNode.id==form_id && !fields[i].value) ok = false;
  }
  if(ok)
  {
    //document.getElementById('submit_'+form_id).disabled = 'disabled';
    return true;
  }
  alert('You have to fill all the required fields (marked with asterisk).');
  return false;
}


function addMenuHover()
{
  m = document.getElementsByTagName('li');
  for(var i in m) if(m[i].innerHTML && m[i].parentNode.parentNode.id=='header' && m[i].className=='dd')
  {
    id = m[i].id;
    m[i].onmouseover = function()
    {
      document.getElementById('s'+id).style.display = 'block';
    }
    m[i].onmouseout = function()
    {
      document.getElementById('s'+id).style.display = 'none';
    }
  }
}

onload = function()
{
  a = document.getElementsByTagName('a');
  for(var i in a) if(a[i].innerHTML && (a[i].className=='nw' || a[i].className=='photo nw'))
  {
    a[i].target = '_blank';
  }
}
