	function uploadWarning(){
		if (mainform.action.value=='deletePic'){
			alert('You are about to delete \"' + mainform.fName.value + '\"?');		
		}else{
			alert('WARNING :\n If you\'re uploading a large file it may take a little while to transmit!');
		}
	}
	

function toggleDiv(ob1){

	var obj1 = document.getElementById(ob1);

	if (obj1.style.display=='block'){
		obj1.style.display='none';
	}else{
		obj1.style.display='block';
	}
}




//--------------------------------------------------------------------------------------------------------------------------------------------------------
function moduleSubmit(obj){

		formLst.style.display='none';
		TextBlock.style.display='none';
		menuGroup.style.display='none';
		galleryDiv.style.display='none';

	switch (obj.value){
		case 'formEdit':
			formLst.style.display='block';
		break;

		case 'textBlocks':
			TextBlock.style.display='block';
		break;

		case 'menu':
		menuGroup.style.display='block';
		break;

		case 'textMenu':
			textMenuGroup.style.display='block';
		break;

		case 'sideMenu':
			menuGroup.style.display='block';
		break;
		case 'gallery':
			galleryDiv.style.display='block';
		break;

	}


}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function confirmLink(theLink, msg)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm( msg);


    return is_confirmed;
} // end of the 'confirmLink()' function



// -----------------------------------------------------------------------------------------
function buildFilterSql(){
	var str='';
	var strTemp=Array();
	var y=0;

	strTemp[0]=addFilterList("TM_030_TYPE_ID");
	strTemp[1]=addFilterList("TM_031_FROMACC_ID");
	strTemp[2]=addFilterList("TM_031_TOACC_ID");

	for (i=0;i<strTemp.length;i++){
		if (typeof(strTemp[i])!='undefined'){
			str=str+ ((y>0)?" and ":"") + strTemp[i];
			y++;
		}
	}

	if (filterForm.date1.value.length>0){
		str=str+ ((y>0)?" and ":"") + " TM_032_DATE  > " + filterForm.date1.value;
		y++;
	}
	if (filterForm.date2.value.length>0){
		str=str+ ((y>0)?" and ":"") + " TM_032_DATE  < " + filterForm.date2.value;
		y++;
	}
	if (filterForm.amt1.value.length>0){
		str=str+ ((y>0)?" and ":"") + " TM_032_AMT  > " + filterForm.amt1.value;
		y++;
	}
	if (filterForm.amt2.value.length>0){
		str=str+ ((y>0)?" and ":"") + " TM_032_AMT  < " + filterForm.amt2.value;

	}

	filterForm.extraSql.value=str;

}

// -----------------------------------------------------------------------------------------
function addFilterList(typ){

	var str='';
	var strTemp='';
	var y=0;
	
	for (i=0;i<100;i++){
		obj=eval("filterForm." + typ +i);
		if (typeof(obj)!='undefined'){
			if (obj.checked){
				strTemp=strTemp + ((y>0)?" or":"") + " " + typ + "=" + obj.value
				y++;
			}
		}
	}
	if (strTemp.length>1){
		return "(" + strTemp + ")"
	}
}
// -----------------------------------------------------------------------------------------


	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
	function storeCoords(obj){
		var objLeft=obj.style.left;
		var objTop=obj.style.top;
		var objWidth=obj.style.width;
		var objHeight=obj.style.height;
		
		if (document.editform.snap.checked==true){
			objLeft=parseInt(objLeft.replace("px","")*1/5)*5;
			objTop=parseInt(objTop.replace("px","")*1/5)*5;
			obj.style.left=objLeft;
			obj.style.top=objTop;
		}
		status='left=' + objLeft + " top=" + objTop + " width=" + objWidth + " height=" + objHeight;

		stat=obj.id +"." + objLeft + "." + objTop;
		eval("editform.val_" + obj.id + ".value=stat");
		window.resizeBy(1,1);
		window.resizeBy(-1,-1);
	}

		function lyrCoords(Lval,Rval){
			document.cookie='lyrLeft=' + Lval;
			document.cookie='lyrTop=' + Rval;
		}
	
		function btnsCoords(Lval,Rval){
			document.cookie='btnsLeft=' + Lval;
			document.cookie='btnsTop=' + Rval;
		}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function keyCap() { //v1.0
	if (navigator.appName != 'Netscape') {
		if (window.event.keyCode == 13){
			loginform.submit();
		}
	}
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function keepCoords(obj){

	var objLeft=obj.style.left;
	var objTop=obj.style.top;

	document.cookie='editorLeft=' + objLeft;
	document.cookie='editorTop=' + objTop;
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
	function changeColor(col){
		var obj=dataform.colorChooser.value;
		eval("dataform." + obj  + ".style.backgroundColor=col");
		eval("dataform." + obj  + ".value=col");
	}



	function changeFontBGColor(col){
		if (mainform.colorlayer.value){
			if ((col.length==7) || (col.length==0)){	
				var obj=mainform.colorlayer.value;
				eval(obj  + ".style.backgroundColor=col");
				if (col.length==0){
					eval(obj  + ".style.backgroundColor=''");
				}
				mainform.color.value=col;
				mainform.cssBGColor.value=col;
			}else{
				alert('that isnt a colour');
			}
		}
	}

	function changeFontColor(col){
		if (mainform.colorlayer.value){
			if ((col.length==7) || (col.length==0)){	
				var obj=mainform.colorlayer.value;
				eval(obj  + ".style.color=col");
				updateFontAttributes();
				mainform.color.value=col;
				mainform.cssColor.value=col;
			}else{
				alert('that isnt a colour');
			}
		}
	}

	function updateFontAttributes(){
		if (mainform.colorlayer.value){
			var obj=mainform.colorlayer.value;
			eval(obj  + ".style.fontSize=mainform.fontSize.value");
			mainform.cssSize.value=mainform.fontSize.value;
			if (mainform.isFontBold.checked){
				eval(obj  + ".style.fontWeight='bolder';");
				mainform.cssBold.value="y";
			}else{
				eval(obj  + ".style.fontWeight='';");
				mainform.cssBold.value="";
			}
		}
	}

	function updateCssForm(id, cssCol, bgcolor, cssSize, isbold){

		mainform.colorlayer.value='css' + id;
		mainform.cssColor.value=cssCol;
		mainform.cssBGColor.value=bgcolor;
		mainform.cssSize.value=cssSize;
		mainform.cssBold.value=isbold;
		mainform.color.value=cssCol;		
		mainform.fontSize.value=cssSize;		
		mainform.isFontBold.value=isbold;	

	}


	function linkBuilder(cssClass){
		if (document.mainform.linkUrl.value && document.mainform.linkText.value){
			document.mainform.link.value='<a href="' + document.mainform.linkUrl.value + '"';
			
			if (document.mainform.linkChk.checked==true){
				document.mainform.link.value=document.mainform.link.value + " target=_blank";
			}
			document.mainform.link.value=document.mainform.link.value + '>' + document.mainform.linkText.value + '</a>';
		}	
	}



	function MM_findObj(n, d) { //v3.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
	}

	function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v3.0
	  //Copyright 1998 Macromedia, Inc. All rights reserved.
	  var i,j,aLayer,retVal,curDrag=null,NS=(navigator.appName=='Netscape'), curLeft, curTop;
	  if (!document.all && !document.layers) return false;
	  retVal = true; if(!NS && event) event.returnValue = true;
	  if (MM_dragLayer.arguments.length > 1) {
		curDrag = MM_findObj(objName); if (!curDrag) return false;
		if (!document.allLayers) { document.allLayers = new Array();
		  with (document) if (NS) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
			for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
			  with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
		  } else for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i];}
		curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
		curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
		curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
		curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
		curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
		curDrag.MM_oldZ = (NS)?curDrag.zIndex:curDrag.style.zIndex;
		curLeft= (NS)?curDrag.left:curDrag.style.pixelLeft; curDrag.MM_startL = curLeft;
		curTop = (NS)?curDrag.top:curDrag.style.pixelTop; curDrag.MM_startT = curTop;
		curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop -cU;
		curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop +cD;
		curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
		document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
		if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	  } else {
		var theEvent = ((NS)?objName.type:event.type);
		if (theEvent == 'mousedown') {
		  var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
		  var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
		  var maxDragZ=null; document.MM_maxZ = 0;
		  for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
			var aLayerZ = (NS)?aLayer.zIndex:aLayer.style.zIndex;
			if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
			var isVisible = (((NS)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
			if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
			  var parentL=0; var parentT=0;
			  if (!NS) { parentLayer = aLayer.parentElement;
				while (parentLayer != null && parentLayer.style.position) {
				  parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
				  parentLayer = parentLayer.parentElement; } }
			  var tmpX=mouseX-(((NS)?pageX:style.pixelLeft+parentL)+MM_hLeft);
			  var tmpY=mouseY-(((NS)?pageY:style.pixelTop +parentT)+MM_hTop);
			  var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS)?clip.width :offsetWidth);
			  var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS)?clip.height:offsetHeight);
			  if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
				  || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
		  if (curDrag) {
			document.onmousemove = MM_dragLayer; if (NS) document.captureEvents(Event.MOUSEMOVE);
			curLeft = (NS)?curDrag.left:curDrag.style.pixelLeft;
			curTop = (NS)?curDrag.top:curDrag.style.pixelTop;
			MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
			document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
			if(curDrag.MM_toFront) {
			  eval('curDrag.'+((NS)?'':'style.')+'zIndex=document.MM_maxZ+1');
			  if (!curDrag.MM_dropBack) document.MM_maxZ++; }
			retVal = false; if(!NS) event.returnValue = false;
		} } else if (theEvent == 'mousemove') {
		  if (document.MM_curDrag) with (document.MM_curDrag) {
			var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
			var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
			newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
			if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
			if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
			if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
			if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
			MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
			if (NS) {left = newLeft; top = newTop;}
			else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
			if (MM_dragJS) eval(MM_dragJS);
			retVal = false; if(!NS) event.returnValue = false;
		} } else if (theEvent == 'mouseup') {
		  document.onmousemove = null;
		  if (NS) document.releaseEvents(Event.MOUSEMOVE);
		  if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
		  if (document.MM_curDrag) with (document.MM_curDrag) {
			if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
				(Math.pow(MM_targL-((NS)?left:style.pixelLeft),2)+
				 Math.pow(MM_targT-((NS)?top:style.pixelTop),2))<=MM_tol) {
			  if (NS) {left = MM_targL; top = MM_targT;}
			  else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
			  MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
			if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
			if(MM_dropBack) {if (NS) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
			retVal = false; if(!NS) event.returnValue = false; }
		  document.MM_curDrag = null;
		}
		if (NS) document.routeEvent(objName);
	  } return retVal;
	}		

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function putcookie(valname,val){
	document.cookie=valname + '=' + val;
	location.reload();
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function cookie(valname,val){
	document.cookie=valname + '=' + val;
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function submit_this(button){
		document.mainform.actionBtn.value=button;
		document.mainform.submit();
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function popupEditWindow(obj,url_name,w,h,t,l){

if (obj=='scroll'){
	viewer=window.open(" ","remotewin","resizable=1,scrollbars='yes',width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}else{
	viewer=window.open(" ","remotewin2","resizable=1,scrollbars='yes',width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);

}

if (viewer.blur) viewer.focus();

viewer.location.href=url_name;
if(viewer.opener==null)viewer.opener=window;

}


// switch layers - extra function to accomodate netscape.
//-----------------------------------------------------------------------------------------------------------------------------------------------------------
function switch_layers(layerShow, layerHide){
	if (!document.all && document.getElementById) {
	   layerHide.style.visibility = 'hidden';
 	   layerShow.style.visibility = 'visible';
	}else{
		if (layerShow.style) {
			layerHide.style.visibility='hidden'; 
			layerShow.style.visibility='visible';
		}else{
			layerHide.visibility='hidden'; 
			layerShow.visibility='visible';
		}
	}
}


//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
function putcookieandGo(url,valname,val){
	document.cookie=valname + '=' + val;
	document.location=url;
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
// editor routines

	function chooseConfig(fType){
		dropdownConfig.style.display='none';
		textConfig.style.display='none';
		switch(fType.value){
			case "Text":
				textConfig.style.display='block';
				break;
			case "rtf":
				textConfig.style.display='block';
				break;
			case "Tickbox":
				break;
			case "Straight Text":
				break;
			case "Select":
				dropdownConfig.style.display='block';
				break;
			case "Ticklist":
				dropdownConfig.style.display='block';
				break;
			case "Radiolist":
				dropdownConfig.style.display='block';
				break;
			case "Xftable":
				dropdownConfig.style.display='block';
				break;
		}
	}

	function switchList(showObj){

		for (i=0;i<jsTableNames.length ;i++ ){
				var obj=eval('fieldList' + jsTableNames[i]);
				obj.style.display='none';
		}
		if (showObj.value){
			obj=eval('fieldList' + showObj.value);
			obj.style.display='block';
		}
	}


	function hideThis(obj){
		obj.style.zIndex=0;
		obj.style.display='none';

	}
	
	function showThis(obj){
		obj.style.zIndex=10;
		obj.style.display='block';
	}

	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
	function populateForm(id, tableName, fieldName, desc, ftype, len, height, lim, source, nl, order, man, error, deflt, fHlp, top){
		
		for (i=0; i<jsTableNames.length; i++ ){
			var obj=eval('fieldList' + jsTableNames[i]);
			var dropObj=eval('mainform.fields' + jsTableNames[i]);
			obj.style.display='none';
			if (tableName==jsTableNames[i]){
				obj.style.display='block';
				dropObj.value=fieldName;
			}
		}

		tableList.style.display='none';
		
		tableBox.style.display='block';
		tableBox.innerHTML=tableName;
		
		editField.style.zIndex=10;
		editField.style.top=document.body.scrollTop+top;
		editField.style.display='block';

		mainform.fieldID.value=id;
		mainform.fieldName.value=fieldName;
		mainform.tableName.value=tableName;
		mainform.fDesc.value=desc;
		mainform.fType.value=ftype;
		mainform.fHelp.value=fHlp;

		chooseConfig(mainform.fType);


		mainform.fLen.value=len;
		mainform.fHeight.value=height;
		mainform.fLim.value=lim;
		mainform.fSource.value=source;
		if (nl=='y'){mainform.fNull.checked=true;}
		mainform.fOrd.value=order;
		if (man=='y'){mainform.fMan.checked=true;}
		mainform.fError.value=error;
		mainform.fDefault.value=deflt;

	}

	function newForm(top){
			for (i=0;i<jsTableNames.length ;i++ ){
				var obj=eval('fieldList' + jsTableNames[i]);
				obj.style.display='none';
		}
		tableList.style.display='block';
		
		tableBox.style.display='none';

		editField.style.zIndex=10;
		editField.style.top=document.body.scrollTop+top;
		editField.style.display='block';
		mainform.fieldID.value='new';

		mainform.fieldName.value='';
		mainform.tableName.value='';
		mainform.fDesc.value='';
		mainform.fType.value='';

		mainform.fLen.value='';
		mainform.fHeight.value='';
		mainform.fLim.value='';
		mainform.fSource.value='';
		mainform.fNull.value='';
		mainform.fOrd.value='';
		mainform.fMan.checked=false;
		mainform.fError.value='';
		mainform.fDefault.value='';
	}







var isNav4, isNav6, isIE4;


/*
 * Browser version snooper; determines your browser
 * (Navigator 4, Navigator 6, or Internet Explorer 4/5)
 */

    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }





function showMenu( divNum,minusGif, plusGif )
{
    if (getIdProperty( "s" + divNum, "display") != "block" )
    {
        setIdProperty("s" + divNum, "display", "block");
        document.images["i" + divNum].src = minusGif;
		document.cookie="s_" + divNum + '=y';
    }
    else
    {
        setIdProperty("s" + divNum, "display", "none");
        document.images["i" + divNum].src = plusGif;
		document.cookie="s_" + divNum + '=""';
    }
}




/*
 *
 * Given a selector string, return a style object
 * by searching through stylesheets. Return null if
 * none found
 *
 */
function getStyleBySelector( selector )
{
    if (!isNav6)
    {
        return null;
    }
    var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    /* look through stylesheets in reverse order that
       they appear in the document */
    for (i=sheetList.length-1; i >= 0; i--)
    {
        ruleList = sheetList[i].cssRules;
        for (j=0; j<ruleList.length; j++)
        {
            if (ruleList[j].type == CSSRule.STYLE_RULE &&
                ruleList[j].selectorText == selector)
            {
                return ruleList[j].style;
            }   
        }
    }
    return null;
}

/*
 *
 * Given an id and a property (as strings), return
 * the given property of that id.  Navigator 6 will
 * first look for the property in a tag; if not found,
 * it will look through the stylesheet.
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 */
function getIdProperty( id, property )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
    }
    else if (isNav4)
    {
        return document[id][property];
    }
    else
    {
        return document.all[id].style[property];
    }
}

/*
 *
 * Given an id and a property (as strings), set
 * the given property of that id to the value provided.
 *
 * The property is set directly on the tag, not in the
 * stylesheet.
 *
 */
function setIdProperty( id, property, value )
{
    if (isNav6)
    {
		
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
        
        /*
        styleObject = getStyleBySelector( "#" + id );
        if (styleObject != null)
        {
            styleObject[property] = value;
        }
        */
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}

/*
 *
 * Move a given id.  If additive is true,
 * then move it by xValue dots horizontally and
 * yValue units vertically.  If additive is
 * false, then move it to (xValue, yValue)
 *
 * Note: do not precede the id with a # -- it will be
 * appended when searching the stylesheets
 *
 * Note also: length units are preserved in Navigator 6
 * and Internet Explorer. That is, if left is 2cm and
 * top is 3cm, and you move to (4, 5), the left will
 * become 4cm and the top 5cm.
 *
 */
function generic_move( id, xValue, yValue, additive )
{
    var left = getIdProperty(id, "left");
    var top = getIdProperty(id, "top");
    var leftMatch, topMatch;

    if (isNav4)
    {
        leftMatch = new Array( 0, left, "");
        topMatch = new Array( 0, top, "");
    }
    else if (isNav6 || isIE4 )
    {
        var splitexp = /([-0-9.]+)(\w+)/;
        leftMatch = splitexp.exec( left );
        topMatch = splitexp.exec( top );
        if (leftMatch == null || topMatch == null)
        {
            leftMatch = new Array(0, 0, "px");
            topMatch = new Array(0, 0, "px");
        }
    }
    left = ((additive) ? parseFloat( leftMatch[1] ) : 0) + xValue;
    top = ((additive) ? parseFloat( topMatch[1] ) : 0) + yValue;
    setIdProperty( id, "left", left + leftMatch[2] );
    setIdProperty( id, "top", top + topMatch[2] );
}

/*
 *
 * Move a given id to position (xValue, yValue)
 *
 */
function moveTo( id, x, y )
{
    generic_move( id, x, y, false );
}

/*
 *
 * Move a given id to (currentX + xValue, currentY + yValue)
 *
 */
function moveBy( id, x, y)
{
    generic_move( id, x, y, true );
}

/*
 *
 * Function used when converting rgb format colors
 * from Navigator 6 to a hex format
 *
 */ 
function hex( n )
{
    var hexdigits = "0123456789abcdef";
    return ( hexdigits.charAt(n >> 4) + hexdigits.charAt(n & 0x0f) );
}

/*
 *
 * Retrieve background color for a given id.
 * The value returned will be in hex format (#rrggbb)
 *
 */ 
function getBackgroundColor( id )
{
    var color;

    if (isNav4)
    {
        color = document[id].bgColor;
    }
    else if (isNav6)
    {
        var parseExp = /rgb.(\d+),(\d+),(\d+)./;
        var rgbvals;
        color = getIdProperty( id, "backgroundColor" );
        if (color)
        {
            rgbvals = parseExp.exec( color );
            if (rgbvals)
            {
                color = "#" + hex( rgbvals[1] ) + hex( rgbvals[2] ) +
                    hex( rgbvals[3] );
            }
        }
        return color;
    }
    else if (isIE4)
    {
        return document.all[id].backgroundColor;
    }
    return "";
}

/*
 *
 * Return a division's document
 * 
 */
function getDocument( divName )
{
    var doc;

    if (isNav4)
    {
        doc = window.document[divName].document;
    }
    else if (isNav6)
    {
        doc = document;
    }
    else if (isIE4)
    {
        doc = document;
    }
    return doc;
}

