function GL_init() {
    var GL_control = findObject("GL_control");
    if ( GL_control ) {     
        document.body.onmousedown = GL_onMouseDown;
        document.body.onmouseup = GL_onMouseUp;
        document.body.onmousemove = GL_onMouseMove;         
        if ( gl_isLoaded ) {
            GL_userInit();
        }   
    }
//    focus();
}

function GL_scrollPage(left, top) {
    if ( left > 0 ) {
        document.body.scrollLeft = left;             
    }
    if ( top > 0 ) {
        document.body.scrollTop = top;
    }
}

function GL_doArrayPaging(hrefLink, pagingArrayStartIndexId, pagingArrayStartIndexValue) {    
   var transForm = GL_findForm('transactionForm');
   if ( !transForm ) {
   	return;
   }
   
   var action = GL_findField(transForm, 'action');
   if ( !action ) {
   	return;
   }
   action.value = 'doArrayPagingSaveData';

	var field = GL_findField(transForm, 'pagingArrayStartIndexId');
	field.value = pagingArrayStartIndexId;
	var field = GL_findField(transForm, 'pagingArrayStartIndexValue');
	field.value = pagingArrayStartIndexValue;	

   GL_addPageScrollData('transactionForm');
   transForm.submit();  	
}

function GL_appendPageScrollData(hrefLink) {    
    var t = '&pageScrollLeft=' + document.body.scrollLeft;    
    t += '&pageScrollTop=' + document.body.scrollTop;
    hrefLink.href += t;
}

function GL_addPageScrollData(formId) {   
    var currForm = document.forms[formId];
    var pageScrollLeft = GL_findField(currForm, 'pageScrollLeft');
    if ( pageScrollLeft ) {
        pageScrollLeft.value = document.body.scrollLeft;
    }
    var pageScrollTop = GL_findField(currForm, 'pageScrollTop');
    if ( pageScrollTop ) {
        pageScrollTop.value = document.body.scrollTop;
    }
}

//check for GL tables that are scrolled and record them
function GL_addAllScrollPositions(){
	var form = document.transactionForm;
	if (!form)
		return;
	var divs = form.getElementsByTagName("div");
	var dataStr = [];
	for (var i=0; i<divs.length; i+=1){
		var div = divs[i];
		if (div.id && div.id.indexOf('valueSpan') == 0 && (div.scrollTop || div.scrollLeft)){
			var idSpan = GL_addAllScrollPositions.getFirstChildSpan(div);
			if (!idSpan)
				continue;
			if (dataStr.length > 0)
				dataStr.push(':');
			dataStr.push(idSpan.innerHTML, ',', div.scrollTop, ',', div.scrollLeft);
		}
	}
	var scrollDataField = GL_findField(form, 'scrollData');
	var str = dataStr.join('');
	scrollDataField.value = str;
}

GL_addAllScrollPositions.getFirstChildSpan = function(node){
	for (var i=0; i<node.childNodes.length; i+=1){
		var chld = node.childNodes[i];
		if (chld.nodeType == 1 && chld.tagName.toUpperCase() == 'SPAN')
			return chld;
	}
	return null;
}

//restore scrolled GL table positions
function GL_restoreScrollDivs(){
	var form = document.transactionForm;
	if (!form)
		return;
	
	var divs = form.getElementsByTagName("div");
	scrollDivs = [];
	for (var i=0; i<divs.length; i+=1){
		var div = divs[i];
		if (div.id && div.id.indexOf('valueSpan') == 0){
			var idSpan = GL_addAllScrollPositions.getFirstChildSpan(div);
			if (!idSpan)
				continue;
			scrollDivs[idSpan.innerHTML] = div;
		}
	}	

	var dataStr = GL_findField(form, 'scrollData').value;
	var scrollData = dataStr.split(':');

	for (i=0; i<scrollData.length; i+=1){
		var data = scrollData[i];
		var elms = data.split(',');
		var div = scrollDivs[elms[0]];
		if (!div)
			continue;
		div.scrollTop = parseInt(elms[1]);
		div.scrollLeft = parseInt(elms[2]);
	}
}

function GL_onMouseDown(evt) {
    var evt = (evt) ? evt : ((window.event) ? event : null);
    
    if ( gl_mouseData ) {
        if ( gl_mouseData.handle == 'editStyle' ) {
            var result = GL_onMouseDownEditStyle(evt);
            if ( gl_isMultipleSelect  && !result) {
            	return false;
            }
        }
    }
}

var _glActionData;
function GL_onMouseMove(evt) {
    var evt = (evt) ? evt : ((window.event) ? event : null);
 	if ( _glActionData )
		_glActionData.doMouseMove(evt);	
    if ( gl_mouseData ) {
        if ( gl_mouseData.handle == 'editStyle' ) {
            GL_onMouseMoveEditStyle(evt);
        }
        if ( (gl_editStyleData && gl_editStyleData.drawType == 'line' && gl_drawLineInit) || gl_dragMSSelectHighlight ) {
           return false;
        } else if ( gl_mouseData.handle == 'popupWindow' ) {
        	GL_popupWindowOnMouseMove(evt);
        }  
    }
}
function GL_onMouseUp(evt) {
    var evt = (evt) ? evt : ((window.event) ? event : null);
	if ( _glActionData ) {
		_glActionData.doMouseUp(evt);
		_glActionData = null;
	}
    if ( gl_mouseData ) {
        if ( gl_mouseData.handle == 'editStyle' ) {
            GL_onMouseUpEditStyle(evt); 
            if ( gl_isMultipleSelect) {
            	return false;
            }            
        } else if ( gl_mouseData.handle == 'popupWindow' ) {
        	GL_popupWindowOnMouseUp(evt);
        }  
    }   
    turnOff();  
}

function GL_popupHide(popupId) {
    var GL_control = findObject("GL_control");  
    if ( !GL_control ) {
        return;
    }   
    var popup = findObject("GL_popup" + popupId);
    if ( popup ) {
            GL_control.removeChild(popup);
    }
    
    var popupUnderIFrame = findObject('GL_underIFrame' + popupId);
    if ( popupUnderIFrame ) {   
        popupUnderIFrame.style.visibility = "hidden";
        popupUnderIFrame.style.display= "none";     
    }
}

function GL_popupClickCancel(popupId) {
    var popupBody = findObject("GL_popupBody" + popupId);
    if ( popupBody ) {  
        var popup = findObject("GL_popup" + popupId);
        var sourceDiv = findObject(popup.sourceDivId);
        if ( sourceDiv ) {
            popupBody.innerHTML = sourceDiv.innerHTML;
        }
    }
    GL_popupHide(popupId);  
}
function GL_popupClickOk(popupId) {
    var popupBody = findObject("GL_popupBody" + popupId);   
    if ( popupBody ) {
        var popup = findObject("GL_popup" + popupId);
        var sourceDiv = findObject(popup.sourceDivId);
        sourceDiv.innerHTML = popupBody.innerHTML;
    }
    GL_popupHide(popupId);  
    if ( gl_popupData ) {
        if ( gl_popupData.handle = 'editStyleNewField' ) {
            GL_popupOkEditStyleNewField();
        }
    }   
    gl_popupData = null;
}

function GL_popupDragStart(event) {  
    X = event.offsetX;
    Y = event.offsetY;
}
function GL_popupDragOn(event, popupId) {
    var popup = findObject("GL_popup" + popupId);
    popup.style.pixelLeft = event.clientX-X + document.body.scrollLeft;             
    popup.style.pixelTop = event.clientY-Y + document.body.scrollTop;
    var popupUnderIFrame = findObject('GL_underIFrame' + popupId);
    popupUnderIFrame.style.top = popup.style.top;
    popupUnderIFrame.style.left = popup.style.left; 
}
function GL_popupDragEnd(event, popupId) {     	
}
function GL_popupResizeStart(popupId) {
    var popup = findObject("GL_popup" + popupId);
    GL_popupWidth = popup.offsetWidth;
    GL_popupHeight = popup.offsetHeight;    
}
function GL_popupResize(popupId) {
    var popup = findObject("GL_popup" + popupId);   
    popup.style.pixelWidth = GL_popupWidth + event.offsetX;
    popup.style.pixelHeight = GL_popupHeight + event.offsetY;
    
    var popupUnderIFrame = findObject('GL_underIFrame' + popupId);
    popupUnderIFrame.style.width = popup.offsetWidth;
    popupUnderIFrame.style.height = popup.offsetHeight; 
}

function GL_popupResizeEnd(popupId) {

//    var popup = findObject("GL_popup" + popupId);  
    GL_updatePopupView(popupId);
/*     
    GL_layoutControlItems(popup, popupId, 150, 70);
    
    var popupUnderIFrame = findObject('GL_underIFrame' + popupId);
    popupUnderIFrame.style.width = popup.offsetWidth;
    popupUnderIFrame.style.height = popup.offsetHeight;
    popupUnderIFrame.style.top = popup.style.top;
    popupUnderIFrame.style.left = popup.style.left;
*/    
}         

function writePopup(popupId, showCancel, okLabel) {
    var GL_control = findObject("GL_control"); 
    if ( !GL_control ) {
        return;
    }
    var t = '';
    t +='<DIV id="GL_popup' + popupId + '" sourceDivId="" class="popup">';  
    t +='<IMG id="GL_popupDragArea' + popupId + '" ';   
    t +='src="image/transparent.gif" border="0" style="cursor:move;position:absolute;" ';   
    t +='ondragstart="GL_popupDragStart(event);" ondrag="GL_popupDragOn(event, ' + popupId + ');"/>';   
    t +='<IMG id="GL_popupDeleteArea' + popupId + '" '; 
    t +='src="image/window_close.jpg" width="15" height="20" '; 
    t +='style="position:absolute;" ';  
    t +='onclick="GL_popupClickCancel(' + popupId + ');" '; 
    t +='border="0"/>'; 
    t +='<IMG id="GL_popupResizeArea'+ popupId + '" ';  
    t +='src="image/transparent.gif" '; 
    t +='style="cursor:se-resize;position:absolute;" '; 
    t +='ondragstart="GL_popupResizeStart(' + popupId + ');" '; 
    t +='ondrag="GL_popupResize(' + popupId + ');" ';   
    t +='ondragend="GL_popupResizeEnd('+ popupId + ');"/>'; 
    t +='<TABLE cellpadding="0" border="0" cellspacing="0" BGCOLOR="#f1f1f1">'; 
    t +='<TR class="popup" valign="center">';   
    t +='<TD align="left" nowrap="">';  
    t +='<img src="image/pd_dialog_icon.gif" ';   
    t +='border="0" width="20" height="20" align="ABSMIDDLE" '; 
    t +='onclick="GL_popupClickCancel(' + popupId + ');" />';   
    t +='<font color="white">'; 
    t +=' <SPAN id="GL_popupTitle' + popupId + '"></SPAN>'; 
    t +='</font>';  
    t +='</TD>';    
    t +='</TR>';    
    t +='<TR>'; 
    t +='<TD>'; 
    t +='<DIV id="GL_popupBody' + popupId + '" style="overflow:auto;" ></DIV>'; 
    t +='</TD>';    
    t +='</TR>';    
    t +='<TR >';    
    t +='<TD align="center">';  
    t +='<INPUT TYPE="button" CLASS="submit" VALUE="   ';
    t += okLabel;
    t +='   " onclick="GL_popupClickOk(' + popupId + ');"/>';   
    
    if ( showCancel == 'yes' ) { 
        t +=' ';    
        t +='<INPUT TYPE="button" CLASS="submit" VALUE=" Cancel " onclick="GL_popupClickCancel(' + popupId + ');"'; 
    }
    t +='</TD>';    
    t +='</TR>';    
    t +='<TR >';    
    t +='<TD>';     
    t +='<br/>';    
    t +='</TD>';    
    t +='</TR>';    
    t +='</TABLE>'; 
    t +='</DIV>';
    
    GL_control.innerHTML += t;
}



function writeUnderIFrame(iframeId) {
    var GL_control = findObject("GL_underIFrame"); 
    if ( !GL_control ) {
        return;
    }   
    var t = '';
    t +='<iframe id="' + iframeId + '"';
    t +=' src="javascript:false;" scrolling="no" frameborder="0"';
    t +=' style="position:absolute;top:0px;left:0px;display:none;visibility:visible;z-index:2222">';
    t +='</iframe>';        
    GL_control.innerHTML += t;
}

function GL_writeHighlightedSpan(id) {
    var GL_control = findObject("GL_underIFrame"); 
    if ( !GL_control ) {
        return;
    }   
    var t = '';
    t +='<span id="' + id + '" editObjectId=\"\" onclick="GL_editStyleSelectMS(event, this);" class="editStyleHighlightedMS">';
   	t +='<img src="image/handler.gif"';
    t +=' style="position:absolute;left:-5px;top:-5px;"';
    t +='/>';  
   	t +='<img src="image/handler.gif"';
    t +=' style="position:absolute;right:-5px;top:-5px;"';
    t +='/>';          
   	t +='<img src="image/handler.gif"';
    t +=' style="position:absolute;bottom:-5px;right:-5px;"';
    t +='/>';
   	t +='<img src="image/handler.gif"';
    t +=' style="position:absolute;bottom:-5px;left:-5px;"';
    t +='/>';        
    t +='</span>';        
    GL_control.innerHTML += t;
}

function GL_getIFrame(id) {
	if ( GL_isIE() ) {
		return window.frames[id];
	} else {
		return document.getElementById(id);
	}
}


function GL_showMessage(popupId, sourceDivId, title) { 
	var popup = findObject("GL_popup" + popupId);
	if ( !popup ) {
	    writePopup(popupId, 'no', 'Close');
	    popup = findObject("GL_popup" + popupId);
	}

    GL_showPopup(popupId, sourceDivId, title);   
}



function GL_getStylePXValue(stylePX) {
	if ( !stylePX ) {
		return 0;
	}
	var index = stylePX.indexOf('px');
	if ( index < 0 ) {
		return 0;
	} else {
		return 1 * stylePX.substring(0, index);
	} 
}


function GL_moveToCenter(object) {
    if ( !object ) {
        return;
    }
    var screenWidth = screen.width - document.body.scrollLeft
    var screenHeight = screen.height - document.body.scrollTop;
    
    var leftDelta = screenWidth/2 - (screenWidth - object.offsetWidth) / 2;
    var topDelta = screenHeight/2 - (screenHeight - object.offsetHeight) / 2;
    
    object.style.left = (leftDelta + document.body.scrollLeft) + 'px';              
    object.style.top = (topDelta + document.body.scrollTop) + 'px';
}


function GL_showPopupFrame(popupId, urlDivId, title, w, h) { 
    if ( GL_previousPopupId ) {
        GL_popupHide(GL_previousPopupId);
    }

    var urlDiv = findObject(urlDivId);
    var popup = findObject("GL_popup" + popupId);
    if ( !popup ) {
        writePopupFrame(popupId, w, h); 
        var popupFrame = GL_getIFrame('GL_popupFrame' + popupId);
        if ( !popupFrame ) {
        	alert('Failed to find GL_popupFrame ' + popupId);
        	return;
        }
        var url = urlDiv.innerHTML;
        if ( !GL_isIE() ) {
	        url = url.replace(/&amp;/g, '&');
	        url = url.replace(/\r/g, ' ');
	        url = url.replace(/\n/g, '');
//			var popup = findObject("GL_popup" + popupId);            
//		    popup.style.width = w + 'px';
//		    popup.style.height = (40+h) + 'px';   	        	        
	    }
	    popupFrame.location = url;           	    
        popupFrame.src = url;
    }       
            
    GL_showPopup(popupId, urlDivId, title);    
    GL_previousPopupId = popupId;
}
function writePopupFrame(popupId, width, height) {
    var GL_control = findObject("GL_control"); 
    if ( !GL_control ) {
        return;
    }   
    var t = '';
    t +='<DIV id="GL_popup' + popupId + '" sourceDivId="" class="popup">'; 
    if ( GL_isIE() ) {
	    t +='<IMG id="GL_popupDragArea' + popupId + '" ';   
	    t +='src="image/transparent.gif" border="0" style="cursor:move;position:absolute;" ';  
    	t +=' ondragstart="GL_popupDragStart(event);" ondrag="GL_popupDragOn(event, ' + popupId + ');"';
    	t +='/>';   
    } else {
  		t +='<div id="GL_popupDragArea' + popupId + '" ';
  		t +=' style="cursor:move;" ';  
	    t +=' onmousedown="GL_popupWindowOnMouseDown(event, ' + popupId + ');" '; 
	    t +='/>';  	 
    }    
    t +='<IMG id="GL_popupDeleteArea' + popupId + '" '; 
    t +='src="image/window_close.jpg" width="15" height="20" '; 
    t +='style="position:absolute;" ';  
    t +='onclick="GL_popupClickCancel(' + popupId + ');" '; 
    t +='border="0"/>'; 
    t +='<IMG id="GL_popupResizeArea'+ popupId + '" ';  
    t +='src="image/transparent.gif" '; 
    t +='style="cursor:se-resize;position:absolute;" '; 
    t +='ondragstart="GL_popupResizeStart(' + popupId + ');" '; 
    t +='ondrag="GL_popupResize(' + popupId + ');" ';   
    t +='ondragend="GL_popupResizeEnd('+ popupId + ');"/>'; 
    t +='<TABLE cellpadding="0" border="0" cellspacing="0" BGCOLOR="#f1f1f1">'; 
    t +='<TR class="popup" valign="center">';   
    t +='<TD align="left" nowrap="">';  
    t +='<img src="image/pd_dialog_icon.gif" ';   
    t +='border="0" width="20" height="20" align="ABSMIDDLE" '; 
    t +='onclick="GL_popupClickCancel(' + popupId + ');" />';   
    t +='<font color="white">'; 
    t +=' <SPAN id="GL_popupTitle' + popupId + '"></SPAN>'; 
    t +='</font>';  
    t +='</TD>';    
    t +='</TR>';    
    t +='<TR>'; 
    t +='<TD>';  
    t +='<IFRAME id="GL_popupFrame' + popupId + '"';
    t +=' frameborder="0"';
    t +=' style="position:relative;z-index:20000;"'; 
    t +=' scrolling="yes"';
    t +=' width="'  + width + '"';
    t +=' height="' + height + '"';
    t +='></IFRAME>';   
    t +='</TD>';    
    t +='</TR>';    
    t +='</TABLE>'; 
    t +='</DIV>';
    GL_control.innerHTML += t;
}

function GL_showPopup(popupId, sourceDivId, title) { 
    var popup = findObject("GL_popup" + popupId);
    if ( !popup ) {
        writePopup(popupId, 'yes', 'OK');
        popup = findObject("GL_popup" + popupId);       
    }   
    if ( !popup ) {
        return;
    }   
    var popupTitle = findObject("GL_popupTitle" + popupId);         
    popupTitle.innerHTML = title;
    popup.style.visibility = "visible"; 
    popup.style.display= "block";   
    popup.style.zIndex = 1000;

    popup.sourceDivId = sourceDivId;
    var sourceDiv = findObject(sourceDivId);
    if ( sourceDiv ) {
    	var popupBody = findObject("GL_popupBody" + popupId);
    	if ( popupBody ) {
	    	popupBody.innerHTML = sourceDiv.innerHTML; 
	    }
    }
 
 	GL_updatePopupView(popupId);
 	
 	return popup;
}

function GL_updatePopupView(popupId) {
	var popup = findObject('GL_popup' + popupId);
    var sourceDiv = findObject(popup.sourceDivId);
 	var sourceIFrame = findObject('GL_popupFrame' + popupId);
 	
 	
	var width;
	var height; 
	if ( sourceIFrame ) {
		width = GL_getStylePXValue(sourceIFrame.style.width);
		height = GL_getStylePXValue(sourceIFrame.style.height);
		if ( width < 1 ) {
			width = sourceIFrame.offsetWidth;
		}
		if ( height < 1 ) {
			height = sourceIFrame.offsetHeight;  
		}				 	  
	} else if ( sourceDiv ) {
		width = GL_getStylePXValue(sourceDiv.style.width);
		height = GL_getStylePXValue(sourceDiv.style.height);
		if ( width < 1 ) {
			width = sourceDiv.offsetWidth;
		}
		if ( height < 1 ) {
			height = sourceDiv.offsetHeight; 
		}			
	} else {
		width = popup.offsetWidth;
		height = popup.offsetHeight;  		
	}

	if ( sourceIFrame ) {
		if ( !GL_isIE() ) {
			height = height + 21;
		}
	} else {
		width = width + 13;
		height = height + 45;
	}
	
	
	
	var MAX_WIDTH = 1200;
	var MAX_HEIGHT = 1200;	
	if ( width > MAX_WIDTH ) {
		width = MAX_WIDTH;
	}
	if ( height > MAX_HEIGHT ) {
		height = MAX_HEIGHT;
	}	 
    var popupBody = findObject("GL_popupBody" + popupId);
    if ( popupBody ) {
    	popupBody.style.width = width + 'px';
    	popupBody.style.height = height + 'px';
    }
    GL_layoutControlItems(popup, popupId, 150, 110, width, height);        
}
    
function GL_layoutControlItems(popup, popupId, left, top, width, height) {
	var glIconWidth = 15;
	var closeIconWidth = 15;
	var titleHeight = 20;	
	var resizeIconWidth = 15;
	var resizeIconHeight = 15;	
	var buttonHeight = 30;

 	var sourceIFrame = findObject('GL_popupFrame' + popupId);
 	var resizeTopOff = 0;
 	var resizeLeftOff = 0;
 	if ( sourceIFrame ) {
 		buttonHeight = -35;
 		if ( GL_isIE() ) {
	 		resizeTopOff = 22;
	 		resizeLeftOff = 4;
 		} else {
 			resizeTopOff = 2;
 			resizeLeftOff = 4;
 		}
 	}

	var totalWidth = width;
	var totalHeight = height + titleHeight + resizeIconHeight + buttonHeight;

    popup.style.left = (left + document.body.scrollLeft) + 'px';                
    popup.style.top = (top + document.body.scrollTop) + 'px';
    popup.style.width = totalWidth + 'px';
    popup.style.height = totalHeight + 'px';

    var dragArea = findObject("GL_popupDragArea" + popupId);
    dragArea.style.left = glIconWidth + 'px';
    dragArea.style.top = 0 + 'px';    
    dragArea.style.width = (width - (glIconWidth+closeIconWidth)) + 'px';
    dragArea.style.height = titleHeight + 'px';
    dragArea.style.zIndex = 1000;
    dragArea.style.visibility = "visible";  
    
    var closeArea = findObject("GL_popupDeleteArea" + popupId);
    closeArea.style.left = (width - (closeIconWidth+2)) + 'px';
    closeArea.style.top = 0 + 'px';  
    closeArea.style.width = closeIconWidth + 'px';
    closeArea.style.height = titleHeight + 'px';
    closeArea.style.zIndex = 1000;
    closeArea.style.visibility = "visible";    
    
    var resizeArea = findObject("GL_popupResizeArea" + popupId);
    resizeArea.style.left = (width - (resizeIconWidth+2) + resizeLeftOff) + 'px';
    resizeArea.style.top = (height - resizeIconHeight + resizeTopOff) + 'px';    
    resizeArea.style.width = resizeIconWidth + 'px';
    resizeArea.style.height = resizeIconHeight + 'px';
    resizeArea.style.zIndex = 100000;
    resizeArea.style.visibility = "visible";    
    
    if ( GL_isIE() ) { 
    	try {   
		    var popupUnderIFrame = findObject('GL_underIFrame' + popupId);
		    if ( !popupUnderIFrame ) {
		       writeUnderIFrame('GL_underIFrame' + popupId);
		       popupUnderIFrame = findObject('GL_underIFrame' + popupId);
		    } 
		    popupUnderIFrame.style.width = totalWidth;
		    popupUnderIFrame.style.height = totalHeight;
		    popupUnderIFrame.style.top = popup.style.top;
		    popupUnderIFrame.style.left = popup.style.left;
		    popupUnderIFrame.style.zIndex = popup.style.zIndex - 1;
		    popupUnderIFrame.style.visibility = "visible";
		    popupUnderIFrame.style.display= "block";    
	     } catch(e) {}
    }

}

function GL_popupWindowOnMouseDown(evt, popupId) {
	gl_mouseData = new GLMouseData();
	gl_mouseData.handle = 'popupWindow';
	gl_mouseData.popupWindow = findObject('GL_popup' + popupId);
	gl_mouseData.x = evt.clientX - getAnchorPosition(gl_mouseData.popupWindow.id).x;
	gl_mouseData.y = evt.clientY - getAnchorPosition(gl_mouseData.popupWindow.id).y;
	
}
function GL_popupWindowOnMouseMove(evt) {
	if ( !gl_mouseData ) {
		return;
	}
	
	var x = evt.clientX - gl_mouseData.x;
	var y = evt.clientY - gl_mouseData.y;
	
	if ( x > -1 && y > -1 ) {
		gl_mouseData.popupWindow.style.left = x + 'px';
		gl_mouseData.popupWindow.style.top = y + 'px';
	}
}

function GL_popupWindowOnMouseUp(evt) {
	gl_mouseData = null;
}
function doNothing() {
	return false;
}

function GL_enableTabKey(evt, obj) {
	var TAB = 9;
	var key = (evt.charCode) ? evt.charCode:evt.keyCode;	
	if ( key == TAB ) {
		if ( document.selection ) {
			obj.selection = document.selection.createRange();
   			obj.selection.text = String.fromCharCode(key);
   		}
    	evt.cancelBubble = true;
    	if ( evt.stopPropagation ) {
    		evt.stopPropagation();
    	}
    	evt.returnValue = false;
		return false;
	}
}