/*
  PFrameworkCS API
  
  Copyright (C) 2004 by Jernej Kos <kostko@jweb-network.net>
  Copyright (C) 2008 by Gregor Kališnik <gregor@unimatrix-one.org>
  Copyright (C) 2004 by Unimatrix-One (www.unimatrix-one.org)
  
  This javascript is part of the PFramework CMS system. Any unauthorised
  use outside of this system is strictly prohibited.
*/

function getObj(name)
{
  if (document.getElementById) {
    this.obj = document.getElementById(name);
    
    if (!this.obj)
      return;
      
    this.style = document.getElementById(name).style;
  } else if (document.all) {
    this.obj = document.all[name];
    
    if (!this.obj)
      return;
    
    this.style = document.all[name].style;
  } else if (document.layers) {
    this.obj = document.layers[name];
    this.style = document.layers[name];
  }
}

function getObjPosY(obj)
{
  var curtop = 0;
  
  if (obj.offsetParent) {
    while (obj.offsetParent) {
      curtop += obj.offsetTop
      obj = obj.offsetParent;
    }
  } else if (obj.y) {
    curtop += obj.y;
  }
  
  return curtop;
}

function getQueryVariable(variable)
{
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  
  return "";
}

function openPage(href)
{
  location.href = href;
}
