//A collection of utilities from quirksmode.org
//A boolean that lets you know if basic DHTML can be used...
var DHTML = (document.getElementById || document.all || document.layers);

//The variable that will hold the popup window...
var popupwindow = '';
// Remember params MUST END with a comma; 
function popitup(url,x,y,params)
{
	if (!popupwindow.closed && popupwindow.location)
	{
		//popupwindow.location.href = url;
		popupwindow.close();
		popupwindow=window.open(url,'name',params+'height='+y+',width='+x);
	}
	else
	{
		popupwindow=window.open(url,'name',params+'height='+y+',width='+x);
		if (!popupwindow.opener) popupwindow.opener = self;
	}
	if (popupwindow.focus) {popupwindow.focus();}
	return false;
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
        if (this.obj==null) return null;
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
        if ((this.obj)==null) return null;
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

/////////////////
/////////////////
// EWORX UTILS///
/////////////////
/////////////////

//*******************************************************************  
// author: netlich
// created: 14/07/2005
//
// This function checks whether this is the first time the user
// clicks on the textField and if so selects all text!
//
// Any object that is to use this function must call it by:
//  onclick="selectAllFirstTime(this);"
//*******************************************************************
function selectAllFirstTime(obj){
    //Chekc if it is an acceptable component
    if (obj.type=="text" || obj.type=="password"){
        if (!obj.getAttribute("firstTimeSelect")){
            obj.setAttribute("firstTimeSelect","YES!");
            obj.select();
        }
    }else {
        alert ("DEBUG : This HTML object ("+obj.type+") is not supported by the selectAllFirstTime function!");
    }
}
//*******************************************************************
