
function DHTML_API()
{

	//set browser type and platform
	this.ie4 = (document.all && !document.getElementById) ? true : false;
	this.ie5 = (document.all && document.getElementById) ? true: false;
	this.ne4 = (document.layers) ? true : false;
	this.ne6 = (document.getElementById && !document.all) ? true : false;

    //layer positioning
    this.moveLayerY = DHTML_API_moveLayerY;
    this.moveLayerX = DHTML_API_moveLayerX;
    
    //properties
    this.getLayerWidth = DHTML_API_getLayerWidth;
    this.getLayerHeight = DHTML_API_getLayerHeight;
    this.getLayerX = DHTML_API_getLayerX;
    this.getLayerY = DHTML_API_getLayerY;
   
    //layer state
    this.showLayer = DHTML_API_showLayer;
    this.hideLayer = DHTML_API_hideLayer;
    this.isVisible = DHTML_API_isVisible;
	this.layerExists = DHTML_API_layerExists;

    //windows
    this.openWindow = DHTML_API_openWindow;
    this.fixResize = DHTML_API_fixResize;
    
    //mouse coords
    this.getMouseX = DHTML_API_getMouseX;
    this.getMouseY = DHTML_API_getMouseY;
    
}


function DHTML_API_openWindow(theUrl, name, width, heigth)
{
  window.open(theUrl,name,'width=' + width + ',height=' + heigth + ',leftmargin="350",topmargin="400",marginwidth="0",marginheight="0",scrollbars=no,menubar=no,status=no,resizable=no')
}


function DHTML_API_isVisible(lId)
{
	if(this.ie4)
    	return ((document.all[lId].style.visibility == "visible") ? true : false);
  	else if(this.ie5)
    	return ((document.getElementById(lId).style.visibility == "visible") ? true : false);
 	 else if(this.ne4)
    	return ((document.layers[lId].visibility == "visible") ? true : false );
  	else if(this.ne6)
    	return ((document.getElementById(lId).style.visibility == "visible") ? true : false);
}


function DHTML_API_showLayer(lId)
{
  	if(this.ie4)
  		document.all[lId].style.visibility = "visible";
  	else if(this.ie5)
  		document.getElementById(lId).style.visibility = "visible";
 	 else if(this.ne4)
  		document.layers[lId].visibility = "show";
 	 else if(this.ne6)
  		document.getElementById(lId).style.visibility = "visible";
}

function DHTML_API_hideLayer(lId)
{
  	if(this.ie4)
  		document.all[lId].style.visibility = "hidden";
  	else if(this.ie5)
  		document.getElementById(lId).style.visibility = "hidden";
  	else if(this.ne4)
  		document.layers[lId].visibility = "hidden";
  	else if(this.ne6)
  		document.getElementById(lId).style.visibility = "hidden";
}

function DHTML_API_moveLayerY(lId, y)
{

  if(this.ie4)document.all[lId].style.top = y;
  else if(this.ie5 || this.ne6) 
  	document.getElementById(lId).style.top = y
  else if(this.ne4){}
}

function DHTML_API_moveLayerX(lId, x)
{
	//alert(x)
  	if(this.ie4)
  		document[lId].style.left = x;
  	else if(this.ie5 || this.ne6)
  		document.getElementById(lId).style.left = x;
  	else if(this.ne4)
  		document.layers[lId].left = x;
}

function DHTML_API_getLayerWidth(lId)
{
	if(this.ie4)
  		return document.all[lId].offsetWidth;
	else if(this.ie5 || this.ne6)
  		return document.getElementById(lId).offsetWidth;
  	else if(this.ne4)
  		return document[lId].clip.right;
}
        
function DHTML_API_getLayerHeight(lId)
{
	if(this.ie4)
		return document.all[lId].offsetHeight;
	else if(this.ie5 || this.ne6)
		return document.getElementById(lId).offsetHeight;
	else if(this.ne4)
		return document[lId].clip.bottom;
}

function DHTML_API_getLayerX(lId)
{
	if(this.ie4)
		return parseInt(document[lId].style.left);
	else if(this.ie5 || this.ne6)
		return parseInt(document.getElementById(lId).offsetLeft);
	else if(this.ne4)
		return document[lId].left;
}

function DHTML_API_getLayerY(lId)
{
	if(this.ie4)
		return parseInt(document[lId].style.top);
	else if(this.ie5 || this.ne6)
		return parseInt(document.getElementById(lId).offsetTop);
  	else if(this.ne4)
  		return document[lId].top
}

function DHTML_API_layerExists(lId)
{
	if(this.ie4)
		return "";
	else if(this.ie5 || this.ne6)
		return (document.getElementById(lId) ==  null) ? false : true;
  	else if(this.ne4)
  		return "";
}

function DHTML_API_getMouseX(e)
{
	if(this.ie4 || this.ie5)
		return event.clientX;
  	else if(this.ne4 || this.ne6)
  		return e.pageX;
}

function DHTML_API_getMouseY(e)
{
	if(this.ie4 || this.ie5)
		return event.clientY;
  	else if(this.ne4 || this.ne6)
  		return e.pageY;
}

function DHTML_API_fixResize()
{
	window.location.reload();
}

//------
// INIT
//------

var dhtml = new DHTML_API();

//just in case..
//function stopError(){
//  return true;
//}

//window.onerror = stopError;


