if(document.jsDebugScripts>0) jsDebugWrite('loaded :/NR/Yintranet04/scripts/dom.js');
//----------------------------------------------------------------------------------------
// Last Modified:	
//					Laszlo Albert	2002.06.11
//					Laszlo Albert	2004.08.19	// create the getElementById function
//					Laszlo Albert	2005.01.21	// add position functions
//----------------------------------------------------------------------------------------
if(document.all && !document.getElementById) {
    document.getElementById = function(id) { return document.all[id]; } // create the getElementById function
}
//****************************************************************************************
//   MOVE, POSITIONING
//**************************************************************************************** 

function movetoTopRight(vobj,dX) {
	if (typeof(dX)=="undefined") dX=0;
	vobj.setLeft(objBrowser.getMaxX() - vobj.width() - dX);
	vobj.setTop (objBrowser.getMinY() + 5);
	vobj.setVisibility ("visible");
}

function movetoBottomRight(vobj) {
	vobj.setLeft(objBrowser.getMaxX() - vobj.width());
	vobj.setTop(objBrowser.getMaxY() - vobj.height());
	vobj.setVisibility ("visible");
}

function getObj ( elementID ) {	
	if (document.layers){
		return eval("window." + elementID)
	} else {
		return document.getElementById(elementID) 
	}
}
function getPositionX ( elementID ) {
	if (document.layers){
		return eval("window." + elementID).x
	} else {
		var obj = document.getElementById(elementID) 
		var xPos = 0
		while (obj != null) {
	  		xPos += obj.offsetLeft;
  			obj = obj.offsetParent;
  		}
		return xPos;
	}
}
function getPositionY ( elementID ) {	
	if (document.layers){
		return eval("window." + elementID).y
	} else {
		var obj = document.getElementById(elementID)
		var yPos = 0
		while (obj != null) {
	  		yPos += obj.offsetTop;
  			obj = obj.offsetParent;
  		}
		return yPos;
	}
}
function getPositionXobj ( obj ) {
	if (document.layers) {
		return eval("window." + obj.id).x
	} else {
		var xPos = 0
		while (obj != null) {
	  		xPos += obj.offsetLeft;
  			obj = obj.offsetParent;
  		}
		return xPos;
	}
}
function getPositionYobj ( obj ) {	
	if (document.layers){
		return eval("window." + obj.id).y
	} else {
		var yPos = 0
		while (obj != null) {
	  		yPos += obj.offsetTop;
  			obj = obj.offsetParent;
  		}
		return yPos;
	}
}

//****************************************************************************************
//   B R O W S E R   O B J E C T
//**************************************************************************************** 
objBrowser = new Object();
	objBrowser.IsDOM				= function() {return (document.getElementById) ? true : false; }
	objBrowser.IsNS4 				= function() {return (document.layers) ? true : false; }
	objBrowser.IsIE 				= function() {return (document.all) ? true : false; }
	objBrowser.IsIE4 				= function() {return objBrowser.IsIE() && !objBrowser.IsDOM(); }
	objBrowser.IsMac 				= function() {return (navigator.appVersion.indexOf("Mac") != -1); }
	objBrowser.IsDhtmlOK 			= function() {return (this.IsDOM() || this.IsIE() || this.IsNS4()); }
if(document.all) {
	objBrowser.getCanvasWidth	= function() {return document.body.clientWidth;}
	objBrowser.getCanvasHeight	= function() {return document.body.clientHeight;}
	objBrowser.getMinX			= function() {return document.body.scrollLeft;}
	objBrowser.getMinY			= function() {return document.body.scrollTop;}
	objBrowser.getMaxX			= function() {return (document.body.scrollLeft+document.body.clientWidth);}
	objBrowser.getMaxY			= function() {return (document.body.scrollTop+document.body.clientHeight);}
} else {
	objBrowser.getCanvasWidth	= function() {return innerWidth-20;}
	objBrowser.getCanvasHeight	= function() {return innerHeight-20;}
	objBrowser.getMinX			= function() {return pageXOffset;}
	objBrowser.getMinY			= function() {return pageYOffset;}
	objBrowser.getMaxX			= function() {return (pageXOffset+innerWidth-20);}
	objBrowser.getMaxY			= function() {return (pageYOffset+innerHeight-20);}
} 

	objBrowser.toString			= function() {
	var str = '';
		str += '<font size="2" face="Arial">'
		str += '<table cellspacing="0" cellpadding="2" border="0">'
		str += '<tr><td style="font-size:12px;">BROWSER : </td><td style="font-size:12px;" colspan="2"><b>' + navigator.appName +'</b></td></tr>'
		str += '<tr><td align="right" style="font-size:12px;">'+ ((document.getElementById)?"IS..":"NOT.")+'</td><td style="font-size:12px;">W3C DOM compliant</td><td style="font-size:12px;">[document.getElementById]</td></tr>'
		str += '<tr><td align="right" style="font-size:12px;">'+ ((document.all)?"IS..":"NOT.")+'</td><td style="font-size:12px;">DHTML DOM compliant</td><td style="font-size:12px;">[document.all]</td></tr>'
		str += '<tr><td align="right" style="font-size:12px;">'+ ((document.layers)?"IS..":"NOT.")+'</td><td style="font-size:12px;">LDOM compliant</td><td style="font-size:12px;">[document.layers]</td></tr>'
		str += '</table>'
		str += '<br>'
		str += 'dhtmlOK = ' + this.IsDhtmlOK() + '  (document.getElementById || document.all || document.layers)';
		str += '<br>'
	
		str +=  '<br><b>SIZE : </b><br>'
		str +=  'X=['+ this.getMinX()+', '+this.getMaxX()+']<br>'
		str +=  'Y=['+ this.getMinY()+', '+this.getMaxY()+']<br>'
		str +=  'Canvas[W,H]=['+ this.getCanvasWidth() +', '+this.getCanvasHeight()+']<br>'
		str +=	'</font>'
		return str
	} 
var dhtmlOK = ( objBrowser.IsDOM() || objBrowser.IsIE() || objBrowser.IsNS4() );
//****************************************************************************************
//   XBrowser Object & Support
//**************************************************************************************** 
function CreateElement(xName, htmlStr) {
var elem = null;

 	if(document.layers) {
		elem=new Layer(2000); 
		elem.document.open(); 
		elem.document.write(htmlStr); 
		elem.document.close(); 
		elem.innerHTML = htmlStr;
	}
	else if(document.all) {
		var txt = "<DIV ID='" + xName + "' " 
			+ 'STYLE="position:absolute; visibility:hidden">'  
			+ htmlStr 
			+ "</DIV>"; 
		document.body.insertAdjacentHTML("BeforeEnd",txt); 
		elem = document.all[xName]; 
	} 
	else if (document.getElementById) {
		var txt = "position:absolute; visibility:hidden";
		var newRange = document.createRange();

		elem = document.createElement("DIV");
		elem.setAttribute("style",txt);
		elem.setAttribute("id", xName);

		document.body.appendChild(elem);

		newRange.setStartBefore(elem);
		strFrag = newRange.createContextualFragment(htmlStr);	
		elem.appendChild(strFrag);
	}
	return elem;

}	// *** CreateElement()
//****************************************************************************************
//   RecObject & Support
//**************************************************************************************** 
function Rect (Xmin, Ymin, Xmax, Ymax) {
	this.Xmin = Xmin
	this.Ymin = Ymin
	this.Xmax = Xmax
	this.Ymax = Ymax	
}

function Point (x, y) {
var X,Y;
	this.X = x
	this.Y = y
}

function Area (left, top, right, bottom) {
	this.left = left
	this.top = top
	this.right = right
	this.bottom = bottom	
	this.Move = function(dx, dy) { 
					this.left = this.left + dx;
					this.right = this.right + dx;
					this.top = this.top + dy;
					this.bottom = this.bottom + dy;    
				}
	this.toStr = function() { 
					return	'[' + this.left +', ' + this.top +']  '
						+	'[' + this.right +', ' + this.bottom +']  '
				}
}

//****************************************************************************************
//   RecObject & Support
//**************************************************************************************** 
function dhtml_objectByID ( objID ) {
	try {
		return new dhtml_object (document.getElementById(objID));
	} 
	catch(er) {
		 return null;
	}
}

function dhtml_object (obj) {

this.obj = obj
	if (document.layers) {
		this.css = obj
	} else {
		this.css = obj.style 
	}
	if (obj.id) { this.id = obj.id }
	
this.rectToString=	function(){ 
	return '['+this.left()+', '+this.top()+']-->'+'(['+(this.left()+this.width())+', '+(this.top()+this.height())+']'
	}
this.sizeToString=	function(){ return '('+this.width()+', '+this.height()+')' }

this.left		=	function(X){						//----------------------------- v2
						if (typeof(X)=='undefined')  
							return (this.css.left==''?0:parseInt(this.css.left)) 
						else
							this.css.left = X
					}
this.right		=	function(){ return this.left() + this.width() }
this.top		=	function(Y){ 						//----------------------------- v2
						if (typeof(Y)=='undefined') 
							return (this.css.top==''?0:parseInt(this.css.top)) 
						else
							this.css.top = Y
					}
this.bottom		=	function(){ return this.top() + this.height() }
this.width		=	function(W){						//----------------------------- v2
						if (typeof(W)=='undefined') {
							if (!document.layers) {							// Is this a W3C or DHTML DOM browser?
								if (this.css.width) { 						// is the width defined? 
									return parseInt(this.css.width) 		// return the width property
								} else {
									return parseInt(this.obj.offsetWidth) 	// If not, return the offsetWidth property
								}
						    } else { 										// return the layer's document width
						        return parseInt(this.obj.document.width)
						    }
						} else {
							if (!document.layers) { this.css.width = W }
						}
					}
this.height 	=	function(H){						//----------------------------- v2
						if (typeof(H)=='undefined') {
						    if (!document.layers) {							// W3C or DHTML DOM browser?
								if (this.css.height) {						// If so, is the height defined?
									return parseInt(this.css.height)		// If so, return the height property
								} else {
									return parseInt(this.obj.offsetHeight)	// If not, return the offsetHeight property
								}
							} else {
								return parseInt(this.obj.document.height)	// return the layer's document height
							}
						} else {
							if (!document.layers) { this.css.height = H }
						}
					}


this.backgroundcolor = 
					function () { 
						if (!document.layers) 
							 { return this.css.backgroundColor } 
						else { return this.css.bgColor }
					}

this.visibility	=	function () {
						if (!document.layers) {	// Is this a W3C or DHTML DOM browser?
							if (this.css.visibility) {	// If so, is the visibility defined?
					            return this.css.visibility
					        }
					    } else { // for LDOM browser handle the proprietary visibility values
					        if (this.css.visibility == "show") { return "visible" }
					        if (this.css.visibility == "hide") { return "hidden" }
					    }
					    return "inherit"
					}

this.display	=	function (new_display) {			//----------------------------- v2
						if (typeof(new_display)=='undefined') {
							// GET property  
							return this.css.display;
						} else {
							// SET property
							this.css.display = new_display;
						}
					}
this.HTML		=	function (new_html) {				//----------------------------- v2
						if (typeof(new_html)=='undefined') {
							// GET property
							return this.obj.innerHTML
						} else {
							// SET property
						    if (!document.layers) {
						        this.obj.innerHTML = new_html
						    } else {
						        this.obj.document.open()
						        this.obj.document.write(new_html)
						        this.obj.document.close()
						    }
						}
					}
//---------------------------------------------------------------------------------- v2pre
this.zIndex		=	function () { return this.css.zIndex }
this.moveTo		=	function(X, Y) { this.css.left = X; this.css.top = Y }
this.moveBy 	=	function (dX, dY) {
					    this.css.left = this.left() + parseInt(dX);
					    this.css.top = this.top() + parseInt(dY);
					}
this.setLeft	= 	function (X) {	this.css.left = X }
this.setTop 	= 	function (Y) {	this.css.top = Y }
this.setWidth	= 	function (W) { if (!document.layers) { this.css.width = W } }
this.setHeight = 	function (H) { if (!document.layers) { this.css.height = H } }
this.setVisibility=function (new_visibility) {
					    // visible or hidden
						if (!document.layers) { // W3C or DHTML DOM browser?
							this.css.visibility = new_visibility
					    } else {	// Otherwise, set the proprietary visibility values
							if (new_visibility=="visible"||new_visibility=="show") { this.css.visibility = "show" }
					        else if (new_visibility=="hidden"||new_visibility=="hide") { this.css.visibility = "hide" }
					        else { this.css.visibility = "inherit" }
					    }
					}
this.setZIndex = 
					function (new_zindex) {
						if (new_zindex > 0) {
							this.css.zIndex = new_zindex
					    } else {
							this.css.zIndex = 0
					    }
					}
this.setOpacity=	
					function (pc) {
						if(document.all) {
							if(this.css.filter=="") this.css.filter="alpha(opacity=100);";
							this.obj.filters.alpha.opacity = pc;
						} 
					}
this.moveAbove = 	function (reference_object) { this.css.zIndex = reference_object.css.zIndex + 1 }
this.moveBelow = 
					function (reference_object) {
					    reference_zindex = reference_object.css.zIndex
					    if (reference_zindex > 0) {
					        this.css.zIndex =  reference_zindex - 1
					    } else {
					        reference_object.css.zIndex = 1
					        this.css.zIndex = 0
					    }
					}
this.setBackgroundColor = 
					function (new_color) { 
						if (!document.layers) { 
							this.css.backgroundColor = new_color 
						} else { 
							this.css.bgColor = new_color } 
					}
this.setBackgroundImage = 
					function (new_image) {
					    if (!document.layers) {
					        this.css.backgroundImage = "url(" + new_image + ")"
					    } else {
					        this.css.background.src = new_image
					    }
					}
this.setHTML	= 
					function (new_html) {
					    if (!document.layers) {
					        this.obj.innerHTML = new_html
					    } else {
					        this.obj.document.open()
					        this.obj.document.write(new_html)
					        this.obj.document.close()
					    }
					}
this.clipArea	= 
					function() {
				    	if (!document.layers) {
							clip_string = this.css.clip
							if (clip_string.length > 0) {
								var values_string = clip_string.slice(5, clip_string.length - 1)
								var clip_values = values_string.split(" ")
								return new Area(parseInt(clip_values[3]), parseInt(clip_values[0]),
													 parseInt(clip_values[1]), parseInt(clip_values[2]) )
							} else {
								return new Area(0, 0, this.width(), this.height() )
							}
					    } else {
							return new Area (this.css.clip.left, this.css.clip.top, 
											this.css.clip.right, this.css.clip.bottom )
					    }
					}

this.clipSize 	= 
					function() {
						if (!document.layers) {
							var A = this.clipArea();
							A.Move(-A.left, -A.top)
							return A
						} else { 
							var A = new Area (0, 0, this.css.clip.width, this.css.clip.height);
							return A
						}
					}

this.setClipTo = 
					function (new_left, new_top, new_right, new_bottom ) {
						var A = this.clipArea();
						if (new_top == "auto") {new_top = A.top }
					    if (new_right == "auto") {new_right = A.right }
					    if (new_bottom == "auto") {new_bottom = A.bottom }
					    if (new_left == "auto") {new_left = A.left }
    					
						if (!document.layers) {
							// rect(top right bottom left)
        					this.css.clip = "rect(" + new_top + " " + new_right + " " +
													new_bottom + " " + new_left + ")"
						} else {
					        this.css.clip.top = new_top
					        this.css.clip.right = new_right
					        this.css.clip.bottom = new_bottom
					        this.css.clip.left = new_left
						}
					}

this.resizeClipBy = 
					function (delta_left, delta_top, delta_right, delta_bottom) {
						var A = this.clipArea();						 
					    var new_top = A.top + delta_top
					    var new_right = A.right + delta_right
					    var new_bottom = A.bottom + delta_bottom
					    var new_left = A.left + delta_left
						if (!document.layers) {
							this.css.clip = "rect(" + new_top + " " + new_right + " " + 
													new_bottom + " " + new_left + ")"
						} else {
							this.css.clip.top = new_top;
							this.css.clip.right = new_right;
							this.css.clip.bottom = new_bottom;
							this.css.clip.left = new_left;
						}
					}
}	// *** dhtml_object
//document.write('...dom LOADED');