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 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';
  }
} 

var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
var tempX = 0
var tempY = 0
document.onmousemove = getMouseXY;

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
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  return true;
}

function mouseMoving(){
   if(pokazGal){
     document.getElementById('comunicatReady').style.left = tempX+7+'px';
     document.getElementById('comunicatReady').style.top = (tempY-65)+'px';
     setTimeout('mouseMoving()', 10);
   }
}

function showComunicat(ev){
  //comunicatReady
  document.getElementById('comunicatReady').style.display = "block";
  pokazGal = true;
  setTimeout('mouseMoving()', 10);
}

function hideComunicat(){
  //comunicatReady
  document.getElementById('comunicatReady').style.display = "none";
}

function getY( oElement )
{
  var iReturnValue = 0;
  while( oElement != null ) {
  iReturnValue += oElement.offsetTop;
  oElement = oElement.offsetParent;
  }
  return iReturnValue;
}

function getX( oElement )
{
  var iReturnValue = 0;
  while( oElement != null ) {
  iReturnValue += oElement.offsetLeft;
  oElement = oElement.offsetParent;
  }
  return iReturnValue;
}
