function closewindow()
{
	if( window.opener )
	{
		window.opener.focus();
		window.close();
	}
}

function openwindow( url, wleft, wtop, wwidth, wheight, wname, wprop )
{
	if( wheight > screen.availHeight-75 || wheight == 0 )
		wheight = screen.availHeight-75;
	if( wwidth > screen.availWidth || wwidth == 0 )
		wwidth = screen.availWidth;
	
	if( wleft < 0 )
		wleft = screen.availWidth - wwidth + wleft + 1;
	if( wtop < 0 )
		wtop = screen.availHeight - 75 - wheight + wtop + 1;
	
	wprop = wprop + (wprop.length>0?',':'')
				+'width='+wwidth+',height='+wheight+',left='+wleft+',top='+wtop+',screenX='+wleft+',screenY='+wtop+'';
	wnd = open(url, wname, wprop);
	return wnd;
}

// Accepts a variable number of arguments, in triplets as follows:
// arg 1: object ( use findObj for get it )
// arg 2: 'hide' or 'show'
// repeat...
//
// Example: showHideLayers(Layer1,'show',Layer2,'hide');
function showhideLayers()
{ 
	var i, visStr, obj, args = showhideLayers.arguments;
	for (i=0; i<(args.length-1); i+=2)
	{
		obj = args[i];
		visStr = args[i+1];
		if (obj.style)
		{
			obj = obj.style;
			if(visStr == 'show') visStr = 'visible';
			else if(visStr == 'hide') visStr = 'hidden';
		}
		obj.visibility = visStr;
	}
}

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


// arg 1: object ( use findObj for get it )
// arg 2: X coord - use null for don't change X
// arg 3: Y coord - use null for don't change Y
//
// Example: moveLayerTo( Layer1, 50, 200);
function moveLayerTo( obj, x, y )
{

  if (document.all)//IE
  {
		if( x != null )
      obj.style.pixelLeft = x;
		if( y != null )
      obj.style.pixelTop = y;
	}
	else if (document.layers)  //NS
	{
		if( x != null )
      obj.left = x;
		if( y != null )
      obj.top = y;
	}
	else if ( document.getElementById )
	{
		if( x != null )
      obj.style.left = x + 'px';
		if( y != null )
      obj.style.top = y + 'px';
  }

}

function getObjPos( obj )
{
	if ( document.layers )  //NS
	{
		x = obj.pageX;
		y = obj.pageY;
  }
  else
  { //other browsers
    x=0; y=0; var temp;

    if(obj.offsetParent)
    {
      temp = obj;
      while(temp.offsetParent)
      { //Looping parent elements to get the offset of them as well
        temp=temp.offsetParent; 
        x+=temp.offsetLeft;
        y+=temp.offsetTop;
      }
    }
    x+=obj.offsetLeft;
    y+=obj.offsetTop;
  }
  //Returning the x and y as an array
  return [x,y];
}

function dispEMAddr(user, host)
{
	var symb = '@';
	document.write('<a href="mail'+''+'to:'+user+symb+host+'">'+user+symb+host+'</a>');
}