//
// Engine Artus Builder Stage (Client)
// BITAM de México S.A. de C.V.
// Developer: Mirna Hernández Hernández
// Created: September 2003
// Modified: Febrero 2004 By: Mirna Hernández Hernández 
//

CRLF = "\n"
ElementIDs = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
NameIDs = ['Cell', 'Label', 'Image', 'Line', 'Rectangle', 'ProgressBar', 'URL', 'Banner', 'Period', 'DIM', 'Operator', 'OpeSplit', 'Gauge', 'Linker', 'DIVADO', 'Map', 'DIVTD', 'Thermometer', 'ATemplate']
component = null
oPopup = 0
showContextMenu = true
allowDrag = false
selectorID = 0
selectors = new Array()
selectedItems = new Array()
defaultStage = null
currentStage = null
currentGroup = null
GTID = 200000
NodeWaiting = null
NodeConsecutive = 1
GNodeConsecutive = 1
MapDialog = null
LoadCurrentStage = false

function applyAlignCenter()
{	if (component != null)
	{	var subitem, toolFrame
		if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if ((component.AWClassName == "AWDynamicTable") | (component.getAttribute("AWClassName") == "AWDim"))
		{	/*var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.textAlign = "center" */
			return
		}
		else
		{	subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].align = "center"
				else
					subitem.align = "center"
			}
			component.style.textAlign = "center"
		}
		toolFrame = window.parent.frames("toolbarFrame")
		toolFrame.ALeftIcon.className = "iconunselectedstyle"
		toolFrame.ACenterIcon.className = "graphselectedstyle"
		toolFrame.ARightIcon.className = "iconunselectedstyle"
		/*if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.textAlign = "center"
		}*/
	}
}

function applyAlignCenterTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyAlignCenter()
	}
}

function applyAlignLeft()
{	if (component != null)
	{	var subitem, toolFrame
		if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if ((component.AWClassName == "AWDynamicTable") | (component.getAttribute("AWClassName") == "AWDim"))
		{	/* var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
			{	for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.textAlign = "left"
			}*/
			return
		}
		else
		{	subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].align = "left"
				else
					subitem.align = "left"
			}
			component.style.textAlign = "left"
		}
		toolFrame = window.parent.frames("toolbarFrame")
		toolFrame.ALeftIcon.className = "graphselectedstyle"
		toolFrame.ACenterIcon.className = "iconunselectedstyle"
		toolFrame.ARightIcon.className = "iconunselectedstyle"
		/* if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.textAlign = "left"
		} */
	}
}

function applyAlignLeftTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyAlignLeft()
	}
}

function applyAlignRight()
{	if (component != null)
	{	var subitem, toolFrame
		if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if ((component.AWClassName == "AWDynamicTable") | (component.getAttribute("AWClassName") == "AWDim"))
		{	/* var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.textAlign = "right" */
			return
		}
		else
		{	subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].align = "right"
				else
					subitem.align = "right"
			}
			component.style.textAlign = "right"
		}
		toolFrame = window.parent.frames("toolbarFrame")
		toolFrame.ALeftIcon.className = "iconunselectedstyle"
		toolFrame.ACenterIcon.className = "iconunselectedstyle"
		toolFrame.ARightIcon.className = "graphselectedstyle"
		/* if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.textAlign = "right"
		} */
	}
}

function applyAlignRightTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyAlignRight()
	}
}

function applyAnalysisOption(strParams)
{	var anObject, anID, typeOpt, index
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	index = anID.substring(5)
	switch (typeOpt)
	{	case "NOM" :
			var newName = prompt(language()[47], language()[117], anObject.getAttribute("AWName"))
			if (newName != null)
				anObject.setAttribute("AWName", newName)
			break
		case "PAM" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Máximos y mínimos", window.parent.frames("treeFrame").getMetaData(), "all"],
						"dialogWidth: 410px; dialogHeight:205px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PAA" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Periodos anteriores", window.parent.frames("treeFrame").getMetaData(), "1D"],
						"dialogWidth: 410px; dialogHeight:175px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PAL" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Propiedades de indicador (Lineas)", window.parent.frames("treeFrame").getMetaData(), "1D"],
						"dialogWidth: 410px; dialogHeight:175px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PAR" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Propiedades de indicador (Radar)", window.parent.frames("treeFrame").getMetaData(), "1D"],
						"dialogWidth: 410px; dialogHeight:175px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PAI" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Tendencia Incremental", window.parent.frames("treeFrame").getMetaData(), "ND"],
						"dialogWidth: 410px; dialogHeight:135px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PAT" :
			showModalDialog('bitamanalysistemplatedialog.htm',
						[window, "Tendencia con propiedades", window.parent.frames("treeFrame").getMetaData(), "ND"],
						"dialogWidth: 410px; dialogHeight:135px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			break
		case "PA3" :
			break
		case "PRO" :
			break
		case "EYS" :
			break
		case "EYM" :
			break
		case "EY0" :
			break
		case "EYC" :
			break
	}
}

function applyBold()
{	var subitem
	if (component != null)
	{	if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if (component.style.fontWeight == "bold")
		{	component.style.fontWeight = "normal"
			window.parent.frames("toolbarFrame").BoldIcon.className = "iconunselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.fontWeight = "normal"
				else
					subitem.style.fontWeight = "normal"
			}
		}
		else
		{	component.style.fontWeight = "bold"
			window.parent.frames("toolbarFrame").BoldIcon.className = "graphselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.fontWeight = "bold"
				else
					subitem.style.fontWeight = "bold"
			}
		}
		if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.fontWeight = component.style.fontWeight
		}
		if (component.AWClassName == "AWDynamicTable")
		{	var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.fontWeight = component.style.fontWeight
		}
	}
}

function applyBoldTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyBold()
	}
}

function applyChoiceLineOption(strParams)
{	var anObject, container, anID, typeOpt, vColor
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	applyTo(anObject, typeOpt)
}

function applyChoiceTableOption(strParams)
{	var anObject, anID, typeOpt, index
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	index = anID.substring(5)
	switch (typeOpt)
	{	case "NOM" :
			var newName = prompt(language()[47], language()[117], anObject.getAttribute("AWName"))
			if (newName != null)
				anObject.setAttribute("AWName", newName)
			break
		case 'CED' :
			if (anObject.getAttribute("AWClassName") == "AWDynamicTable")
				ShowTDFloating(index)
			else
				ShowTDChartFloating(index)
			break
		case 'TSH' :
			var value = anObject.getAttribute("AWShow") == '1' ? '0' : '1'
			anObject.setAttribute("AWShow", value)
			if (value == '1')
				anObject.style.visibility = 'visible'
			else
				anObject.style.visibility = 'hidden'
			break
	}
}

function applyTo(anObject, typeOpt)
{	var lineWidth, orientation
	orientation = anObject.getAttribute("AWOrientation")
	if (orientation == 'Vertical')
		lineWidth = anObject.style.borderLeftWidth
	else
		lineWidth = anObject.style.borderTopWidth
	switch (typeOpt)
	{	case 'LPH':
		case 'Horizontal':
			if (anObject.getAttribute("AWOrientation") == 'Vertical')
			{	anObject.style.borderTop = anObject.style.borderLeft
				anObject.style.borderLeft = '#000000 1px none'
				anObject.setAttribute("AWOrientation", 'Horizontal')
				//anObject.style.borderColor = vColor
				//anObject.style.borderWidth = lineWidth
				tmp = anObject.style.width
				anObject.style.width = anObject.style.height
				anObject.style.height = tmp
			}
			break;
		case 'LPV':
		case 'Vertical' :
			if (anObject.getAttribute("AWOrientation") != 'Vertical')
			{	anObject.style.borderLeft = anObject.style.borderTop
				anObject.style.borderTop = '#000000 1px none'
				anObject.setAttribute("AWOrientation", 'Vertical')
				//anObject.style.borderColor = vColor
				//anObject.style.borderWidth = lineWidth
				tmp = anObject.style.width
				anObject.style.width = anObject.style.height
				anObject.style.height = tmp
			}
			break;
	}
}

function applyChoiceLinkOption(strParams)
{	var anObject, container, anID, typeOpt
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	switch (typeOpt)
	{	case 'HLP':
			var text
			if (anObject.tagName == 'IFRAME')
				text = anObject.getAttribute("Text")
			else
				text = anObject.innerText
			showModalDialog('bitamlinkpropertiesdialog.htm',
						[window, text, anObject.src, anObject.title, anObject.tagName],
						"dialogWidth: 405px; dialogHeight:170px; resizable: no; center:yes; help: no; status: no; scroll:no"
					);
			if (window.returnValue != null)
			{	var x, y, w, h, id, awName, backColor, color, font
				var fontSize, bold, italic, underline, align
				x = anObject.style.posLeft
				y = anObject.style.posTop
				w = anObject.style.posWidth
				h = anObject.style.posHeight
				id = anObject.id
				awName = anObject.AWName
				backColor = anObject.style.backgroundColor 
				color = anObject.style.color
				font = anObject.style.fontFamily
				fontSize = anObject.style.fontSize
				bold = anObject.style.fontWeight
				italic = anObject.style.fontStyle 
				underline = anObject.style.textDecorationUnderline
				align = anObject.style.textAlign
				mydiv.removeChild(anObject)
				anObject = createLink(x, y, w, h, window.returnValue[3], window.returnValue[0], window.returnValue[1], window.returnValue[2], id, awName)
				anObject.style.backgroundColor = backColor
				anObject.style.color = color
				anObject.style.fontFamily = font
				anObject.style.fontSize = fontSize
				anObject.style.fontWeight = bold
				anObject.style.fontStyle = italic
				anObject.style.textDecorationUnderline = underline
				anObject.style.textAlign = align
			}
			break;
	}
}

function applyChoiceMarqueeOption(strParams)
{	var anID, typeOpt, anObject
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	if (applyBorder(anObject, typeOpt))
		return
	switch (typeOpt)
	{	case "NOM" :
			var newName = prompt(language()[47], language()[117], anObject.getAttribute("AWName"))
			if (newName != null)
				anObject.setAttribute("AWName", newName)
			break
		case 'BS1' :
			anObject.scrollDelay = 150
			anObject.scrollAmount = 1
			break
		case 'BS2' :
			anObject.scrollDelay = 10
			anObject.scrollAmount = 2
			break
		case 'BS3' :
			anObject.scrollDelay = 1
			anObject.scrollAmount = 3
			break
		case 'BDR' :
			anObject.direction = 'right'
			break
		case 'BDL' :
			anObject.direction = 'left'
			break
		case 'BDU' :
			anObject.direction = 'up'
			break
		case 'BDD' :
			anObject.direction = 'down'
			break
		case 'BIM' :
			var filePath
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			filePath = getProjectName() + window.returnValue
			if ((filePath != null) & (filePath != ''))
			{	anObject.setAttribute("AWImage", filePath)
				updateBanner(anObject)
			}
			break
		case 'BSI' :
			var showImage = anObject.getAttribute("AWShowImg")
			if ((showImage == null) | (showImage == "true"))
				anObject.setAttribute("AWShowImg", "false")
			else
				anObject.setAttribute("AWShowImg", "true")
			updateBanner(anObject)
			break
		case 'BSP' :
			var showPeriod = anObject.getAttribute("AWShowPeriod")
			if ((showPeriod == null) | (showPeriod == "true"))
				anObject.setAttribute("AWShowPeriod", "false")
			else
				anObject.setAttribute("AWShowPeriod", "true")
			updateBanner(anObject)
			break
		case 'BSE' :
			var sep = anObject.getAttribute("AWSeparator")
			if (sep == null)
				sep = '-'
			sep = prompt('', language()[72], sep)
			if (sep != null)
			{	anObject.setAttribute("AWSeparator", sep)
				updateBanner(anObject)
			}
			break
		case 'GPR' :
			var awProp = anObject.getAttribute("AWProp")
			var indicators = getIndicatorsFrom(anObject)
			//var indName = getIndicatorsNameFor(indicators)
			showModalDialog('bitamgaugepropdialog.htm',
						[window, language()[55], awProp, indicators],
						"dialogWidth: 337px; dialogHeight:320px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
			if (window.returnValue != null)
				anObject.setAttribute("AWProp", window.returnValue)
			break			
	}
}

function applyChoicePeriodOption(strParams)
{	var anID, typeOpt, anObject
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	if (applyBorder(anObject, typeOpt))
		return
	switch (typeOpt)
	{	case 'PSE' :
			UnloadMainMenu()
			selectComponent(anObject)
			break
		case 'PSY' :
			UnloadMainMenu()
			var synCompts, components = getComponentsWithIndicators()
			synCompts = anObject.getAttribute("AWSynComp")
			if (synCompts == null)
				synCompts = ''
			synCompts = synCompts.split('|')
			for (var idx = 0; idx < components.length; idx++)
			{	
				if (includes(synCompts, splitId(components[idx][0].id)))
					components[idx][1] = true
			}
			showModalDialog('bitamsynchronizedialog.htm',
						[window, language()[78], components],
						"dialogWidth: 255px; dialogHeight:285px; resizable: no; center:yes; help: no; status: no; scroll:no"
					);
			components = window.returnValue
			if (components != null)
			{	synCompts = ''
				for (var idx = 0; idx < components.length; idx++)
				{	if (components[idx][1])
						synCompts += splitId(components[idx][0].id) + '|'
				}
				anObject.setAttribute("AWSynComp", synCompts)
			}
			break
	}
}

function applyBorder(anObject, kind)
{	switch (kind)
	{	case "OBR" :
		case "Regular" :
			anObject.style.border = "1px solid #000000"
			anObject.setAttribute("AWBorder", "Regular")
			return true
		case "OBN" :
		case "None" :
			anObject.style.border = "1px none #000000"
			anObject.setAttribute("AWBorder", "None")
			return true
		case "OBO" :
		case "Outset" :
			anObject.style.border = "2px outset #FFFFFF"
			anObject.setAttribute("AWBorder", "Outset")
			return true
		case "OBI" :
		case "Inset" :
			anObject.style.border = "2px inset #FFFFFF"
			anObject.setAttribute("AWBorder", "Inset")
			return true
		case "OBS" :
		case "Shadow" :
			anObject.style.border = "1px solid #000000"
			anObject.style.borderBottom = "2px groove #666666"
			anObject.style.borderRight = "2px groove #666666"
			anObject.setAttribute("AWBorder", "Shadow")
			return true
		case "OBF" :
		case "Frame" :
			anObject.style.borderRight = "2px groove #FFFFFF"
			anObject.style.borderTop = "1px solid #000000"
			anObject.style.borderLeft = "1px solid #000000"
			anObject.style.borderBottom = "2px groove #FFFFFF"
			anObject.setAttribute("AWBorder", "Frame")
			return true
	}
	return false
}

function applyChoiceOption(strParams)
{	var anID, typeOpt, anObject
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	if (applyBorder(anObject, typeOpt))
		return
	switch (typeOpt)
	{	case "NOM" :
			var newName = prompt(language()[47], language()[117], anObject.getAttribute("AWName"))
			if (newName != null)
				anObject.setAttribute("AWName", newName)
			break
		case "CSA" :
			if (anObject.getAttribute("AWShowAlarms") == "false")
				anObject.setAttribute("AWShowAlarms", 'true')
			else
			{	anObject.setAttribute("AWShowAlarms", 'false')
				anObject.style.backgroundColor = "#FFFFFF"
				anObject.style.color = "#000000"
			}
			break
		case "VIA" :
			if (anObject.getAttribute("AWImageAlarm") == "false")
				anObject.setAttribute("AWImageAlarm", 'true')
			else
			{	anObject.setAttribute("AWImageAlarm", 'false')      
				anObject.setAttribute("AWImage", null)
				updateImageOn(anObject)
			}
			break      
		case "FPT" :
			if ((anObject.AWClassName == "AWCell") & (anObject.getAttribute("AWShowAlarms") != "false"))
			{	alert(language()[84])
				return
			}
			anObject.all("container").vAlign = "top"
			break
		case "FPB" :
			if ((anObject.AWClassName == "AWCell") & (anObject.getAttribute("AWShowAlarms") != "false"))
			{	alert(language()[84])
				return
			}
			anObject.all("container").vAlign = "bottom"
			break
		case "FPM" :
			if ((anObject.AWClassName == "AWCell") & (anObject.getAttribute("AWShowAlarms") != "false"))
			{	alert(language()[84])
				return
			}
			anObject.all("container").vAlign = "middle"
			break
		case "FAL" :
			component = anObject
			applyAlignLeft()
			event.cancelBubble = false
			break
		case "FAR" :
			component = anObject
			applyAlignRight()
			event.cancelBubble = false
			break
		case "FAC" :
			component = anObject
			applyAlignCenter()
			event.cancelBubble = false
			break
		case "F3D" : 
			var bState = anObject.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled
			anObject.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled = !bState
			anObject.setAttribute("AW3D", !bState.toString())
			break
		case "LLL" :
			var value, linker = anObject.getAttribute("AWLinkerType")
			UnloadMainMenu()
			showModalDialog('bitamlinkerdialog.htm',
						[window, language()[56], linker, window.parent.frames("treeFrame").getScenarios(), anObject, GetMenuFavArray()],
						"dialogWidth: 275px; dialogHeight:230px; resizable: no; center:yes; help: no; status: no; scroll:no"
					);
			if (window.returnValue != null)
			{	linker = window.returnValue
				anObject.setAttribute("AWLinkerType", linker)
			}
			break
		case "LTX" :
			var aFont = anObject.all("container").all[0]
			editLabel(aFont)
			break
		case "LIM" :
			var filePath
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			filePath = getProjectName() + window.returnValue
			if ((filePath != null) & (filePath != ''))
			{	anObject.setAttribute("AWImage", filePath)
				updateImageOn(anObject)
			}
			break
		case "LPC" :
			anObject.setAttribute("AWImgPos", "0")
			updateImageOn(anObject)
			break
		case "LTL" :
			anObject.setAttribute("AWImgPos", "1")
			updateImageOn(anObject)
			break
		case "LTC" :
			anObject.setAttribute("AWImgPos", "2")
			updateImageOn(anObject)
			break
		case "LTR" :
			anObject.setAttribute("AWImgPos", "3")
			updateImageOn(anObject)
			break
		case "LCL" :
			anObject.setAttribute("AWImgPos", "4")
			updateImageOn(anObject)
			break
		case "LCR" :
			anObject.setAttribute("AWImgPos", "5")
			updateImageOn(anObject)
			break
		case "LBL" :
			anObject.setAttribute("AWImgPos", "6")
			updateImageOn(anObject)
			break
		case "LBC" :
			anObject.setAttribute("AWImgPos", "7")
			updateImageOn(anObject)
			break
		case "LBR" :
			anObject.setAttribute("AWImgPos", "8")
			updateImageOn(anObject)
			break
		case "LAF" :
			anObject.setAttribute("AWImgPos", "9")
			updateImageOn(anObject)
			break
		case "LMC" :
			anObject.setAttribute("AWImgPos", "10")
			updateImageOn(anObject)
			break
		case "LHD" :
			anObject.setAttribute("AWImgPos", "11")
			updateImageOn(anObject)
			break
		//Thermometer
		case "THZ" :
			var cColor, container, tRow, aCT, cvalue, bimg
			if (anObject.getAttribute("AWHorizontal") == 'true')
			{	anObject.setAttribute("AWHorizontal", 'false')
				aCT = anObject.all("CT")
				cvalue = aCT.width
				
				tRow = anObject.rows[0]
				tRow.removeChild(aCT)
				
				aCT = anObject.all("container")
				aCT.id = "CT"
				
				tRow = anObject.insertRow()
				aTD = tRow.insertCell()
				aTD.id = "container"
				aTD.height = cvalue
				cvalue = aTD.height
				aTD.width = "100%"
				aTD.style.backgroundColor = aCT.style.backgroundColor
				aTD.style.backgroundImage = aCT.style.backgroundImage
				
				aCT.height = cvalue
				aCT.width = "100%" 
				aCT.style.backgroundColor = "transparent"
				aCT.style.backgroundImage = ""
			}
			else
			{	anObject.setAttribute("AWHorizontal", 'true')
				container = anObject.all("container")
				cColor = container.style.backgroundColor
				bimg = container.style.backgroundImage
				cvalue = container.height
				
				tRow = anObject.rows[1]
				tRow.removeChild(container)
				tRow.removeNode()
				
				tRow = anObject.rows[0]
				container = anObject.all("CT")
				container.id = "container"
				container.width = cvalue
				cvalue = container.height
				container.height = "100%"
				container.style.backgroundColor = cColor
				container.style.backgroundImage = bimg
				
				aCT = tRow.insertCell()
				aCT.id = "CT"
				aCT.height = "100%"
				aCT.width = cvalue
			}
			cvalue = anObject.style.width
			anObject.style.width = anObject.style.height
			anObject.style.height = cvalue
			break
		case "TMX" :
			var iValue = anObject.getAttribute("AWMax")
			if (iValue == null)
				iValue = "100"
			iValue = prompt(language()[92], language()[42], iValue, true)
			if (iValue != null)
				anObject.setAttribute("AWMax", iValue)
			break
		case "TBI" :
			var pathImg
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			if ((window.returnValue != null) & (window.returnValue != ''))
			{	pathImg = getProjectName() + window.returnValue
				anObject.style.backgroundImage = "url(" + pathImg + ")"
				anObject.setAttribute("AWImage", pathImg)
			}
			break
		case "TBL" :
			anObject.style.backgroundImage = ''
			anObject.setAttribute("AWImage", '')
			break
		case "TBA" :
			if (anObject.getAttribute("AWAutoFit") == 'true')
				anObject.setAttribute("AWAutoFit", 'false')
			else
				anObject.setAttribute("AWAutoFit", 'true')
			break
		case "TID" :
			if (anObject.getAttribute("AWDisplace") == 'true')
				anObject.setAttribute("AWDisplace", 'false')
			else
				anObject.setAttribute("AWDisplace", 'true')
			break
		case "TII" :
			var container, pathImg
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			if ((window.returnValue != null) & (window.returnValue != ''))
			{	pathImg = getProjectName() + window.returnValue
				container = anObject.all("container")
				container.style.backgroundImage = "url(" + pathImg + ")"
				anObject.setAttribute("AWIndImage", pathImg)
			}
			break
		case "TIL" :
			container = anObject.all("container")
			container.style.backgroundImage = ""
			anObject.setAttribute("AWIndImage", '')
			break
	}
}

function applyChoiceImageOption(strParams)
{	var anID, typeOpt, anObject
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	switch (typeOpt)
	{	case "ISR" :
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			if ((window.returnValue != null) & (window.returnValue != ''))
			{	var pWidth, pHeight
				pWidth = anObject.style.posWidth
				pHeight = anObject.style.posHeight
				anObject.src = getProjectName() + window.returnValue
				anObject.setAttribute("AWImage", getProjectName() + window.returnValue)
				if (anObject.getAttribute("AWAutoFit") == 'true')
				{	anObject.style.width = pWidth
					anObject.style.height = pHeight
				}
				else
				{	anObject.style.width = ""
					anObject.style.height = ""
					anObject.style.width = anObject.offsetWidth
					anObject.style.height = anObject.offsetHeight
				}
			}
			break
		case "IAF" :
			if (anObject.getAttribute("AWAutoFit") == 'true')
			{	anObject.style.width = ""
				anObject.style.height = ""
				anObject.setAttribute("AWAutoFit", 'false')
				anObject.style.width = anObject.offsetWidth
				anObject.style.height = anObject.offsetHeight
			}
			else
			{	anObject.style.width = anObject.style.posWidth
				anObject.style.height = anObject.style.posHeight
				anObject.setAttribute("AWAutoFit", 'true')
			}
			break
	}
}

function applyChoiceMapOption(strParams)
{	var anID, typeOpt, anObject
	if (strParams == " ")
		return
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	anObject = document.all(anID)
	switch (typeOpt)
	{	case "NOM" :
			var newName = prompt(language()[47], language()[117], anObject.getAttribute("AWName"))
			if (newName != null)
				anObject.setAttribute("AWName", newName)
			break
		case 'MSA' :
			if (anObject.getAttribute("AWShowAlarms") == 'false')
				anObject.setAttribute("AWShowAlarms", 'true')
			else
				anObject.setAttribute("AWShowAlarms", 'false')
			break
		case 'MED' :
			break
		case 'MPR' :
			var data, aCube, files
			files = window.parent.frames("treeFrame").AWMaps
			if (files == null)
				files = ''
			data = new Array()
			data[0] = getCubeWithValue(anObject.getAttribute("AWCube"))
			aCube = data[0]
			if (aCube != null)
			{	/* data[1] = aCube.nodes[0].getNodeWithValue(anObject.getAttribute("AWIndicator"))
				data[2] = aCube.nodes[1].getNodeWithValue(anObject.getAttribute("AWDimension")) */
				
				data[1] = anObject.getAttribute("AWIndicator")
				data[2] = anObject.getAttribute("AWDimension")
				data[3] = anObject.getAttribute("AWBasedOn")
				if (data[3] == 'Points')
				{	data[4] = anObject.getAttribute("AWXAxis")
					data[5] = anObject.getAttribute("AWYAxis")
					data[6] = anObject.getAttribute("AWSize")
					data[7] = anObject.getAttribute("AWShowZeros")
				}
				else
				{	data[4] = anObject.getAttribute("AWFilePath")
					data[5] = anObject.getAttribute("AWBorderColor")
					data[6] = anObject.getAttribute("AWMapWidth")
					//data[7] = anObject.getAttribute("AWSelColor")
					data[7] = anObject.getAttribute("AWShowLabels")
					data[8] = anObject.getAttribute("AWUseAlarmBC")
				}
			}
			showModalDialog('bitammapdialog.htm',
							[window, language()[41], window.parent.frames("treeFrame").getMetaData(), data, files],
							"dialogWidth: 403px; dialogHeight:360px; resizable: no; center:yes; help: no; status: no; scroll:no"
							);
			if (window.returnValue != null)
			{	anObject.setAttribute("AWCube", window.returnValue[0].dragValue)
				anObject.setAttribute("AWIndicator", window.returnValue[1].dragValue)
				anObject.setAttribute("AWDimension", window.returnValue[2].dragValue)
				anObject.setAttribute("AWBasedOn", window.returnValue[3])
				if (window.returnValue[3] == 'Points')
				{	anObject.setAttribute("AWXAxis", window.returnValue[4].dragValue)
					anObject.setAttribute("AWYAxis", window.returnValue[5].dragValue)
					anObject.setAttribute("AWSize", window.returnValue[6])
					anObject.setAttribute("AWShowZeros", window.returnValue[7])
				}
				else
				{	anObject.setAttribute("AWFilePath", window.returnValue[4])
					anObject.setAttribute("AWBorderColor", window.returnValue[5])
					anObject.setAttribute("AWMapWidth", window.returnValue[6])
					//anObject.setAttribute("AWSelColor", window.returnValue[7])
					anObject.setAttribute("AWShowLabels", window.returnValue[7])
					anObject.setAttribute("AWUseAlarmBC", window.returnValue[8])
				}
			}
			break
		case 'MBO' :
			if (anObject.getAttribute("AWBorder") != 'None')
			{	anObject.setAttribute("AWBorder", 'None')
				anObject.style.border = "2px none #FFFFFF"
			}
			else
			{	anObject.setAttribute("AWBorder", 'Inset')
				anObject.style.border = "2px inset #FFFFFF"
			}
			break
		case 'MIS' :
			openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
			if (window.returnValue != null)
			{	var bimg
				bimg = anObject.all("BACKIMG")
				if (bimg == null)
				{	bimg = document.createElement('<img id="BACKIMG" src="" style="position:absolute;left:0px;top:0px;z-index:1">')
					anObject.insertBefore(bimg)
				}
				bimg.src = getProjectName() + window.returnValue
				if (anObject.getAttribute("AWAutoFit") == 'true')
				{	bimg.style.width = '100%'
					bimg.style.height = '100%'
				}
				else
				{	bimg.style.width = ''
					bimg.style.height = ''
				}
				anObject.setAttribute("AWPathImage", getProjectName() + window.returnValue)
			}
			break
		case 'MIC' :
			var bimg
			bimg = anObject.all("BACKIMG")
			if (bimg != null)
				anObject.removeChild(bimg)
			anObject.setAttribute("AWPathImage", null)
			break
		case 'MIF' :
			var bimg, autoFit
			bimg = anObject.all("BACKIMG")
			autoFit = anObject.getAttribute("AWAutoFit")
			if (autoFit == 'true')
			{	autoFit = 'false'
				if (bimg != null)
				{	bimg.style.width = ''
					bimg.style.height = ''
				}
			}
			else
			{	autoFit = 'true'
				if (bimg != null)
				{	bimg.style.width = '100%'
					bimg.style.height = '100%'
				}
			}
			anObject.setAttribute("AWAutoFit", autoFit)
			break
	}
}

function applyGroupOption(strParams)
{	if (strParams == " ")
		return
	var aGroup, typeOpt, anID
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	aGroup = rtree.detectNode_withId(rtree.nodes, anID)
	switch (typeOpt)
	{	case 'GNG' :
			createGroup()
			break
		case 'GNS' :
			var aName = prompt(language()[47], language()[49])
			if (aName != null)
			{	GNodeConsecutive++
				aNode = new ArtusFloatingNode(GNodeConsecutive, 1, "Stage", aName, "-1", "images/treestage.gif")
				aGroup.addChild(aNode)
				currentGroup = aGroup
				currentStage = aNode
				
				if (aGroup.state == 1)
				{	rtree.displayTree()
					window.parent.document.title = "Artus Designer - " + aName
					window.parent.frames("mainFrame").closeScenario()
				}
				else
				{	LoadCurrentStage = true
					rtree.updateTree(aGroup.id)
				}
				var toolFrame = window.parent.frames("toolbarFrame")
				toolFrame.fontSelect.disabled = false
				toolFrame.fontSizeSelect.disabled = false
				toolFrame.LWidthField.disabled = false
				toolFrame.button1.disabled = false
				toolFrame.button1.disabled = false
			}
			break
	}
}

function applyItalic()
{	var subitem
	if (component != null)
	{	if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if (component.style.fontStyle == "italic")
		{	component.style.fontStyle = "normal"
			window.parent.frames("toolbarFrame").ItalicIcon.className = "iconunselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.fontStyle = "normal"
				else
					subitem.fontStyle = "normal"
			}
		}
		else
		{	component.style.fontStyle = "italic"
			window.parent.frames("toolbarFrame").ItalicIcon.className = "graphselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.fontStyle = "italic"
				else
					subitem.fontStyle = "italic"
			}
		}
		if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.fontStyle = component.style.fontStyle
		}
		if (component.AWClassName == "AWDynamicTable")
		{	var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.fontStyle = component.style.fontStyle
		}
	}
}

function applyItalicTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyItalic()
	}
}

function applyStageOption(strParams)
{	if (strParams == " ")
		return
	var aNode, typeOpt, anID
	typeOpt = strParams.substring(0, 3)
	anID = strParams.substring(3, strParams.length)
	aNode = rtree.detectNode_withId(rtree.nodes, anID)
	switch (typeOpt)
	{	case 'SDF' :
			defaultStage = aNode
			break
	}
}

function applyUnderline()
{	var subitem
	if (component != null)
	{	if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		if (component.style.textDecorationUnderline)
		{	component.style.textDecorationUnderline = false
			window.parent.frames("toolbarFrame").UnderlineIcon.className = "iconunselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.textDecoration = 'none'
				else
					subitem.style.textDecoration = 'none'
			}
		}
		else
		{	component.style.textDecorationUnderline = true
			window.parent.frames("toolbarFrame").UnderlineIcon.className = "graphselectedstyle"
			subitem = component.all("container")
			if (subitem != null)
			{	if (subitem.tagName == null)
					for (var idx = 0; idx < subitem.length; idx++)
						subitem[idx].style.textDecoration = 'underline'
				else
					subitem.style.textDecoration = 'underline'
			}
		}
		if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.textDecorationUnderline = component.style.textDecorationUnderline
		}
		if (component.AWClassName == "AWDynamicTable")
		{	var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.textDecorationUnderline = component.style.textDecorationUnderline
		}
	}
}

function applyUnderlineTo()
{	event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
			window.parent.frames("mainFrame").applyUnderline()
	}
}

function asString()
{	var str, anElement, allComponents, value, aClassName
	str = ''
	allComponents = getAllComponents()
	for (var idx = 0; idx < allComponents.length; idx++)
	{	anElement = allComponents[idx]
		aClassName = anElement.getAttribute("AWClassName")
		switch (aClassName)
		{	case 'AWCell' :
				str += '.AWCell.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(4) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				str += 'AWIndicator:' + anElement.getAttribute("AWIndicator") + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.all("container").align + CRLF
				str += 'AWVAlign:' + anElement.all("container").vAlign + CRLF
				str += 'AW3DText:' + anElement.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled.toString() + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				str += 'AWShowAlarms:' + anElement.getAttribute("AWShowAlarms") + CRLF
				str += 'AWImage:' + anElement.getAttribute("AWImage") + CRLF
				str += 'AWImagePos:' + anElement.getAttribute("AWImgPos") + CRLF
        str += 'AWImageAlarm:' + anElement.getAttribute("AWImageAlarm") + CRLF        
				break
			case 'AWLabel' :
				str += '.AWLabel.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(5) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWText:' + anElement.innerText + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.style.textAlign + CRLF
				break
			case 'AWRect' :
				str += '.AWRect.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(9) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.borderColor + CRLF
				str += 'AWWidthLine:' + anElement.style.borderWidth + CRLF
				break
			case 'AWLine' :
				var orientation = anElement.getAttribute("AWOrientation")
				str += '.AWLine.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(4) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWOrientation:' + orientation + CRLF
				if (orientation == 'Vertical')
				{	str += 'AWColor:' + anElement.style.borderLeftColor + CRLF
					str += 'AWWidthLine:' + anElement.style.borderLeftWidth + CRLF
				}
				else
				{	str += 'AWColor:' + anElement.style.borderTopColor + CRLF
					str += 'AWWidthLine:' + anElement.style.borderTopWidth + CRLF
				}
				break
			case 'AWProgBar' :
				str += '.AWProgBar.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(11) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				str += 'AWIndicator1:' + anElement.getAttribute("AWIndicator1") + CRLF
				str += 'AWIndicator2:' + anElement.getAttribute("AWIndicator2") + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.style.textAlign + CRLF
				break
			case 'AWLink' :
				str += '.AWLink.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(3) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWLink:' + anElement.src + CRLF
				str += 'AWIFrame:' + (anElement.tagName == 'IFRAME') + CRLF
				str += 'AWText:' + (anElement.tagName == 'IFRAME' ? anElement.getAttribute("Text") : anElement.innerText) + CRLF
				str += 'AWTooltip:' + anElement.title + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.style.textAlign + CRLF
				break
			case 'AWBanner' :
				var tmp, indicators = getIndicatorsFrom(anElement)
				str += '.AWBanner.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(6) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				str += 'AWIndicatorsSize:' + indicators.length + CRLF
				for (var i = 0; i < indicators.length; i++)
					str += 'AWIndicator' + (i + 1) + ':' + indicators[i] + CRLF
				str += 'AWSpeed:' + anElement.scrollAmount + CRLF
				str += 'AWDirection:' + anElement.getAttribute("direction") + CRLF
				tmp = anElement.getAttribute("AWBorder")
				str += 'AWBorder:' + ((tmp == null) ? 'Outset' : tmp) + CRLF
				str += 'AWImage:' + anElement.getAttribute("AWImage") + CRLF
				tmp = anElement.getAttribute("AWShowImg")
				str += 'AWShowImg:' + ((tmp == null) ? 'true' : tmp) + CRLF
				tmp = anElement.getAttribute("AWShowPeriod")
				str += 'AWShowPeriod:' + ((tmp == null) ? 'true' : tmp) + CRLF
				tmp = anElement.getAttribute("AWSeparator")
				str += 'AWSeparator:' + ((tmp == null) ? '-' : tmp) + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				break
			case 'AWPeriod' :
				var synComps = anElement.getAttribute("AWSynComp")
				if (synComps == null)
					synComps = ''
				
				str += '.AWPeriod.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(6) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				str += 'AWSynComp:' + synComps + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.style.textAlign + CRLF
				break
			case 'AWDim' :
				var synComps = anElement.getAttribute("AWSynComp")
				if (synComps == null)
					synComps = ''
				str += '.AWDim.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(3) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWDimension:' + anElement.getAttribute("AWDim") + CRLF
				str += 'AWSynComp:' + synComps + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				str += 'AWFilterPer:' + anElement.getAttribute("AWFilterPer") + CRLF
				break
			case 'AWGauge' :
				var indicators = getIndicatorsFrom(anElement)
				str += '.AWGauge.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(5) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				for (var i = 0; i < indicators.length; i++)
					str += 'AWIndicator' + (i + 1) + ':' + indicators[i] + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				str += 'AWProp:' + anElement.getAttribute("AWProp") + CRLF
				break
			case 'AWImage' :
				str += '.AWImage.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(5) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWImage:' + anElement.getAttribute("AWImage") + CRLF
				str += 'AWAutoFit:' + anElement.getAttribute("AWAutoFit") + CRLF
				break
			case 'AWOperator' :
			case 'AWOpDiv' :
				var synComps = anElement.getAttribute("AWSynComp")
				if (synComps == null)
					synComps = ''
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(8) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWSynComp:' + synComps + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				break
			case 'AWLinker' :
				var linkType
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(6) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				linkType = anElement.getAttribute('AWLinkerType')
				str += 'AWLinkerType:' + linkType + CRLF
				switch (linkType)
				{	case '0' :
						str += 'AWLinkerGroupScen:' + anElement.getAttribute("AWLinkerGroupScen") + CRLF
						break
					case '-3' :
						str += 'AWLinkerPapiroUrl:' + anElement.getAttribute("AWLinkerPapiroUrl") + CRLF
						str += 'AWLinkerPapiroReport:' + anElement.getAttribute("AWLinkerPapiroReport") + CRLF
						str += 'AWLinkerPapiroArtusUsr:' + anElement.getAttribute("AWLinkerPapiroArtusUsr") + CRLF
						str += 'AWLinkerPapiroUser:' + anElement.getAttribute("AWLinkerPapiroUser") + CRLF
						str += 'AWLinkerPapiroPass:' + anElement.getAttribute("AWLinkerPapiroPass") + CRLF
						break
					case '-9' :
						str += 'AWHideShowComp:' + anElement.getAttribute("AWHideShowComp") + CRLF
						break
					case '-16' :
						str += 'AWTabComp:' + anElement.getAttribute("AWTabComp") + CRLF
						break
					case '-18' :
						str += 'AWLinkerFav:' + anElement.getAttribute("AWLinkerFav") + CRLF
				}
				str += 'AWText:' + anElement.innerText + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				str += 'AWFont:' + anElement.style.fontFamily + CRLF
				str += 'AWFontSize:' + anElement.style.fontSize + CRLF
				str += 'AWBold:' + anElement.style.fontWeight + CRLF
				str += 'AWItalic:' + anElement.style.fontStyle + CRLF
				str += 'AWUnderline:' + anElement.style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + anElement.style.textAlign + CRLF
				str += 'AWVAlign:' + anElement.all("container").vAlign + CRLF
				str += 'AW3DText:' + anElement.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled.toString() + CRLF
				str += 'AWImage:' + anElement.getAttribute("AWImage") + CRLF
				str += 'AWImagePos:' + anElement.getAttribute("AWImgPos") + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				break
			case 'AWHighLight' :
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(6) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				break
			case 'AWMap' :
				var aCube, aNode
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(3) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWPeriod:' + anElement.getAttribute("AWPeriod") + CRLF
				str += 'AWCube:' + anElement.getAttribute("AWCube") + CRLF
				str += 'AWIndicator:' + anElement.getAttribute("AWIndicator") + CRLF
				str += 'AWDimension:' + anElement.getAttribute("AWDimension") + CRLF
				str += 'AWBasedOn:' + anElement.getAttribute("AWBasedOn") + CRLF
				if (anElement.getAttribute("AWBasedOn") == 'Points')
				{	str += 'AWXAxis:' + anElement.getAttribute("AWXAxis") + CRLF
					str += 'AWYAxis:' + anElement.getAttribute("AWYAxis") + CRLF
					str += 'AWSize:' + anElement.getAttribute("AWSize") + CRLF
					str += 'AWShowZeros:' + anElement.getAttribute("AWShowZeros") + CRLF
				}
				else
				{	str += 'AWFilePath:' + anElement.getAttribute("AWFilePath") + CRLF
					str += 'AWBorderColor:' + anElement.getAttribute("AWBorderColor") + CRLF
					str += 'AWMapWidth:' + anElement.getAttribute("AWMapWidth") + CRLF
					//str += 'AWSelColor:' + anElement.getAttribute("AWSelColor") + CRLF
					str += 'AWShowLabels:' + anElement.getAttribute("AWShowLabels") + CRLF
					str += 'AWShowAlarms:' + anElement.getAttribute("AWShowAlarms") + CRLF
					str += 'AWUseAlarmBC:' + anElement.getAttribute("AWUseAlarmBC") + CRLF
				}
				str += 'AWImage:' + anElement.getAttribute("AWPathImage") + CRLF
				str += 'AWAutoFit:' + anElement.getAttribute("AWAutoFit") + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				break
			case 'AWThermometer' :
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(11) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWBorder:' + anElement.getAttribute("AWBorder") + CRLF
				str += 'AWHorizontal:' + anElement.getAttribute("AWHorizontal") + CRLF
				str += 'AWMax:' + anElement.getAttribute("AWMax") + CRLF
				str += 'AWImage:' + anElement.getAttribute("AWImage") + CRLF
				str += 'AWAutoFit:' + anElement.getAttribute("AWAutoFit") + CRLF
				str += 'AWDisplace:' + anElement.getAttribute("AWDisplace") + CRLF
				str += 'AWIndImage:' + anElement.getAttribute("AWIndImage") + CRLF
				str += 'AWBackColor:' + anElement.style.backgroundColor + CRLF
				str += 'AWColor:' + anElement.style.color + CRLF
				break
			case 'AWDynamicTable' :
				var idx, id, header
				id = anElement.id.substring(5)
				header = anElement.all("TDH" + id)
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(5) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWMetaData:' + anElement.getAttribute("AWMetaData") + CRLF
				str += 'AWShow:' + anElement.getAttribute("AWShow") + CRLF
				str += 'AWBackColor:' + header.rows[0].cells[0].style.backgroundColor + CRLF
				str += 'AWColor:' + header.rows[0].style.color + CRLF
				str += 'AWFont:' + header.rows[0].cells[0].style.fontFamily + CRLF
				str += 'AWFontSize:' + header.rows[0].cells[0].style.fontSize + CRLF
				str += 'AWBold:' + header.rows[0].cells[0].style.fontWeight + CRLF
				str += 'AWItalic:' + header.rows[0].cells[0].style.fontStyle + CRLF
				str += 'AWUnderline:' + header.rows[0].cells[0].style.textDecorationUnderline + CRLF
				str += 'AWAlign:' + header.rows[0].cells[0].style.textAlign + CRLF
				break
			case 'AWChart' :
				str += '.' + aClassName + '.' + CRLF
				str += 'AWName:' + anElement.AWName + CRLF
				str += 'AWIdx:' + anElement.id.substring(5) + CRLF
				str += 'AWPosX:' + anElement.style.posLeft + CRLF
				str += 'AWPosY:' + anElement.style.posTop + CRLF
				str += 'AWWidth:' + anElement.style.posWidth + CRLF
				str += 'AWHeight:' + anElement.style.posHeight + CRLF
				str += 'AWMetaData:' + anElement.getAttribute("AWMetaData") + CRLF
				str += 'AWShow:' + anElement.getAttribute("AWShow") + CRLF
				break
		}
		str += '.AWCompSep.' + CRLF
	}
	return str
}

function changeWidthOfLine(aString)
{	if (component != null)
	{	if ((component.AWClassName == 'AWLine') | (component.AWClassName == 'AWRect'))
		{	var bwidth
			if (component.getAttribute("AWOrientation") == 'Vertical')
				bwidth = component.style.borderLeftWidth
			else
				bwidth = component.style.borderTopWidth
			bwidth = parseInt(bwidth, 10)
			if (aString == '+')
				bwidth++
			else
				bwidth--
			if ((bwidth > 0) & (bwidth <= 99))
			{	component.style.borderWidth = bwidth
				return bwidth
			}
		}
	}
	return null
}

function changeWidthLine(aString)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
	{	var bwidth = window.parent.frames("mainFrame").changeWidthOfLine(aString)
		if (bwidth != null)
			LWidthField.value = bwidth
	}
}

function createGroup()
{	var aName, aNode
	aName = prompt(language()[47], language()[64])
	if (aName != null)
	{	aNode = new ArtusFloatingNode(GTID, 1, "Group", aName, "-1", "images/treegroup.gif")
		rtree.nodes[rtree.nodes.length] = aNode
		rtree.displayTree()
		GTID++
	}
}

function createScenario()
{	var aName, aNode, aGroup
	aGroup = rtree.getSelectedGroup()
	if (aGroup == null)
	{	alert(language()[66])
		return
	}
	aName = prompt(language()[47], language()[49])
	if (aName != null)
	{	aNode = new ArtusFloatingNode(GTID, 1, "Stage", aName, "-1", "images/treestage.gif")
		aGroup.addChild(aNode)
		rtree.displayTree()
		GTID++
		window.parent.document.title = "Artus Designer - " + aName
		currentGroup = aGroup
		currentStage = aNode
		window.parent.frames("mainFrame").closeScenario()
	}
}

function deactiveMenu()
{	var menuDiv
	if (window.event.keyCode == 113)
		if (window.name == 'mainFrame')
			save()
		else
			saveScenario()
	if (window.event.keyCode == 27)
	{	//HideCalendar()
		if (nLastShownMenu != null)
		{	if (nLastShownMenu == 0)
				UnloadMainMenu()
			else
			{	if (nLastShownMenu > 0)
				{	menuDiv = document.all("m" + nLastShownMenu)
					if (menuDiv != null)
						hidemenu(menuDiv)
				}
			}
		}
	}
	if (window.event.keyCode == 46)		//Delete Selected Component
	{	if (component != null)
		{	switch (component.getAttribute("AWClassName"))
			{	case "AWAnalysis" :
				case "AWBanner" :
				case "AWCell" :
				case "AWDynamicTable" :
				case "AWGauge" :
				case "AWHighLight" :
				case "AWLinker" :
				case "AWMap" :
				case "AWProgBar" :
				case "AWThermometer" :
					var indexes, i, anObject, synCompts, newSynCompts, key
					indexes = [8, 9, 10, 11]
					for (var idx = 0; idx < indexes.length; idx++)
					{	i = indexes[idx]
						for (var j = 0; j < ElementIDs[i]; j++)
						{	anObject = mydiv.all(NameIDs[i] + j)
							if (anObject != null)
							{	synCompts = anObject.getAttribute("AWSynComp")
								if (synCompts != null)
								{	synCompts = synCompts.split('|')
									newSynCompts = ''
									key = splitId(component.id)
									for (var index = 0; index < synCompts.length; index++)
									{	if ((synCompts[index] != key) & (synCompts[index] != ''))
											newSynCompts += synCompts[index] + '|'
									}
									anObject.setAttribute("AWSynComp", newSynCompts)
								}
							}
						}
					}
			}
			if (component.getAttribute("AWClassName") == "AWChart")
			{	component.style.visibility = "hidden"
				component.setAttribute("AWShow", '0')
			}
			else
			{	if (component.getAttribute("AWClassName") == "AWDynamicTable")
				{	var brother = mydiv.all("Chart" + component.id.substring(5))
					if (brother != null)
						mydiv.removeChild(brother)
				}
				mydiv.removeChild(component)
			}
			unselect()
		}
	}
}

function displayCalendar(dateIni,param2,param3)
{	var anElement = window.event.srcElement
	BuildCalendar(dateIni,param2,param3,anElement.style.posTop + anElement.style.posHeight, anElement.style.posLeft + (anElement.style.posWidth / 2))
	window.event.cancelBubble = true
}

function dragColor(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	var data;
			if (anObject.id == "BKContainer")
				data = "06|" + anObject.style.backgroundColor
			else
				data = "07|" + anObject.style.backgroundColor
			window.event.dataTransfer.setData("text", data)
			window.event.dataTransfer.effectAllowed = "copy"
			window.event.dataTransfer.dropEffect = "copy"
		}
	}
}

function dragCreateComponent(data)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	window.event.dataTransfer.setData("text", data)
			window.event.dataTransfer.effectAllowed = "copy"
			window.event.dataTransfer.dropEffect = "copy"
		}
	}
}

function dragOverComponent()
{	window.event.returnValue = false
	window.event.cancelBubble = true
}

function dragOverStage()
{	var data = window.event.dataTransfer.getData("text") 
	if (allowDrag)
		window.event.returnValue = false
	else
	{	switch (data)
		{	case "08" :
			case "09" :
			case "10" :
			case "11" :
			case "12" :
			case "13" :
			case "14" :
			case "15" :
			case "16" :
			case "17" :
			case "18" :
			case "19" :
			case "20" :
			case "21" :
			case "22" :
			case "23" :
			case "24" :
			case "25" :
			case "26" :
				window.event.returnValue = false
				break
			default :
				window.event.returnValue = true
				break
		}
	}
}

function dragStart(anObject)
{	//component = anObject.parentElement
	componentOutline.style.posLeft = component.style.posLeft
	componentOutline.style.posTop = component.style.posTop
	componentOutline.style.posWidth = component.style.posWidth
	componentOutline.style.posHeight = component.style.posHeight
	componentOutline.style.visibility = "visible"
	allowDrag = true
}

function dragMoving()
{	
	var vLeft, vTop
	vLeft = document.body.scrollLeft + window.event.x + 2
	vTop = document.body.scrollTop + window.event.y + 2
	if (vLeft < mydiv.style.posLeft)
		vLeft = mydiv.style.posLeft
	if (vTop < mydiv.style.posTop)
		vTop = mydiv.style.posTop
	componentOutline.style.left = vLeft - mydiv.style.posLeft
	componentOutline.style.top = vTop - mydiv.style.posTop
}

function dragMovingEnd()
{	event.cancelBubble = true
	componentOutline.style.visibility = "hidden"
	component.style.posLeft = componentOutline.style.posLeft
	component.style.posTop = componentOutline.style.posTop
	selectComponent(component)
	allowDrag = false
	updateDIMPos(component)
}

function dragResizing(which)
{	var xShift, yShift
	xShift = document.body.scrollLeft + window.event.x + 2 - mydiv.style.posLeft
	yShift = document.body.scrollTop + window.event.y + 2 - mydiv.style.posTop
	if ((which == 'both') | (which == 'width'))
		componentOutline.style.posWidth = xShift - componentOutline.style.posLeft
	if ((which == 'both') | (which == 'height'))
	componentOutline.style.posHeight = yShift - componentOutline.style.posTop
}

function dragResizingEnd()
{	event.cancelBubble = true
	componentOutline.style.visibility = "hidden"
	component.style.posWidth = componentOutline.style.posWidth
	component.style.posHeight = componentOutline.style.posHeight
	selectComponent(component)
	allowDrag = false
	if (component.getAttribute("AWClassName") == "AWImage")
		component.setAttribute("AWAutoFit", 'true')
	updateDIMPos(component)
}

function drawInnerTree()
{
	vtree = new ArtusFloatingTree()
	vtree.showCheckBox = false
	vtree.forDemand = true
	vtree.events = 'onMouseDown=vtree.handleMouseDown() onMouseUp=vtree.handleMouseUp() onMouseOver=vtree.handleMouseOver() onMouseOut=vtree.handleMouseOut() onDragStart=vtree.handleDragStart()'
	vtree.nodes = copyNodesFrom(initTree(), vtree)
	vtree.displayTree()
	vtree.dragWithDescription = true
}

function drawAWScTree()
{
	rtree = new ArtusFloatingTree()
	rtree.name = 'treeStage'
	rtree.varName = 'rtree'
	rtree.showCheckBox = false
	rtree.forDemand = true
	rtree.events = 'onclick=loadStage() onMouseUp=showStageMenu() onContextMenu=handleContextMenu() onMouseDown=rtree.handleMouseDown() onMouseOver=rtree.handleMouseOver() onMouseOut=rtree.handleMouseOut() onDragStart=rtree.handleDragStart()'  
	rtree.nodes = copyNodesFrom(initScenariosTree(), rtree) 
	rtree.displayTree()
	rtree.dragWithDescription = true
	currentGroup = null
	currentStage = null
}

function dropOnCell(anObject)
{	var oData, dragValue, kind, value, description, idx, format, aClassName
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
	kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    aClassName = anObject.getAttribute("AWClassName")
    switch (kind)
    {	case "01" :
			anObject.setAttribute("AWPeriod", value)
			anObject.setAttribute("AWPeriodName", description)
			if (aClassName == "AWCell")
			{	//anObject.setAttribute("AWPFormat", format)
				setCellTooltip(anObject)
				if (anObject.getAttribute("AWIndicator") == null)
					anObject.all("container").innerText = description
				else
					anObject.all("container").innerText = getFormatedIndicatorTextFor(anObject, '')
			}
			else
			{	anObject.setAttribute("AWPeriodName", description)
				//anObject.setAttribute("AWPFormat", format)
				if (anObject.getAttribute("AWClassName") == "AWBanner")
					updateBanner(anObject)
				else
					setGaugeTooltip(anObject)
			}
			break;
		case "02" :
			if (anObject.getAttribute("AWClassName") == "AWCell")
			{	anObject.setAttribute("AWIndicator", value)
				anObject.setAttribute("AWIndicatorName", description)
				anObject.setAttribute("AWIFormat", format)
				setCellTooltip(anObject)
				anObject.all("container").innerText = getFormatedIndicatorTextFor(anObject, '')
			}
			else
			{	setIndicatorTo(anObject, value, null, description, format)
				if (anObject.getAttribute("AWClassName") == "AWBanner")
					updateBanner(anObject)
				else
					setGaugeTooltip(anObject)
			}
			break;
		case "06" :
			if ((anObject.AWClassName == "AWCell") & (anObject.getAttribute("AWShowAlarms") != "false"))
			{	alert(language()[84])
				return
			}
			anObject.style.backgroundColor = value
			break
		case "07" :
			if ((anObject.AWClassName == "AWCell") & (anObject.getAttribute("AWShowAlarms") != "false"))
			{	alert(language()[84])
				return
			}
			anObject.style.color = value
			if (anObject.getAttribute("AWClassName") == "AWBanner")
					updateBanner(anObject)
			break
    }
}

function dropOnDim(aWindow, anElement, dragValue)
{	var kind, value, idx, description, format, anObject, anID, tmp
	tmp = aWindow.name.split(" ")
	anID = "DIM" + (parseInt(tmp[1], 10))
	anObject = mydiv.all(anID)
	kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    switch (kind)
    {	case "03" :
			anObject.setAttribute("AWDim", value)
			idx = aWindow.name.indexOf("-")
			aWindow.name = aWindow.name.substring(0, idx + 1) + " " + description
			anObject.setAttribute("name", aWindow.name)
			anElement.innerText = aWindow.name.substring(7)
			break
		case "06" :
			anObject.style.backgroundColor = value
			anElement.style.backgroundColor = value
			break
		case "07" :
			anObject.style.color = value
			anElement.style.color = value
			break
    }
}

function dropOnLabel(anObject)
{	var oData, dragValue, kind, value, container, idx, description
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    
    container = anObject.all("container");
    anObject.contentEditable = false
    switch (kind)
    {	case "01" :
			if (anObject.getAttribute("AWClassName") == "AWPeriod")
			{	var str, idx
				anObject.setAttribute("AWPeriod", value)
				str = anObject.innerHTML
				idx = str.indexOf("<")
				str = description + '\n' + str.substring(idx, str.length)
				anObject.innerHTML = str
			}
			break;
		case "03" :
			if (anObject.getAttribute("AWClassName") == "AWDim")
			{	var opt
				anObject.setAttribute("AWDim", value)
				opt = new Option("All - " + description)
				anObject.add(opt)
			}
			break
		case "06" :
			if (container != null)
				container.style.backgroundColor = value
			anObject.style.backgroundColor = value
			break
		case "07" :
			if (container != null)
				container.style.color = value
			anObject.style.color = value
			break
    }
}

function dropOnLine(anObject)
{	var oData, dragValue, kind, value, container
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3, dragValue.length)
    switch (kind)
    {	case "07" :
			anObject.style.borderColor = value
			break
    }
}

function dropOnMap(anObject)
{	var oData, dragValue, kind, value, idx, description
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    switch (kind)
    {	case "01" :
			anObject.setAttribute("AWPeriod", value)
			anObject.title = description
			break;
	}
}

function dropOnProgressBar(anObject)
{	var oData, dragValue, kind, value, idx, description
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    switch (kind)
    {	case "01" :
			anObject.setAttribute("AWPeriod", value)
			anObject.setAttribute("AWPeriodName", description)
			//anObject.setAttribute("AWPFormat", format)
			setProgBarTooltip(anObject)
			break;
		case "02" :
			setIndicatorTo(anObject, value, 2, description, format)
			setProgBarTooltip(anObject)
			break;
    	case "06" :
			anObject.style.backgroundColor = value
			break
		case "07" :
			anObject.rows[0].style.color = value
			anObject.rows[0].cells[0].style.backgroundColor = value
			break
    }
}

function dropOnRect(anObject)
{	var oData, dragValue, kind, value
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3, dragValue.length)
    switch (kind)
    {	case "06" :
			anObject.style.backgroundColor = value
			break
		case "07" :
			anObject.style.borderColor = value
			break
    }
}

function dropOnStage(anObject)
{	var data = window.event.dataTransfer.getData("text") 
	switch (data)
	{	case "08" :
			createNewCell(window.event.x - 5, window.event.y - 5)
			break
		case "09" :
			createNewLabel(window.event.x - 5, window.event.y - 5)
			break
		case "10" :
			createNewImage(window.event.x - 5, window.event.y - 5)
			break
		case "11" :
			createNewRectangle(window.event.x - 5, window.event.y - 5)
			break
		case "12" :
			createNewLine(window.event.x - 5, window.event.y - 5)
			break
		case "13" :
			createNewProgressBar(window.event.x - 5, window.event.y - 5)
			break
		case "14" :
			createNewHiperlink(window.event.x - 5, window.event.y - 5)
			break
		case "15" :
			createNewBanner(window.event.x - 5, window.event.y - 5)
			break
		case "16" :
			createNewPeriod(window.event.x - 5, window.event.y - 5)
			break
		case "17" :
			createNewDim(window.event.x - 5, window.event.y - 5)
			break
		case "18" :
			createNewSpeedM(window.event.x - 5, window.event.y - 5)
			break
		case "19" :	
			createNewOperator(window.event.x - 5, window.event.y - 5, "AWOperator")
			break
		case "20" :	
			createNewOperator(window.event.x - 5, window.event.y - 5, "AWOpDiv")
			break
		case "21" :	
			createNewLinker(window.event.x - 5, window.event.y - 5)
			break
		case "22" :	
			createNewHighLight(window.event.x - 5, window.event.y - 5)
			break
		case "23" :	
			createNewMap(window.event.x - 5, window.event.y - 5)
			break
		case "24" :	
			createNewDynTable(window.event.x - 5, window.event.y - 5)
			break
		case "25" :	
			createNewThermometer(window.event.x - 5, window.event.y - 5)
			break
		case "26" :	
			createNewAnalysis(window.event.x - 5, window.event.y - 5)
			break
	}
}

function dropOnTable(anObject)
{	var oData, dragValue, kind, value, description, idx, format, allowDrop
	allowDrop = (anObject.getAttribute("AWMetaData") == null)
	oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
	if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    switch (kind)
    {	case "01" :
			if (allowDrop)
			{	var theader, id
				anObject.setAttribute("AWPeriod", value)
				id = anObject.id.substring(5)
				theader = anObject.all("TDH" + id)
				theader.all("container").innerText = description
				buildDynamicTable(anObject)
			}
			break;
		case "02" :
			if (allowDrop)
			{	anObject.setAttribute("AWIndicator", value)
				buildDynamicTable(anObject)
			}
			break;
		case "06" :
			var idx, id, header
			id = anObject.id.substring(5)
			header = anObject.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
			{	header.rows[idx].style.backgroundColor = value
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.backgroundColor = value
			}
			break
		case "07" :
			var idx, id, header
			id = anObject.id.substring(5)
			header = anObject.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				header.rows[idx].style.color = value
			anObject.style.color = value
			break 
    }
}

function buildDynamicTable(anObject)
{	if ((anObject.getAttribute("AWPeriod") != null) & (anObject.getAttribute("AWIndicator") != null))
	{	var idxKey, idxP, value, strParam, ind
		value = anObject.getAttribute("AWPeriod")
		idxKey = value.indexOf("K")
		idxP = value.indexOf("P")
		ind = anObject.getAttribute("AWIndicator")
		
		strParam = "WEBDANF,"
		strParam += anObject.id.substring(NameIDs[16].length)
		strParam += ","
		strParam += parseInt(value.substring(idxKey + 1, idxP), 10)
		strParam += ","
		strParam += value.substring(idxP + 1)
		strParam += ","
		strParam += parseInt(ind.substring(ind.indexOf("I") + 1), 10)
		stage(-3, strParam)		
	}
}

function dropOnThermometer(anObject)
{	var oData, dragValue, kind, value, description, idx, format
    oData = window.event.dataTransfer
    dragValue = oData.getData("text")
    if (dragValue == null)
		return;
    kind = dragValue.substring(0, 2)
    value = dragValue.substring(3)
    idx = value.indexOf("N")
    if (idx > -1)
    {	description = value.substring(idx + 1)
		value = value.substring(0, idx)
		idx = description.indexOf('AWF:')
		if (idx > -1)
		{	format = description.substring(idx + 4)
			description = description.substring(0, idx)
		}
    }
    switch (kind)
    {	case "01" :
			anObject.setAttribute("AWPeriod", value)
			anObject.setAttribute("AWPeriodName", description)
			//anObject.setAttribute("AWPFormat", format)
			setThermometerTooltip(anObject)
			break;
		case "02" :
			setIndicatorTo(anObject, value, 2, description, format)
			setThermometerTooltip(anObject)
			break;
		case "06" :
			anObject.style.backgroundColor = value
			break
		case "07" :
			anObject.all("container").style.backgroundColor = value
			break
    }
}

function editLabel(anObject)
{	var vTextRange
	anObject.contentEditable = true
	anObject.focus()
	vTextRange = document.body.createTextRange()
	vTextRange.moveToElementText(anObject)
	vTextRange.select()
	window.event.returnValue = false;
}

function endEditCell(anObject)
{	var theKeyCode, container
	theKeyCode = window.event.keyCode
	if (theKeyCode == 13)
		anObject.contentEditable = false
}

function fontChanged(faceName)
{	var subcont
	if (component != null)
	{	if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		component.style.fontFamily = faceName
		subcont = component.all("container")
		if (subcont != null)
		{	if (subcont.tagName == null)
				for (var idx = 0; idx < subcont.length; idx++)
					subcont[idx].style.fontFamily = faceName
			else
				subcont.style.fontFamily = faceName
		}
		if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.fontFamily = component.style.fontFamily
		}
		if (component.AWClassName == "AWDynamicTable")
		{	var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.fontFamily = component.style.fontFamily
		}		
	}
}

function fontChangedWith(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	var faceName
			window.event.cancelBubble = true
			faceName = anObject.options[anObject.selectedIndex].innerText
			window.parent.frames("mainFrame").fontChanged(faceName)
		}
	}
}

function fontSizeChanged(fontSz)
{	var subcont
	if (component != null)
	{	if ((component.AWClassName == "AWCell") & (component.getAttribute("AWShowAlarms") != "false"))
		{	alert(language()[84])
			return
		}
		component.style.fontSize = fontSz + "pt"
		subcont = component.all("container")
		if (subcont != null)
		{	if (subcont.tagName == null)
				for (var idx = 0; idx < subcont.length; idx++)
					subcont[idx].style.fontSize = fontSz + "pt"
			else
				subcont.style.fontSize = fontSz + "pt"
		}
		if (component.getAttribute("AWClassName") == "AWDim")
		{	var theFont = window.frames(component.id).document.all("myfont")
			if (theFont != null)
				theFont.style.fontSize = component.style.fontSize
		}
		if (component.AWClassName == "AWDynamicTable")
		{	var idx, id, header
			id = component.id.substring(5)
			header = component.all("TDH" + id)
			for (var idx = 0; idx < header.rows.length; idx++)
				for (var i = 0; i < header.rows[idx].cells.length; i++)
					header.rows[idx].cells[i].style.fontSize = component.style.fontSize
		}
	}
}

function fontSizeChangedWith(anObject)
{	var fontSz
	window.event.cancelBubble = true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	fontSz = anObject.options[anObject.selectedIndex].innerText
			window.parent.frames("mainFrame").fontSizeChanged(fontSz)
		}
	}
}

function formatDate(aDate, theFormat)
{	var yy, mm, dd, formated
	formated = theFormat.toLowerCase();
	yy = aDate.substring(0,4);
    mm = aDate.substring(4,6);
    dd = aDate.substring(6,8);
    
    if (formated.indexOf("dd") > -1)
		formated = formated.replace("dd", dd);
	else	
	{	if (formated.indexOf("d") > -1)
		{	dd = parseInt(dd, 10);
			formated = formated.replace("d", dd);
		}
	}	
	
	if (formated.indexOf("mmmm") > -1)
	{	mm = parseInt(mm, 10);
		months = [ null, "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ];
		mm = months[mm];
		formated = formated.replace("mmmm", mm);
	}
	else
	{	if (formated.indexOf("mmm") > -1)
		{	mm = parseInt(mm, 10);
			months = [ null, "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" ];
			mm = months[mm];
			formated = formated.replace("mmm", mm);
		}
		else
		{	if (formated.indexOf("mm") > -1)
				formated = formated.replace("mm", mm);
			else
			{	if (formated.indexOf("m") > -1)
				{	mm = parseInt(mm, 10);
					formated = formated.replace("m", mm);
				}
			}
		}
	}
	if (formated.indexOf("yyyy") > -1)
		formated = formated.replace("yyyy", yy);
	else
	{	if (formated.indexOf("yy") > -1)
			formated = formated.replace("yy", yy.substring(2, 4));
	}
	
	if (formated.indexOf("q") > -1)
	{	mm = parseInt(mm, 10);
		if (mm <= 3)
			formated = formated.replace("q", 1);
		else
		{	if (mm <= 6)
				formated = formated.replace("q", 2);
			else
			{	if (mm <= 9)
					formated = formated.replace("q", 3);
				else
					formated = formated.replace("q", 4);
			}
		}
	}
	return formated;
}

function formatNumber(aNumber, aFormat)
{
	aNumber = aNumber.toString()
	if (aFormat == '')
	{
		var formatedNumber = unformatNumber(aNumber, aFormat)
		return formatedNumber.toString()
	}
	var semicolonPos = indexOfChar(aFormat, ';')
	if (semicolonPos >= 0)
	{
		var positiveFormat = aFormat.substr(0, semicolonPos)
		var negativeFormat = aFormat.substr(semicolonPos + 1)
		var zeroFormat = null
		semicolonPos = indexOfChar(negativeFormat, ';')
		if (semicolonPos >= 0)
		{
			zeroFormat = negativeFormat.substr(semicolonPos + 1)
			negativeFormat = negativeFormat.substr(0, semicolonPos)
		}
		if (aNumber < 0)
		{
			return formatNumber(Math.abs(aNumber), negativeFormat);
		}
		else
		{
            if (aNumber > 0 || zeroFormat == null)
			{
				return formatNumber(aNumber, positiveFormat);
			}
			else
			{
				return formatNumber(aNumber, zeroFormat);
			}
		}
	}
	var firstPart, leftPart, rightPart;
	var decimalPos = indexOfChar(aFormat, '.');
	if (decimalPos >= 0)
	{
		leftPart = aFormat.substr(0, decimalPos);
		rightPart = aFormat.substr(decimalPos + 1);
		hasDecimalPoint = true;
	}
	else
	{
		leftPart = aFormat;
		rightPart = '';
		hasDecimalPoint = false;
	}
	firstPart = '';
  	var i = 0;
	while (i < leftPart.length)
	{
		var ch = leftPart.charAt(i);
		if (ch == '\\')
		{
			i++;
		}
		else
		{
			if (ch == '#') break;
			if (ch == '0') break;
		}
		i++;
	}
	firstPart = leftPart.substr(0, i);
	firstPart = firstPart.replace('\\', '');
	leftPart = leftPart.substr(i);
	if (leftPart == '')
	{
		leftPart = '#';
	}
	var thousandDivisor = 0;
	var hasThousandSeparator = (indexOfChar(leftPart, ',') != -1);
	if (hasThousandSeparator)
	{
  		var i = leftPart.length - 1;
		while (i >= 0)
		{
			if (i > 0 && leftPart.charAt(i - 1) == '\\')
			{
				i--;
			}
			else
			{
				var ch = leftPart.charAt(i);
				if (ch == '#') break;
				if (ch == '0') break;
				if (ch == ',') thousandDivisor++;
			}
			i--;
		}
		leftPart = removeChar(leftPart, ',');
	}
	thousandDivisor = Math.pow(1000, thousandDivisor);
	var percentageMultiplier = 0;
  	for (var i = 0; i < leftPart.length; i++)
  	{
		var ch = leftPart.charAt(i);
		if (ch == '\\')
		{
			i++;
		}
		else
		{
			if (ch == '%')
			{
				percentageMultiplier++;
			}
		}
	}
  	for (var i = 0; i < rightPart.length; i++)
  	{
		var ch = rightPart.charAt(i);
		if (ch == '\\')
		{
			i++;
		}
		else
		{
			if (ch == '%')
			{
				percentageMultiplier++;
			}
		}
	}
	percentageMultiplier = Math.pow(100, percentageMultiplier);
	var leftZeroDigits = 0;
	for (var i = 0; i < leftPart.length; i++)
	{
		var ch = leftPart.charAt(i);
		if (ch == '\\')
		{
			i++;
		}
		else
		{
			if (ch == '0') leftZeroDigits++;
			if (ch == '#' && leftZeroDigits > 0) leftZeroDigits++;
		}
	}
	var rightZeroDigits = 0;
	var rightDigits = 0;
	for (var i = rightPart.length - 1; i >= 0; i--)
	{
		if (i > 0 && rightPart.charAt(i - 1) == '\\')
		{
			i--;
		}
		else
		{
			var ch = rightPart.charAt(i);
			if (ch == '0')
			{
			 	rightZeroDigits++;
				rightDigits++;
			}
			else
			{
				if (ch == '#')
				{
        	    	if (rightZeroDigits > 0) rightZeroDigits++;
            		rightDigits++;
        		}
			}
		}
	}
	var formatedNumber = unformatNumber(aNumber, '');
	// formatedNumber = formatedNumber * (percentageMultiplier / thousandDivisor);
	formatedNumber = formatedNumber * (percentageMultiplier / thousandDivisor);
	var isNegative = false;
	if (formatedNumber < 0)
	{
		isNegative = true;
		formatedNumber = Math.abs(formatedNumber);
	}
	divisor = Math.pow(10, rightDigits);
	formatedNumber = Math.floor(formatedNumber * divisor + 0.50000000001);
	var fraction = (formatedNumber % divisor).toString();
	formatedNumber = Math.floor(formatedNumber / divisor).toString();
	var rightZeros = '';
	for (var i = 0; i < (rightDigits - fraction.length); i++)
	{
			rightZeros = rightZeros + '0';
	}
	fraction = rightZeros + fraction;
	fraction = fraction.substr(fraction.length - rightDigits, rightDigits);
	var i = fraction.length;
	while (i > rightZeroDigits && fraction.charAt(i - 1) == '0')
	{
		i--;
	}
	fraction = fraction.substr(0, i);
	var leftZeros = '';
	for (var i = 0; i < leftZeroDigits - formatedNumber.length; i ++)
	{
			leftZeros = leftZeros + '0';
	}
	formatedNumber = leftZeros + formatedNumber;
	var i = formatedNumber.length;
	while (i > leftZeroDigits && formatedNumber.charAt(formatedNumber.length - i) == '0')
	{
		i--;
	}
	formatedNumber = formatedNumber.substr(formatedNumber.length - i);
	var digits = 0;
	var formatPos = leftPart.length - 1;
	var numberPos = formatedNumber.length - 1;
	for (var i = 0; i < leftPart.length; i++)
	{
		if (formatPos > 0 && leftPart.charAt(formatPos - 1) == '\\')
		{
			var ch = leftPart.charAt(formatPos);
			formatedNumber = formatedNumber.substr(0, numberPos + 1) + ch + formatedNumber.substr(numberPos + 1);
			formatPos--;
		}
		else
		{
			var ch = leftPart.charAt(formatPos);
			if (ch == '#' || ch == '0')
			{
				if (digits == 3)
				{
					if (hasThousandSeparator && numberPos >= 0)
					{
						formatedNumber = formatedNumber.substr(0, numberPos + 1) + ',' + formatedNumber.substr(numberPos + 1);
					}
					digits = 0;
				}
				digits++;
				numberPos--;
			}
			else
			{
				formatedNumber = formatedNumber.substr(0, numberPos + 1) + ch + formatedNumber.substr(numberPos + 1);
			}
		}
		formatPos--;
	}
	if (hasThousandSeparator)
	{
		while (numberPos >= 0)
		{
			if (digits == 3)
			{
				formatedNumber = formatedNumber.substr(0, numberPos + 1) + ',' + formatedNumber.substr(numberPos + 1);
				digits = 0;
			}
			digits++;
			numberPos--;
		}
	}
	var formatPos = 0;
	var numberPos = 0;
	for (var i = 0; i < rightPart.length; i++)
	{
		var ch = rightPart.charAt(formatPos);
		if (ch == '\\')
		{
			formatPos++;
			var ch = rightPart.charAt(formatPos);
			fraction = fraction.substr(0, numberPos) + ch + fraction.substr(numberPos);
		}
		else
		{
			if (ch != '#' && ch != '0')
			{
				fraction = fraction.substr(0, numberPos) + ch + fraction.substr(numberPos);
			}
		}
		formatPos++;
		numberPos++;
	}
	if (hasDecimalPoint)
	{
		return (((isNegative) ? '-' : '') + firstPart + formatedNumber + '.' + fraction);
	}
	else
	{
		return (((isNegative) ? '-' : '') + firstPart + formatedNumber);
	}
}

function closeScenario()
{	var currentGroup, currentStage
	currentGroup = window.parent.frames("treeFrame").currentGroup
	currentStage = window.parent.frames("treeFrame").currentStage
	str = 'AWDSaveStage\nAWDG:' + currentGroup.name + '|' + currentGroup.dragValue + '\nAWDS:' + currentStage.name + '|-1'
	window.parent.frames("mainFrame").document.forms.ScenForm.txtParametros.value = "AWDEvent:NewStage:" + str
	window.parent.frames("mainFrame").document.forms.ScenForm.submit()
}

function getAlignOptionsWith(vAlign)
{	var aOpts
	aOpts = language()[38]
	if (vAlign == "left")
		aOpts += "*"
	aOpts += "," + language()[60]
	if (vAlign == "right")
		aOpts += "*"
	aOpts += "," + language()[13]
	if (vAlign == "center")
		aOpts += "*"
	return aOpts
}

function getAllComponents()
{	var anElement, myComponents = new Array()
	for (var idx = 0; idx < NameIDs.length; idx++)
	{	for (var i = 1; i < ElementIDs[idx]; i++)
		{	anElement = mydiv.all(NameIDs[idx] + i)
			if (anElement != null)
				myComponents[myComponents.length] = anElement
			if (idx == 16)
			{	anElement = mydiv.all("Chart" + i)
				if (anElement != null)
					myComponents[myComponents.length] = anElement
			}
		}
	}
	return myComponents
}

function getBorderOptionsWith(vAWBorder)
{	var bOptions
	bOptions = language()[59]
	if (vAWBorder == "Regular")
		bOptions += "*"
	bOptions += "," + language()[51]
	if (vAWBorder == "None")
		bOptions += "*"
	bOptions += "," + language()[53]
	if (vAWBorder == "Outset")
		bOptions += "*"
	bOptions += "," + language()[37]
	if (vAWBorder == "Inset")
		bOptions += "*"
	bOptions += "," + language()[73]
	if ((vAWBorder == "Shadow") | (vAWBorder == null))
		bOptions += "*"
	bOptions += "," + language()[27]
	if (vAWBorder == "Frame")
		bOptions += "*"
	return bOptions
}

function getComponentSelector(aClassName)
{	var strHtml, vcolor, cmpSelector, orientation
	if (aClassName == "AWLine")
	{	if (component.getAttribute("AWOrientation") == 'Vertical')
			return getNewLineSelector(2)
		else
			return getNewLineSelector(1)
	}
	else
	{	/*if (aClassName == "AWDim")
			return getNewComponentSelector(false)
		else*/
		return getNewComponentSelector(true)
	}
}

function getComponentsWithIndicators()
{	var anElement, item, components, all
	all = getAllComponents()
	components = new Array()
	for (var idx = 0; idx < all.length; idx++)
	{	anElement = all[idx]
		switch (anElement.getAttribute("AWClassName"))
		{	case "AWCell" :
			case "AWProgBar" :
			case "AWBanner" :
			case "AWGauge" :
			case "AWThermometer" :
			case "AWLinker" :
			case "AWMap" :
			case "AWDynamicTable" :
			case "AWHighLight" :
			case "AWAnalysis" :
				item = new Array()
				item[0] = anElement
				item[1] = false
				item[2] = false
				components[components.length] = item
				break
		}
	}
	return components
}

function getCubeWithName(aName)
{	var nodes = window.parent.frames("treeFrame").getMetaData()
	for (var idx = 0; idx < nodes.length; idx++)
		if (nodes[idx].name == aName)
			return nodes[idx]
	return null
}

function getCubeWithValue(aValue)
{	var nodes = window.parent.frames("treeFrame").getMetaData()
	for (var idx = 0; idx < nodes.length; idx++)
		if (nodes[idx].dragValue == aValue)
			return nodes[idx]
	return null
}

function getFormatedIndicatorTextFor(anObject, index)
{	var format
	format = anObject.getAttribute("AWIFormat" + index)
	if (format != null)
		return formatNumber('50.00', format)
	return '50'
}

function getIndicatorsFrom(anObject)
{	var idx, lastInd, indicators
	idx = 1
	indicators = new Array()
	lastInd = anObject.getAttribute("AWIndicator1")
	while (lastInd != null)
	{	idx++
		indicators[indicators.length] = lastInd
		lastInd = anObject.getAttribute("AWIndicator" + idx)
	}
	return indicators
}

function getIndicatorsNameFor(indArray)
{	var indicatorsName, nodes, value, aCube, indNode
	indicatorsName = new Array()
	for (var idx = 0; idx < indArray.length; idx++)
	{	value = indArray[idx].split("I")
		aCube = getCubeWithValue(value[0])
		if (aCube != null)
		{	indNode = aCube.nodes[0].getNodeWithValue("02|" + indArray[idx])
			if (indNode != null)
				indicatorsName[idx] = indNode.name
		}
	}
	return indicatorsName
}

function getNewComponentSelector(allTicks)
{	vcolor = "transparent"
	strHtml = '<div id="componentSelector' + selectorID + '" style="position:absolute; left:5px; top:5px; visibility:hidden;"></div>'
	cmpSelector = document.createElement(strHtml)
	strHtml = '		<div id="tickLayer1" style="position:absolute; left:0px; top:0px; width:5px; height:5px; font-size:2; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:move;"><img src="images/move.gif" style="z-index:100" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragMoving()" onDragEnd="javascript:dragMovingEnd()" onmouseup="javascript:showIfIsLinkMenu(this)"></img></div>' + CRLF
	strHtml += '	<div id="tickLayer2" style="position:absolute; right:0px; top:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer3" style="position:absolute; left:48%; top:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer4" style="position:absolute; left:0px; top:48%; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer5" style="position:absolute; right:-1px; top:48%; width:7px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:e-resize;"><img src="images/resizeright.gif" style="z-index:100" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragResizing(\'width\')" onDrop="javascript:window.event.cancelBubble=true;" onDragEnd="javascript:dragResizingEnd()"></img></div>' + CRLF
	strHtml += '	<div id="tickLayer6" style="position:absolute; left:0px; bottom:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	if (allTicks)
	{	strHtml += '	<div id="tickLayer7" style="position:absolute; left:48%; bottom:-1px; width:5px; height:7px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:s-resize;"><img src="images/resizedown.gif" style="z-index:100" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragResizing(\'height\')" onDrop="javascript:window.event.cancelBubble=true;" onDragEnd="javascript:dragResizingEnd()"></img></div>' + CRLF
		strHtml += '	<div id="tickLayer8" style="position:absolute; right:1px; bottom:1px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:200;cursor:se-resize;"><img src="images/rbhdl.gif" style="z-index:100" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragResizing(\'both\')" onDrop="javascript:window.event.cancelBubble=true;" onDragEnd="javascript:dragResizingEnd()"></img></div>' + CRLF
	}
	else
	{	strHtml += '	<div id="tickLayer7" style="position:absolute; left:48%; bottom:-1px; width:5px; height:7px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
		strHtml += '	<div id="tickLayer8" style="position:absolute; right:1px; bottom:1px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:200;"></div>' + CRLF
	}
	cmpSelector.innerHTML = strHtml
	mydiv.insertBefore(cmpSelector)
	selectors[selectorID] = cmpSelector
	selectorID++
	return cmpSelector
}

function getNewLineSelector(orientation)
{	vcolor = "transparent"
	strHtml = '<div id="componentSelector' + selectorID + '" style="position:absolute; left:5px; top:5px; visibility:hidden;"></div>'
	cmpSelector = document.createElement(strHtml)
	strHtml = '		<div id="tickLayer1" style="position:absolute; left:0px; top:0px; width:5px; height:5px; font-size:2; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:move;"><img src="images/move.gif" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragMoving()" onDragEnd="javascript:dragMovingEnd()"></img></div>' + CRLF
	if (orientation == 1)
		strHtml += '	<div id="tickLayer2" style="position:absolute; right:-1px; top:0px; width:7px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:e-resize;"><img src="images/resizeright.gif" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragResizing(\'width\')" onDrop="javascript:window.event.cancelBubble=true;" onDragEnd="javascript:dragResizingEnd()"></img></div>' + CRLF
	else
		strHtml += '	<div id="tickLayer2" style="position:absolute; right:0px; top:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer3" style="position:absolute; left:48%; top:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer4" style="position:absolute; left:0px; top:48%; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer5" style="position:absolute; right:0px; top:48%; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	
	if (orientation == 1)
		strHtml += '	<div id="tickLayer6" style="position:absolute; left:0px; bottom:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	else
		strHtml += '	<div id="tickLayer6" style="position:absolute; left:0px; bottom:-1px; width:5px; height:7px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;cursor:s-resize;"><img src="images/resizedown.gif" border=0 width="100%" height="100%" onClick="javascript:window.event.cancelBubble=true;" onDragStart="javascript:dragStart(this)" onDrag="javascript:dragResizing(\'height\')" onDrop="javascript:window.event.cancelBubble=true;" onDragEnd="javascript:dragResizingEnd()"></img></div>' + CRLF
		
	strHtml += '	<div id="tickLayer7" style="position:absolute; left:48%; bottom:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	strHtml += '	<div id="tickLayer8" style="position:absolute; right:0px; bottom:0px; width:5px; height:5px; font-size:2px; background-color:' + vcolor + '; layer-background-color:' + vcolor + '; border: 1px none #000000;z-index:100;"></div>' + CRLF
	cmpSelector.innerHTML = strHtml
	mydiv.insertBefore(cmpSelector)
	selectors[selectorID++] = cmpSelector
	selectorID++
	return cmpSelector
}

function getMetaData()
{	return vtree.nodes
}

function getProjectName()
{	return (window.parent.frames("treeFrame").ProjectName + "\\")
}

function getScenarios()
{	return rtree.nodes
}

function getToolbarFrame()
{	return window.parent.frames("toolbarFrame")
}

function getVAlignOptionsWith(vAlign)
{	var tpOptions
	tpOptions = language()[86]
	if (vAlign == "top")
		tpOptions += "*"
	tpOptions += "," + language()[8]
	if (vAlign == "bottom")
		tpOptions += "*"
	tpOptions += "," + language()[44]
	if (vAlign == "middle")
		tpOptions += "*"
	return tpOptions
}

function handleContextMenu()
{	if (!showContextMenu)
		window.event.returnValue = false
	showContextMenu = true
}

function includes(anArray, anItem)
{	if (anArray == null)
		return
	for (var idx = 0; idx < anArray.length; idx++)
		if (anArray[idx] == anItem)
			return true
	return false
}

function indexOfChar(aString, aChar)
{
	for (var i = 0; i < aString.length; i++)
	{
		var ch = aString.charAt(i);
		if (ch == '\\')
		{
			i++;
		}
		else
		{
			if (ch == aChar)
			{
				return i;
			}
		}
	}
	return -1;
}

function interfaz()
{	return window.parent.frames("hiddenFrame")
}

function keyDownOnToolbar()
{	if (window.event.keyCode == 113)
		saveScenario()
}

function language()
{	return window.parent.frames("treeFrame").AWDLanguage 
}

function loadChildrenFor(aNode)
{
        if ((NodeWaiting.type == "Group") | (NodeWaiting.type == "GroupOLAP"))
	{	interfaz().document.forms.ScenForm.txtParametros.value = "AWDBuildTree:" + aNode.dragValue + ":" + (GNodeConsecutive + 1)
		interfaz().document.forms.ScenForm.submit()
	}
	else
	{	interfaz().document.forms.ScenForm.txtParametros.value = "AWDBuildTree:" + aNode.dragValue + ":" + (NodeConsecutive + 1)  
		interfaz().document.forms.ScenForm.submit()
	}
}

function loadCurrentStage()
{	var toolFrame, aBool
	window.parent.frames("mainFrame").document.ScenForm.target = "mainFrame"
	if ((currentStage != null) & (currentGroup != null))
	{	if (currentStage.dragValue != '-1')
		{	var str
			str = 'AWDLoadStage\nAWDG:' + currentGroup.name + '|' + currentGroup.dragValue + '\nAWDS:' + currentStage.name + '|' + currentStage.dragValue
			window.parent.document.title = "Artus Designer - " + currentStage.name
			window.parent.frames("mainFrame").document.forms.ScenForm.txtParametros.value = str
			window.parent.frames("mainFrame").document.forms.ScenForm.submit()
		}
		else
			window.parent.frames("mainFrame").closeScenario()
		toolFrame = window.parent.frames("toolbarFrame")
		aBool = currentStage.type == "StageOLAP"
		toolFrame.fontSelect.disabled = aBool
		toolFrame.fontSizeSelect.disabled = aBool
		toolFrame.LWidthField.disabled = aBool
		toolFrame.button1.disabled = aBool
		toolFrame.button1.disabled = aBool
	}	
}

function loadThisStage(sEsc)
{ 
	var toolFrame, aBool
	window.parent.frames("mainFrame").document.ScenForm.target = "mainFrame"
	var str
	str = 'AWDLoadStage\nAWDG:|\nAWDS:|' + sEsc
	window.parent.frames("mainFrame").document.forms.ScenForm.txtParametros.value = str
	window.parent.frames("mainFrame").document.forms.ScenForm.submit()
}

function SetNodeEscDefault()
{
	window.parent.frames("treeFrame").currentStage = null
}

function loadedChildren()
{	if (NodeWaiting == null)
		return
	var theNodes  
	NodeWaiting.goForChildren = false
	theNodes = interfaz().initTree()
	NodeWaiting.addNodes(theNodes)
	if (NodeWaiting.whenLoadedDo == "updateTree")
		if ((NodeWaiting.type == "Group") | (NodeWaiting.type == "GroupOLAP"))
		{	rtree.updateTree(NodeWaiting.id)
			if (LoadCurrentStage)
			{	LoadCurrentStage = false
				window.parent.document.title = "Artus Designer - " + currentStage.name
				window.parent.frames("mainFrame").closeScenario()			
			}
		}
		else
			vtree.updateTree(NodeWaiting.id)
	if (NodeWaiting.whenLoadedDo == "notifyMapDialog")
		window.parent.frames("mainFrame").MapDialog.loadedChildren()		
	NodeWaiting = null
}

function loadStage()
{	var aNode = rtree.detectNode_withId(rtree.nodes, rtree.selectedElement.id)
	if (aNode != null)
	{	if ((aNode.type == 'Stage') | (aNode.type == 'StageOLAP'))
		{	currentStage = aNode
			currentGroup = aNode.parent
			loadCurrentStage()
		}
		else
		{	if (aNode.type == 'Group')
			{	var strMenu
				strMenu = language()[48] +  ',' + language()[49]
				SetShowMenuOnClick()
				AddMenu('applyGroupOption','',strMenu, 'GNG' + aNode.id + ',GNS' + aNode.id)
			}
		}
	}
}

function newGroup()
{	window.parent.frames("treeFrame").createGroup()
}

function newScenario()
{	window.parent.frames("treeFrame").createScenario()
}

function openChooseColor(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	currentContainerColor = anObject
			if (oPopup == 0)
				createChooseColorPopup("setColor")
			oPopup.show(-170, 6, 345, 210, currentContainerColor)
		}
	}
}

function openFileDialog(filters, relativePath)
{	showModalDialog('bitamfiledialog.htm',
						[window, filters, relativePath],
						"dialogWidth: 419px; dialogHeight:140px; resizable: no; center:yes; help: no; status: no; scroll:no"
					)
}

function prompt(aString, aTitle, pinitValue, numeric)
{	var validNumeric, initValue
	initValue = pinitValue == null ? '' : pinitValue
	validNumeric = numeric == null ? false : numeric
	showModalDialog('bitampromptdialog.htm',
						[window, aTitle, aString, initValue, validNumeric,language()[52], language()[12] ],
						"dialogWidth:345px; dialogHeight:138px; resizable: no; center:yes; help: no; status: no; scroll:no"
					);
	return window.returnValue
}

function pubScenario()
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type != "StageOLAP")
		{	var usersPub, groupsPub
			usersPub = window.parent.frames("treeFrame").UsersPub
			if (usersPub == null)
			{	usersPub = new Array()
			}
			groupsPub = window.parent.frames("treeFrame").GroupsPub
			if (groupsPub == null)
			{	groupsPub = new Array()
			}
			showModalDialog
				('bitamstagepubdialog.htm',
				[window, language()[65], usersPub, groupsPub, window.parent.frames("treeFrame").rtree.nodes],
				"dialogWidth: 454px; dialogHeight: 395px; resizable: no; center: yes; help: no; status: no; scroll: no"
				);
			if (window.returnValue != null)
			{	usersPub = window.returnValue[0]
				groupsPub = window.returnValue[1]
				window.parent.frames("treeFrame").setUsersAndGroups(usersPub, groupsPub)
			}
		}
	}
}

function removeChar(aString, aChar)
{	for (var i = aString.length - 1; i >= 0; i--)
	{
		var ch = aString.charAt(i);
		if (ch == '\\')
		{
			i--;
		}
		else
		{
			if (ch == aChar)
			{
				aString = aString.substr(0, i) + aString.substr(i + 1);
			}
		}
	}
	return aString;
}

function save()
{	var currentGroup, currentStage
	currentGroup = window.parent.frames("treeFrame").currentGroup
	currentStage = window.parent.frames("treeFrame").currentStage
	defaultStage = window.parent.frames("treeFrame").defaultStage
	document.forms.ScenForm.target = "mainFrame"
	if ((currentStage != null) & (currentGroup != null))
	{	if (currentStage.type != "StageOLAP")
		{	var str, isDefault
			if (defaultStage == currentStage)
				isDefault = '|Default'
			else
				isDefault = ''
			str = 'AWDSaveStage\nAWDG:' + currentGroup.name + '|' + currentGroup.dragValue + '\nAWDS:' + currentStage.name + '|' + currentStage.dragValue + isDefault + '\n' + asString()
			document.forms.ScenForm.txtParametros.value = str
			document.forms.ScenForm.submit()
		}
	}
}

function saveScenario()
{	window.parent.frames("mainFrame").save()
}

function savedUsers()
{
}

function selectComponent(anObject)
{	var container, inc, componentSelector, opt, awClassName, toolbarFrame
	window.event.cancelBubble=true
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	unselect()
	component = anObject
	inc = 5
	awClassName = component.getAttribute("AWClassName")
	if ((awClassName != "AWBanner") & (awClassName != "AWDynamicTable"))
	{	container = component.all("container")
		if (container == null)
			container = component
	}
	else
		container = component
	toolbarFrame = window.parent.frames("toolbarFrame")
	opt = toolbarFrame.fontSelect.options(container.style.fontFamily)
	if (opt != null)
		opt.selected = true
	opt = toolbarFrame.fontSizeSelect.options(container.style.fontSize)
	if (opt != null)
		opt.selected = true
	if (component.style.fontWeight == "bold")
		toolbarFrame.BoldIcon.className = "graphselectedstyle"
	else
		toolbarFrame.BoldIcon.className = "iconunselectedstyle"
	if (component.style.fontStyle == "italic")
		toolbarFrame.ItalicIcon.className = "graphselectedstyle"
	else
		toolbarFrame.ItalicIcon.className = "iconunselectedstyle"
	if (component.style.textDecorationUnderline)
		toolbarFrame.UnderlineIcon.className = "graphselectedstyle"
	else
		toolbarFrame.UnderlineIcon.className = "iconunselectedstyle"
	if (container.align == "left")
		toolbarFrame.ALeftIcon.className = "graphselectedstyle"
	else
		toolbarFrame.ALeftIcon.className = "iconunselectedstyle"
	if (container.align == "center")
		toolbarFrame.ACenterIcon.className = "graphselectedstyle"
	else
		toolbarFrame.ACenterIcon.className = "iconunselectedstyle"
	if (container.align == "right")
		toolbarFrame.ARightIcon.className = "graphselectedstyle"
	else
		toolbarFrame.ARightIcon.className = "iconunselectedstyle"
	if (awClassName == 'AWLine')
	{	var bwidth
		if (component.getAttribute("AWOrientation") == 'Vertical')
			bwidth = parseInt(component.style.borderLeftWidth, 10)
		else
			bwidth = parseInt(component.style.borderTopWidth, 10)
		toolbarFrame.LWidthField.value = bwidth
	}
	if (awClassName == 'AWRect')
	{	var bwidth = parseInt(component.style.borderWidth, 10)
		toolbarFrame.LWidthField.value = bwidth
	}
	
	componentSelector = getComponentSelector(awClassName)
	componentSelector.style.posLeft = component.style.posLeft - 2
	componentSelector.style.posTop = component.style.posTop	 - 2
	componentSelector.style.posWidth = component.style.posWidth + inc
	componentSelector.style.posHeight = component.style.posHeight + inc
	componentSelector.style.visibility = "visible"
	component = document.all(anObject.id)
	window.parent.frames("mainFrame").focus()
}

function setCellTooltip(anObject)
{	var strName, description = ""
	strName = anObject.getAttribute("AWPeriodName")
	if (strName != null)
		description += strName + " - "
	strName = anObject.getAttribute("AWIndicatorName")
	if (strName != null)
		description += strName 
	anObject.title = description
}

function setColor(aColor)
{
	currentContainerColor.style.backgroundColor = aColor;
}

function setGaugeTooltip(anObject)
{	var strName, idx, description = ""
	idx = 1
	strName = anObject.getAttribute("AWIndicatorName" + idx)
	while (strName != null)
	{	description += strName + " (" + getFormatedIndicatorTextFor(anObject, idx) + ") - "
		idx++
		strName = anObject.getAttribute("AWIndicatorName" + idx)
	}
	strName = anObject.getAttribute("AWPeriodName")
	if (strName != null)
		description += "  " + strName
	anObject.title = description
}

function setIDToStage(groupID, stageID)
{	window.parent.frames("treeFrame").currentGroup.dragValue = groupID
	window.parent.frames("treeFrame").currentStage.dragValue = stageID
}

function setIndicatorsFrom(anObject, contents, pos)
{	var idx, size, val
	idx = 1
	size = parseInt((contents[pos]).substring(17), 10)
	for (var i = 0; i < size; i++)
	{	if (i < 9)
			val = (contents[pos + idx]).substring(13)
		else
			val = (contents[pos + idx]).substring(14)
		anObject.setAttribute("AWIndicator" + idx, val)
		idx++
	}
	return (pos + idx)
}

function setIndicatorTo(anObject, indicator, MAX_IND, indName, indFormat)
{	var idx, lastInd
	idx = 1
	lastInd = anObject.getAttribute("AWIndicator1")
	while (lastInd != null)
	{	idx++
		lastInd = anObject.getAttribute("AWIndicator" + idx)
	}
	if (MAX_IND == null)
	{	anObject.setAttribute("AWIndicator" + idx, indicator)
		anObject.setAttribute("AWIndicatorName" + idx, indName)
		anObject.setAttribute("AWIFormat" + idx, indFormat)
	}
	else
	{	if (idx > MAX_IND)
		{	anObject.setAttribute("AWIndicator1", indicator)
			anObject.setAttribute("AWIndicatorName1", indName)
			anObject.setAttribute("AWIFormat1", indFormat)
			for (var i = 2; i < idx; i++)
			{	anObject.setAttribute("AWIndicator" + i, null)
				anObject.setAttribute("AWIndicatorName" + i, null)
				anObject.setAttribute("AWIFormat" + i, null)
			}
		}
		else
		{	anObject.setAttribute("AWIndicator" + idx, indicator)
			anObject.setAttribute("AWIndicatorName" + idx, indName)
			anObject.setAttribute("AWIFormat" + idx, indFormat)
		}
	}
}

function setLanguage(strLanguage)
{	AWDLanguage = strLanguage.split("|")
}

function setMapDialog(aWindow)
{	MapDialog = aWindow
}

function setProgBarTooltip(anObject)
{	setThermometerTooltip(anObject)
}

function setRotation(deg, aDiv)
{	var costheta, sintheta, rad
	deg2rad = Math.PI * 2 / 360
    rad = deg * deg2rad

    costheta = Math.cos(rad)
    sintheta = Math.sin(rad)

    aDiv.filters.item(0).M11 = costheta
    aDiv.filters.item(0).M12 = -sintheta
    aDiv.filters.item(0).M21 = sintheta
    aDiv.filters.item(0).M22 = costheta
}

function setThermometerTooltip(anObject)
{	var strName, description = ""
	strName = anObject.getAttribute("AWIndicatorName1")
	if (strName != null)
		description += strName + " (" + getFormatedIndicatorTextFor(anObject, 1) + ") Vs "
	strName = anObject.getAttribute("AWIndicatorName2")
	if (strName != null)
		description += strName + " (" + getFormatedIndicatorTextFor(anObject, 2) + ") - "
	strName = anObject.getAttribute("AWPeriodName")
	if (strName != null)
		description += strName + " - 50%"
	anObject.title = description
}

function setUsersAndGroups(usersPub, groupsPub)
{	var tmp, strParam, hasPublishers
	strParam = '.AWDUPub.'
	UsersPub = new Array()
	for (var idx = 0; idx < usersPub.length; idx++)
	{	tmp = new Array()
		hasPublishers = usersPub[idx].length > 1
		for (var i = 0; i < usersPub[idx].length; i++)
		{	tmp[i] = new Array()
			for (var j = 0; j < usersPub[idx][i].length; j++)
				tmp[i][j] = usersPub[idx][i][j]
			if (hasPublishers)
			{	if (i == 0)
					strParam += usersPub[idx][i][1]
				else
				{	strParam += ":" + usersPub[idx][i][0]
					strParam += "," + usersPub[idx][i][1]
					strParam += "," + usersPub[idx][i][2]
				}
			}
		}
		if (hasPublishers)
			strParam += "|"
		UsersPub[idx] = tmp
	}
	strParam += '.AWDGPub.'
	GroupsPub = new Array()
	for (var idx = 0; idx < groupsPub.length; idx++)
	{	tmp = new Array()
		hasPublishers = groupsPub[idx].length > 1
		for (var i = 0; i < groupsPub[idx].length; i++)
		{	tmp[i] = new Array()
			for (var j = 0; j < groupsPub[idx][i].length; j++)
				tmp[i][j] = groupsPub[idx][i][j]
			if (hasPublishers)
			{	if (i == 0)
					strParam += groupsPub[idx][i][1]
				else
				{	strParam += ":" + groupsPub[idx][i][0]
					strParam += "," + groupsPub[idx][i][1]
					strParam += "," + groupsPub[idx][i][2]
				}
			}
		}
		if (hasPublishers)
			strParam += "|"
		GroupsPub[idx] = tmp
	}
	interfaz().document.forms.ScenForm.txtParametros.value = "AWDEvent:SavePub:" + strParam
	interfaz().document.forms.ScenForm.submit()
}

function showAnalysisMenu(anObject)
{	var anId, strOptions
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	showContextMenu = false
		strOptions = 'Plantilla de análisis[Máximos y mínimos'
		strOptions += ','
		strOptions += 'Periodos anteriores'
		strOptions += ','
		strOptions += 'Propiedades de indicador (Líneas)'
		strOptions += ','
		strOptions += 'Propiedades de indicador (Radar)'
		strOptions += ','
		strOptions += 'Tendencia incremental'
		strOptions += ','
		strOptions += 'Tendencia con propiedades'
		strOptions += ','
		strOptions += '3 generaciones'
		strOptions += '],'
		strOptions += 'Propiedades...'
		strOptions += ','
		strOptions += 'Eje Y[Número de separaciones,Escala del eje Y['
		strOptions += 'Escala manual'
		strOptions += ','
		strOptions += 'Escala automática con mínimo cero'
		strOptions += ','
		strOptions += 'Escala automática con mínimo calculado'
		strOptions += ']],'
		strOptions += language()[116]
		SetShowMenuOnClick()
		AddMenu('applyAnalysisOption','',strOptions,' [PAM' + anId + ',PAA' + anId + ',PAL' + anId + ',PAR' + anId + ',PAI' + anId + ',PAT' + anId + ',PA3' + anId + '],PRO' + anId + ', [EYS' + anId + ', [EYM' + anId + ',EY0' + anId + ',EYC' + anId + ']],NOM' + anId)
	}
}

function showCellMenu(anObject)
{	var bOptions, anId, tpOptions, aOpts, ttOpt, strOptions
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	showContextMenu = false
		bOptions = getBorderOptionsWith(anObject.getAttribute("AWBorder"))
		tpOptions = getVAlignOptionsWith(anObject.all("container").vAlign)
		aOpts = getAlignOptionsWith(anObject.all("container").align)
		ttOpt = language()[3]
		if (anObject.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled)
			ttOpt += "*"
			
		strOptions = language()[74]
		if (anObject.getAttribute("AWShowAlarms") != 'false')
			strOptions += "*"      
 		strOptions += ',' + language()[122]
		if (anObject.getAttribute("AWImageAlarm") != 'false')
			strOptions += "*"    
		strOptions += ',' + language()[26] + '[' + language()[83] + '[' + tpOptions + '],' + language()[82] + '[' + aOpts + '],' + ttOpt + ','     
		strOptions += language()[34] + ',' 
		strOptions += getImageOptionsWith(anObject)
		strOptions += ',' + language()[6] + '[' + bOptions + ']]'
		strOptions += ',' + language()[116]

		var strKeys = 'CSA' + anId + ',VIA' + anId + ', [ [FPT' + anId + ',FPB' + anId + ',FPM' + anId + '], [FAL' + anId + ',FAR' + anId + ',FAC' + anId + '],F3D' +  anId + ',LIM' + anId + ', [LPC' + anId + ',LTL' + anId + ',LTC' + anId + ',LTR' + anId + ',LCL' + anId + ',LCR' + anId + ',LBL' + anId + ',LBC' + anId + ',LBR' + anId + ',LAF' + anId + ',LMC' + anId + ',LHD' + anId + '], [OBR' + anId + ',OBN' + anId + ',OBO' + anId + ',OBI' + anId + ',OBS' + anId + ',OBF' + anId + ']]' + ',NOM' + anId
		SetShowMenuOnClick()
		AddMenu('applyChoiceOption','',strOptions, strKeys)
	}
}

function showChartMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	var strMenu, brother, tableID, strOpts
		showContextMenu = false
		tableID = NameIDs[16] + anId.substring(5)
		brother = mydiv.all(tableID)
		if (anObject.getAttribute("AWMetaData") != null)
		{	strMenu = language()[23] + ","
			strOpts = "CED" + anId + ","
		}
		else
		{	strMenu = ""
			strOpts = ""
		}
		if (brother != null)
		{	if (brother.getAttribute("AWShow") == '1')
				strMenu += language()[32]
			else
				strMenu += language()[77]
		}
		else
			strMenu += language()[77]
		SetShowMenuOnClick()
		AddMenu('applyChoiceTableOption','',strMenu,strOpts + 'TSH' + tableID)
	}
}

function showDimMenu(aWindow)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	var strMenu, vAWBorder, tmp, anObject
	tmp = aWindow.name.split(" ")
	anID = "DIM" + (parseInt(tmp[1], 10))
	showContextMenu = false
	strMenu = language()[79] + ',' + language()[6] + '['
	anObject = mydiv.all(anID)
	vAWBorder = anObject.getAttribute("AWBorder")
	if (vAWBorder == null)
		vAWBorder = "Regular"
	strMenu += getBorderOptionsWith(vAWBorder)
	strMenu += ']'
	SetCenterFlag()
	AddMenu('applyChoicePeriodOption','',strMenu,'PSY' + anID + ', [OBR' + anID + ',OBN' + anID + ',OBO' + anID + ',OBI' + anID + ',OBS' + anID + ',OBF' + anID + ']')
}

function showIfIsLinkMenu(anObject)
{	if (component.getAttribute("AWClassName") == "AWLink")
		showLinkMenu(component)
}

function showTableMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	var strMenu, strOpts, brother, chartID
		showContextMenu = false
		chartID = "Chart" + anId.substring(NameIDs[16].length)
		brother = mydiv.all(chartID)
		if (anObject.getAttribute("AWMetaData") != null)
		{	strMenu = language()[23] + ","
			strOpts = "CED" + anId + ","
		}
		else
		{	strMenu = ""
			strOpts = ""
		}
		if (brother != null)
		{	if (brother.getAttribute("AWShow") == '1')
				strMenu += language()[31]
			else
				strMenu += language()[75]
		}
		else
			strMenu += language()[75]
		strMenu += ',' + language()[116]
		SetShowMenuOnClick()
		AddMenu('applyChoiceTableOption','',strMenu,strOpts + 'TSH' + chartID + ',NOM' + anId)
	}
}

function showGaugeMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strChoices, vAWBorder
		showContextMenu = false
		strChoices = language()[55] + ',' + language()[6] + '['
		vAWBorder = anObject.getAttribute("AWBorder")
		if (vAWBorder == null)
			vAWBorder = "Outset"
		strChoices += getBorderOptionsWith(vAWBorder)
		strChoices += '],'
		strChoices += language()[116]
		SetShowMenuOnClick()
		AddMenu('applyChoiceMarqueeOption','',strChoices,'GPR' + anObject.id + ', [OBR' + anObject.id + ',OBN' + anObject.id + ',OBO' + anObject.id + ',OBI' + anObject.id + ',OBS' + anObject.id + ',OBF' + anObject.id + '],NOM' + anObject.id)
	}
}

function showHideTree()
{	if (window.parent.document.body.cols == "177,*")
	{	document.all("showHideTree").src = ShowTreeImg.src
		window.parent.document.body.cols = "0,*"
	}
	else
	{	document.all("showHideTree").src = HideTreeImg.src
		window.parent.document.body.cols = "177,*"
	}

}

function showImageMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strChoices, sToFit
		showContextMenu = false
		strChoices = language()[34] + ',' + language()[5]
		sToFit = anObject.getAttribute("AWAutoFit") == 'true'
		if (sToFit)
			strChoices += '*'
		SetShowMenuOnClick()
		AddMenu('applyChoiceImageOption','',strChoices,'ISR' + anObject.id + ',IAF' + anObject.id)
	}
}

function showLineMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strMenu
		showContextMenu = false
		strMenu = language()[55] + '[' + language()[33]
		if (anObject.getAttribute("AWOrientation") != 'Vertical')
			strMenu += '*'
		strMenu += ',' + language()[93]
		if (anObject.getAttribute("AWOrientation") == 'Vertical')
			strMenu += '*'
		strMenu += ']'
		SetShowMenuOnClick()
		AddMenu('applyChoiceLineOption','',strMenu,' [LPH' + anObject.id + ',LPV' + anObject.id + ']')
	}
}

function showLinkerMenu(anObject)
{	var anId
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	var strMenu, anAWBorder, imgPos
		showContextMenu = false
		strMenu = language()[40] + '...,' + language()[81] + ',' + language()[26] + '[' + language()[83] + '['
		strMenu += getVAlignOptionsWith(anObject.all("container").vAlign)
		strMenu += '],' + language()[82] + '['
		strMenu += getAlignOptionsWith(anObject.all("container").align)
		strMenu += '],' + language()[3]
		if (anObject.all("container").filters.item('DXImageTransform.Microsoft.dropshadow').enabled)
			strMenu += "*"
		strMenu += ',' + language()[34] + ',' 
		strMenu += getImageOptionsWith(anObject)
		
		strMenu += ',' + language()[6] + '['
		anAWBorder = anObject.getAttribute("AWBorder")
		if (anAWBorder == null)
			anAWBorder = "None"
		strMenu += getBorderOptionsWith(anAWBorder)
		strMenu += ']]'
		strMenu += ',' + language()[116]
		
		SetShowMenuOnClick()
		AddMenu('applyChoiceOption','',strMenu,'LLL' + anId + ',LTX' + anId + ', [ [FPT' + anId + ',FPB' + anId + ',FPM' + anId + '], [FAL' + anId + ',FAR' + anId + ',FAC' + anId + '],F3D' +  anId + ',LIM' + anId + ', [LPC' + anId + ',LTL' + anId + ',LTC' + anId + ',LTR' + anId + ',LCL' + anId + ',LCR' + anId + ',LBL' + anId + ',LBC' + anId + ',LBR' + anId + ',LAF' + anId + ',LMC' + anId + ',LHD' + anId + '], [OBR' + anId + ',OBN' + anId + ',OBO' + anId + ',OBI' + anId + ',OBS' + anId + ',OBF' + anId + ']],NOM' + anId)
	}
}

function getImageOptionsWith(anObject)
{	var imgPos, strMenu
	imgPos = anObject.getAttribute("AWImgPos")
	strMenu = language()[35] + '[' + language()[13]
	if (imgPos == '0')
		strMenu += '*'
	strMenu += ',' + language()[88]
	if ((imgPos == '1') | (imgPos == null))
		strMenu += '*'
	strMenu += ',' + language()[87]
	if (imgPos == '2')
		strMenu += '*'
	strMenu += ',' + language()[89]
	if (imgPos == '3')
		strMenu += '*'
	strMenu += ',' + language()[15]
	if (imgPos == '4')
		strMenu += '*'
	strMenu += ',' + language()[16]
	if (imgPos == '5')
		strMenu += '*'
	strMenu += ',' + language()[10]
	if (imgPos == '6')
		strMenu += '*'
	strMenu += ',' + language()[9]
	if (imgPos == '7')
		strMenu += '*'
	strMenu += ',' + language()[11]
	if (imgPos == '8')
		strMenu += '*'
	strMenu += ',' + language()[5]
	if (imgPos == '9')
		strMenu += '*'
	strMenu += ',' + language()[46]
	if (imgPos == '10')
		strMenu += '*'
	strMenu += ',' + language()[30]
	if (imgPos == '11')
		strMenu += '*'
	strMenu += ']'
	return strMenu
}

function showLinkMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strMenu
		showContextMenu = false
		strMenu = language()[55]
		SetShowMenuOnClick()
		AddMenu('applyChoiceLinkOption','',strMenu,'HLP' + anObject.id)
	}
}

function showMapMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strMenu, strOpt
		showContextMenu = false
		if (anObject.getAttribute("AWBasedOn") == 'Regions')
		{	strMenu = language()[74]
			if (anObject.getAttribute("AWShowAlarms") != 'false')
				strMenu += '*'
			strMenu += ','	
			strOpt = 'MSA' + anObject.id + ','
		}
		else
		{	strMenu = ''
			strOpt = ''
		}
		strMenu += language()[55] + ',' + language()[6]
		if (anObject.getAttribute("AWBorder") != 'None')
			strMenu += '*'
		strMenu += ',' + language()[34] + '[' + language()[24] + ',' + language()[14] + ',' + language()[5]
		if (anObject.getAttribute("AWAutoFit") == 'true')
			strMenu += '*'
		strMenu += ']'
		strOpt += 'MPR' + anObject.id + ',MBO' + anObject.id + ', [MIS' + anObject.id + ',MIC' + anObject.id + ',MIF' + anObject.id + ']'
		strMenu += ',' + language()[116]
		strOpt += ',NOM' + anObject.id
		SetShowMenuOnClick()
		AddMenu('applyChoiceMapOption', '', strMenu, strOpt)
	}
}

function showMarqueeMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strMenu, vel, dir, vAWBorder, tmp
		vel = anObject.scrollAmount
		dir = anObject.direction
		showContextMenu = false
		strMenu = 'Speed[1'
		
		if (vel == '1')
			strMenu += '*'
		strMenu += ',2'
		if (vel == '2')
			strMenu += '*'
		strMenu += ',3'
		if (vel == '3')
			strMenu += '*'
		strMenu += '],Direction[Right'
		if (dir == 'right')
			strMenu += '*'
		strMenu += ',Left'
		if (dir == 'left')
			strMenu += '*'
		strMenu += ',Up'
		if (dir == 'up')
			strMenu += '*'
		strMenu += ',Down'
		if (dir == 'down')
			strMenu += '*'
		strMenu += '],Borde['
		
		vAWBorder = anObject.getAttribute("AWBorder")
		if (vAWBorder == null)
			vAWBorder = "Outset"
		strMenu += getBorderOptionsWith(vAWBorder)
		strMenu += '],Image,Show Image'
		tmp = anObject.getAttribute("AWShowImg")
		if ((tmp == "true") | (tmp == null))
			strMenu += "*"
		strMenu += ',Show Period'
		tmp = anObject.getAttribute("AWShowPeriod")
		if ((tmp == "true") | (tmp == null))
			strMenu += "*"
		strMenu += ',Separator'
		SetShowMenuOnClick()
		AddMenu('applyChoiceMarqueeOption','',strMenu,' [BS1' + anObject.id + ',BS2' + anObject.id + ',BS3' + anObject.id + '], [BDR' + anObject.id + ',BDL' + anObject.id + ',BDU' + anObject.id + ',BDD' + anObject.id + '], [OBR' + anObject.id + ',OBN' + anObject.id + ',OBO' + anObject.id + ',OBI' + anObject.id + ',OBS' + anObject.id + ',OBF' + anObject.id + '],BIM' + anObject.id + ',BSI' + anObject.id + ',BSP' + anObject.id + ',BSE' + anObject.id)
	}
}

function showPeriodMenu(anObject)
{	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	if (window.event.button == 2)
	{	var strMenu, vel, dir, vAWBorder, tmp
		showContextMenu = false
		strMenu = language()[79]
		SetShowMenuOnClick()
		AddMenu('applyChoicePeriodOption','',strMenu,'PSY' + anObject.id)
	}
}

function showStageMenu()
{	if (window.event.button == 2)
	{	var strMenu, aNode
		aNode = rtree.detectNode_withId(rtree.nodes, window.event.srcElement.id)
		if (aNode != null)
		{	showContextMenu = false
			if (aNode.type == 'Stage')
			{	strMenu = language()[21]
				if (defaultStage == aNode)
					strMenu += '*'
				//strMenu += ',Delete'
				SetShowMenuOnClick()
				AddMenu('applyStageOption','',strMenu, 'SDF' + aNode.id) // + ',SDE' + aNode.id)
			}
		}
	}
}	

function showThermometerMenu(anObject)
{	var anId
	currentStage = window.parent.frames("treeFrame").currentStage
	if (currentStage != null)
	{	if (currentStage.type == "StageOLAP")
			return
	}
	anId = anObject.id
	if (window.event.button == 2)
	{	var strMenu, anAWBorder
		showContextMenu = false
		strMenu = 'Border['
		anAWBorder = anObject.getAttribute("AWBorder")
		if (anAWBorder == null)
			anAWBorder = "None"
		strMenu += getBorderOptionsWith(anAWBorder)
		strMenu += '],Horizontal'
		if (anObject.getAttribute("AWHorizontal") == 'true')
			strMenu += '*'
		strMenu += ',Maximum...,Background[Imagen,Clear,Automatic Fit'
		if (anObject.getAttribute("AWAutoFit") == 'true')
			strMenu += '*'
		strMenu += '],Indicator[Displace'
		if (anObject.getAttribute("AWDisplace") == 'true')
			strMenu += '*'
		strMenu += ',Imagen,Clear]'
		
		SetShowMenuOnClick()
		AddMenu('applyChoiceOption','',strMenu,' [OBR' + anId + ',OBN' + anId + ',OBO' + anId + ',OBI' + anId + ',OBS' + anId + ',OBF' + anId + '],THZ' + anId + ',TMX' + anId + ', [TBI' + anId + ',TBL' + anId + ',TBA' + anId + '], [TID' + anId + ',TII' + anId + ',TIL' + anId + ']')
	}
}

function splitId(anID)
{	var stype
	for (var idx = 0; idx < NameIDs.length; idx++)
	{	if (anID.indexOf(NameIDs[idx]) > -1)
			return (NameIDs[idx] + ':' + anID.substring(NameIDs[idx].length))
	}
}

function switchTo(which)
{	if (which == 'Stages')
	{	tabStage.style.zIndex = 10
		tabStage.style.backgroundImage = 'url(images/tabwhite.gif)'
		tabRep.style.zIndex = 9
		tabRep.style.backgroundImage = 'url(images/tabdark.gif)'
		treeStage.style.visibility = 'visible'
		tree.style.visibility = 'hidden'
	}
	else
	{	tabStage.style.zIndex = 9
		tabStage.style.backgroundImage = 'url(images/tabdark.gif)'
		tabRep.style.zIndex = 10
		tabRep.style.backgroundImage = 'url(images/tabwhite.gif)'
		treeStage.style.visibility = 'hidden'
		tree.style.visibility = 'visible'
	}
}

function triggerEvent(frameName, eventName)
{	eval('window.parent.frames("' + frameName + '").' + eventName + '()')
}

function unselect()
{	var container, menuDiv, componentSelector, toolFrame
	if (component != null)
	{	container = component.all("container")
		if (container != null)
			container.contentEditable = false
	}
	component = null
	for (var idx = 0; idx < selectorID; idx++)
	{	componentSelector = selectors[idx]
		if (componentSelector != null)
			mydiv.removeChild(componentSelector)
	}
	selectorID = 0
	selectors = new Array()
	selectedItems = new Array()
	
	toolFrame = getToolbarFrame()
	toolFrame.document.all("BoldIcon").className = "iconunselectedstyle"
	toolFrame.document.all("ItalicIcon").className = "iconunselectedstyle"
	toolFrame.document.all("UnderlineIcon").className = "iconunselectedstyle"
	toolFrame.document.all("ALeftIcon").className = "iconunselectedstyle"
	toolFrame.document.all("ACenterIcon").className = "iconunselectedstyle"
	toolFrame.document.all("ARightIcon").className = "iconunselectedstyle"
	
	UnloadMainMenu()
	//HideCalendar()
}

function updateCurrentStage(groupID, stageID)
{	window.parent.frames("treeFrame").updateCurrentGroupAndStage(groupID, stageID)
	window.parent.status = ""
}

function updateCurrentGroupAndStage(groupID, stageID)
{	for (var idx = 0; idx < rtree.nodes.length; idx++)
	{	if (rtree.nodes[idx].dragValue == groupID)
			currentGroup = rtree.nodes[idx]
	}
	for (var idx = 0; idx < currentGroup.nodes.length; idx++)
	{	if (currentGroup.nodes[idx].dragValue == stageID)
			currentStage = currentGroup.nodes[idx]
	}
	window.parent.document.title = "Artus Designer - " + currentStage.name
}

function updateDIMPos(component)
{	if (component.getAttribute("AWClassName") == "AWDim")
	{	var index, subElement
		index = component.id.substring(NameIDs[9].length)
		subElement = mydiv.all("DataDiv" + index)
		if (subElement != null)
		{	subElement.style.posLeft = component.style.posLeft
			subElement.style.posTop = component.style.posTop + component.style.posHeight
		}
	}
}

function updateLanguage(strLanguage)
{	window.parent.frames("treeFrame").setLanguage(strLanguage)
}

function privateUnformatNumber(aNumber, aFormat)
{
	var infoArray = new Array();
	var regExpStr = unformatNumberRegExpStr(aFormat, infoArray);
	var colons = infoArray[0];
	var percentSigns = infoArray[1];
	var regExp = new RegExp(regExpStr, 'i');
    var matchArray = aNumber.match(regExp);
    if (matchArray == null)
    {
    	return null;
    }
    if (matchArray.index > 0 || regExp.lastIndex < 0)
    {
    	return null;
    }
    var unformatedNumber = '';
    for (var i = 1; i < matchArray.length; i++)
    {
    	unformatedNumber += matchArray[i];
    }
    unformatedNumber = unformatedNumber.replace(/\,/g, '');
	if (isNaN(unformatedNumber))
	{
		unformatedNumber = '0';
	}
	unformatedNumber = unformatedNumber * (Math.pow(1000, colons) / Math.pow(100, percentSigns));
    return new Array(unformatedNumber, regExp.lastIndex);
}

function unformatNumber(aNumber, aFormat)
{
	aNumber = aNumber.toString();
	if (aFormat == '')
	{
		var unformatedNumber = aNumber.toString().replace(/([^0-9.])/g, '');
		if(unformatedNumber == '' || isNaN(unformatedNumber))
		{
			unformatedNumber = '0';
		}
		return new Number(unformatedNumber);
	}
	var semicolonPos = indexOfChar(aFormat, ';');
	if (semicolonPos >= 0)
	{
		var positiveFormat = aFormat.substr(0, semicolonPos);
		var negativeFormat = aFormat.substr(semicolonPos + 1);
		var zeroFormat = null;
		semicolonPos = indexOfChar(negativeFormat, ';');
		if (semicolonPos >= 0)
		{
			zeroFormat = negativeFormat.substr(semicolonPos + 1);
			negativeFormat = negativeFormat.substr(0, semicolonPos);
		}
		var anArray = new Array(3);
		anArray[0] = privateUnformatNumber(aNumber, positiveFormat);
		anArray[1] = privateUnformatNumber(aNumber, negativeFormat);
		if (anArray[1] != null)
		{
			anArray[1][0] = -1 * anArray[1][0];
		}
		anArray[2] = null;
		if (zeroFormat != null)
		{
			anArray[2] = privateUnformatNumber(aNumber, zeroFormat);
			if (anArray[2] != null)
			{
				anArray[2][0] = 0;
			}
		}
		var max_i = -1;
		var max_len = -1;
		for (var i = 0; i < anArray.length; i++)
		{
			if (anArray[i] != null)
			{
				if (anArray[i][1] > max_len)
				{
					max_i = i;
					max_len = anArray[i][1];
				}
			}
		}
		return (max_i < 0 ? 0 : anArray[max_i][0]);
	}
    anArray = privateUnformatNumber(aNumber, aFormat);
	return (anArray == null ? 0 : anArray[0]);
}

function updateBanner(anObject)
{	var idx, strHtml, showImage, imgPath, anImage, aPeriod
	var indicator, sep, str, strStyle, indValue
	showImage = anObject.getAttribute("AWShowImg")
	imgPath = anObject.getAttribute("AWImage")
	showImage = ((showImage == null) | (showImage == 'true')) & (imgPath != null)
	aPeriod = anObject.getAttribute("AWPeriodName")
	if (aPeriod == null)
		return
	sep = anObject.getAttribute("AWSeparator")
	if (sep == null)
		sep = '-'
	if (anObject.getAttribute("AWShowPeriod") == "false")
		aPeriod = ''
	else
		aPeriod = '&nbsp;' + aPeriod
	idx = 1
	indicator = anObject.getAttribute("AWIndicatorName1")
	str = ''
	strStyle = 'color:' + anObject.style.color 
	strStyle += ';font-family:' + anObject.style.fontFamily
	strStyle += ';font-size:' + anObject.style.fontSize
	strStyle += ';font-weight:' + anObject.style.fontWeight
	strStyle += ';font-style:' + anObject.style.fontStyle
	strStyle += ';text-decoration-underline:' + anObject.style.textDecorationUnderline
	while (indicator != null)
	{	indValue = getFormatedIndicatorTextFor(anObject, idx)
		str += '<td id="container" valign="middle" align="center" style="' + strStyle + '">'
		str += '&nbsp;&nbsp;' + indicator + '&nbsp;' + sep + '&nbsp;' + indValue + '&nbsp;' + aPeriod + '&nbsp;&nbsp;'
		if (showImage)
		{	str += '<img src="'
			str += imgPath
			str += '" border=0>'
		}
		str += '</td>'
		idx++
		indicator = anObject.getAttribute("AWIndicatorName" + idx)
	}
	strHtml = '<table width="' + (idx * 100) + '%" border=0 cellspacing="0" height="100%" style="table-layout:fixed;overflow:visible"><tr>'
	strHtml += str
	strHtml += '</tr></table>' + CRLF
	anObject.innerHTML = strHtml
}

function updateImageOn(anObject)
{	var imgPos, imgPath, str, oimg, htmlString
	imgPos = anObject.getAttribute("AWImgPos")
	imgPath = anObject.getAttribute("AWImage")
	if ((imgPos != '11') & (imgPath != null))
	{	oimg = anObject.all("container").all("FIT_IMAGE")
		if (oimg != null)
			anObject.all("container").removeChild(oimg)
		anObject.style.backgroundImage = 'url(' + imgPath + ')'
		switch (imgPos)
		{	case '0' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'center center'
				break
			case '1' :
			case null :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'top left'
				break
			case '2' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'top center'
				break
			case '3' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'top right'
				break
			case '4' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'center left'
				break
			case '5' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'center right'
				break
			case '6' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'bottom left'
				break
			case '7' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'bottom center'
				break
			case '8' :
				anObject.style.backgroundRepeat = 'no-repeat'
				anObject.style.backgroundPosition = 'bottom right'
				break
			case '9' :
				anObject.style.backgroundImage = 'none'
				htmlString = '<img id="FIT_IMAGE" src="' + imgPath + '" border="0" '
				htmlString += ' style="overflow:hidden;'
				htmlString += ' position:absolute; left:0px; top:0px; width:100%;height:100%;border:1px none #FFFFFF;">' + CRLF
				htmlString += '</img>'
				oImg = document.createElement(htmlString)
				anObject.all("container").insertBefore(oImg)
				break
			case '10' :
				anObject.style.backgroundPosition = '100% 100%'
				anObject.style.backgroundRepeat = 'repeat'
				break
		}
	}
	else
	{	anObject.style.backgroundImage = 'none'
	}
}

function createNewCell(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createCell(x, y)
}

function createCell(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement, aTR, aTD
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	anID = NameIDs[0] + ElementIDs[0]
	posfix = '00' + ElementIDs[0]
	posfix = '_' + posfix.substring(posfix.length - 3)
	
	htmlString = '<table id="' + anID + '" AWClassName="AWCell" align=center bgcolor="#FFFFFF" cellpadding="0" cellspacing="1" AWName="' + language()[97] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnCell(this)" onmouseup="javascript:showCellMenu(this)"'
	htmlString += ' style="font-family:Verdana; font-size:8pt; z-index:5;border=1px solid #000000;border-bottom=2px groove #666666;border-right=2px groove #666666;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:100;height:30;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	aTR = anElement.insertRow()
	aTD = aTR.insertCell()
	aTD.id = "container"
	aTD.align = "center"
	aTD.vAlign = "middle"
	aTD.style.fontFamily = "Verdana"
	aTD.style.fontSize = "8pt"
	aTD.style.filter = "progid:DXImageTransform.Microsoft.DropShadow(Color=\'#AAAAAA\', OffX=-2, OffY=2, enabled=false)"
	ElementIDs[0]++
	
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewLabel(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createLabel(x, y)
}

function createLabel(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[1] + ElementIDs[1]
	posfix = '00' + ElementIDs[1]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	htmlString = '<font id="' + anID + '" AWClassName="AWLabel" AWName="' + language()[98] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" ondblclick="javascript:editLabel(this)" onkeypress="javascript:endEditCell(this)" onblur="javascript:endEditCell(this)"'
	htmlString += ' style="font-family:Verdana; font-size:8pt; z-index:5; overflow=hidden;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:100;height:30;border:1px solid #FFFFFF; background-color: #FFFFFF">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	anElement.innerHTML = 'Text' 
	ElementIDs[1]++
	if (window.event != null)
		window.event.cancelBubble = true
	return anElement
}

function createNewRectangle(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createRectangle(x, y)
}

function createRectangle(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[4] + ElementIDs[4]
	posfix = '00' + ElementIDs[4]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	htmlString = '<font id="' + anID + '" AWClassName="AWRect" AWName="' + language()[101] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnRect(this)"'
	htmlString += ' style="font-size:1px; z-index:5;overflow:hidden;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:100;height:30;border:1px solid #000000;">'
	htmlString += '</font>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	ElementIDs[4]++
	if (window.event != null)
		window.event.cancelBubble = true
	return anElement
}

function createNewLine(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createLine(x, y)
}

function createLine(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[3] + ElementIDs[3]
	posfix = '00' + ElementIDs[3]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	htmlString = '<font id="' + anID + '" AWClassName="AWLine" AWName="' + language()[100] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLine(this)" onmouseup="javascript:showLineMenu(this)"'
	htmlString += ' style="font-size:1pt; z-index:5;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:100;height:10;border-top:1px solid #000000;">'
	htmlString += '</FONT>' 
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	ElementIDs[3]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
	/*
	var htmlString, vPosX, vPosY, anID
	anID = NameIDs[3] + ElementIDs[3]
	unselect()
	vPosX = x != null ? x : 15
	vPosY = y != null ? y : 15
	htmlString = '<div id="' + anID + '" AWClassName="AWLine" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLine(this)" onmouseup="javascript:showLineMenu(this)"'
	htmlString += ' style="font-size:1pt; z-index:5;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:100;height:10;">'
	htmlString += '</div>' 
	mydiv.innerHTML += htmlString
	ElementIDs[3]++
	if (window.event != null)
		window.event.cancelBubble=true
	
	
	var jg = new jsGraphics(anID)
	jg.drawLine(0, 0, 100, 10)
	jg.paint(); 
	
	return mydiv.all(anID)
	*/
}

function createNewProgressBar(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createProgressBar(x, y)
}

function createProgressBar(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement, aTR, aTD
	anID = NameIDs[5] + ElementIDs[5]
	posfix = '00' + ElementIDs[5]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<table id="' + anID + '" AWClassName="AWProgBar" AWName="' + language()[102] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnProgressBar(this)"'
	htmlString += ' cellSpacing=0 cellPadding=0 style="Font-size:8pt; Font-family:Verdana; CURSOR: hand; color:0000FF;FONT-WEIGHT:bold;border:1px solid #000000; overflow:hidden;border=2px outset #FFFFFF;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:130;height:27px;background-color:#FFFFFF;z-index:5;";>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	aTR = anElement.insertRow()
	aTD = aTR.insertCell()
	aTD.align = "right"
	aTD.width = "50%"
	aTD.vAlign = "middle"
	aTD.style.backgroundColor = "#0000FF"
	aTD.style.color = "#FFFFFF"
	aTD = aTR.insertCell()
	aTD.id = "container"
	aTD.align = "left"
	aTD.vAlign = "middle"
	aTD.innerHTML = "50%"
	ElementIDs[5]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewHiperlink(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createLink(x, y)
}

function createLink(x, y, w, h, kind, aText, aLink, aTooltip, theID, AWName)
{	var htmlString, vPosX, vPosY, anID, anElement, anAWName
	var vWidth, vHeight, text, link, tooltip
	anID = theID == null ? NameIDs[6] + ElementIDs[6] : theID
	posfix = '00' + ElementIDs[6]
	posfix = '_' + posfix.substring(posfix.length - 3)
	anAWName = AWName == null ? (language()[103] + posfix) : AWName
	
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	
	text = aText == null ? "BITAM" : aText
	link = aLink == null ? "http://www.bitam.com" : aLink
	tooltip = aTooltip == null ? "http://www.bitam.com" : aTooltip
	
	if (kind == 'IFRAME')
	{	vWidth = w != null ? w : 350
		vHeight = h != null ? h : 139
		htmlString = '<IFRAME id="' + anID + '" AWClassName="AWLink"  AWName="' + anAWName + '" title="' + tooltip + '" src="' + link + '" frameBorder=0 frameSpacing=0 onactivate="javascript:selectComponent(this)" onmouseup="javascript:showLinkMenu(this)"'
		htmlString += ' style="position: absolute; left:' + vPosX + 'px; top:' + vPosY + 'px;WIDTH:' + vWidth + 'px; HEIGHT:' + vHeight + 'px; "></IFRAME>'
	}
	else
	{	vWidth = w != null ? w : 130
		vHeight = h != null ? h : 27
		htmlString = '<font id="' + anID + '" AWClassName="AWLink" AWName="' + anAWName + '"'
		htmlString += ' title="' + tooltip + '" src="' + link + '" ondblclick="window.open \'' + link + '\'"'
		htmlString += ' onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" onmouseup="javascript:showLinkMenu(this)"'
		htmlString += ' style="cursor:hand;FONT-SIZE:8pt;FONT-FAMILY:MS Sans Serif;BACKGROUND-COLOR:#FFFFFF;'
		htmlString += ' position:absolute;left:' + vPosX + 'px; top:' + vPosY + 'px;WIDTH:' + vWidth + 'px;HEIGHT:' + vHeight + 'px;TEXT-ALIGN:center;color:#000000"></font>'
	}
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	anElement.setAttribute("Text",text)
	if (kind != 'IFRAME')
		anElement.setAttribute("innerText",text)
	if (theID == null)
		ElementIDs[6]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewBanner(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createBanner(x, y)
}

function createBanner(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[7] + ElementIDs[7]
	posfix = '00' + ElementIDs[7]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<marquee id="' + anID + '" AWClassName="AWBanner" AWName="' + language()[104] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnCell(this)" onmouseup="javascript:showMarqueeMenu(this)"'
	htmlString += ' direction="left" scrolldelay="10" behavior="scroll" scrollamount="2" loop="true" style="z-index:5;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:130;height:27px;border:2px outset #FFFFFF;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	anElement.innerHTML = '	  <table border=0 width="100%" height="100%"><tr><td id="container" valign="middle" style="font-family:Verdana; font-size:8pt;">Banner&nbsp;&nbsp;</td></tr></table>' + CRLF
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[7]++
	return anElement
}

function createNewPeriod(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createPeriod(x, y)
}

function createPeriod(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[8] + ElementIDs[8]
	posfix = '00' + ElementIDs[8]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<FONT id="' + anID + '" AWClassName="AWPeriod" title="Calendar" AWName="' + language()[105] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" onmouseup="javascript:showPeriodMenu(this)" style="cursor:hand;FONT-SIZE:11;FONT-FAMILY:MS Sans Serif;BORDER-RIGHT: 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid;position:absolute; left:' + vPosX + '; top:' + vPosY + ';WIDTH:100px;HEIGHT:21px;color:#000000;TEXT-ALIGN:center;z-index:5;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	htmlString = '14/Oct/2002'
	htmlString += '<P style="cursor:hand;POSITION:absolute;LEFT:-18px;TOP:10%; WIDTH:14px;HEIGHT:21;BACKGROUND-IMAGE: url(arrowleft.gif); BACKGROUND-REPEAT: no-repeat" border=0 ></P>'
	htmlString += '<P style="cursor:hand;POSITION:absolute;RIGHT:-18px;TOP:10%;WIDTH:14px; HEIGHT:21;BACKGROUND-IMAGE: url(arrowright.gif); BACKGROUND-REPEAT: no-repeat" border=0 ></P>'
	anElement.innerHTML = htmlString
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[8]++
	return anElement
}

function createNewDim(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createDimension(x, y)
}

function createDimension(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement, dataDiv, num
	anID = NameIDs[9] + ElementIDs[9]
	posfix = '00' + ElementIDs[9]
	num = posfix.substring(posfix.length - 2)
	posfix = '_' + posfix.substring(posfix.length - 3)
	
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<IFRAME id="' + anID + '" AWClassName="AWDim" AWName="' + language()[106] + posfix + '" AWBorder="Regular" onactivate="javascript:selectComponent(this)" name="DIM ' + num + ' All - " FRAMEBORDER=0 SCROLLING=NO style="position:absolute;left:' + vPosX + '; top:' + vPosY + ';width:176px;height:18px;BACKGROUND-COLOR: C0C0C0;COLOR: 000000; FONT-FAMILY: MS Sans Serif;FONT-SIZE:8pt;BORDER:1px solid #000000;scrolling=false" SRC="awddimension.htm"></IFRAME>'
	//onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" onmouseup="javascript:showPeriodMenu(this)"
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	
	htmlString = '<DIV id="DataDiv' + ElementIDs[9] + '" class=TableList style="LEFT:' + vPosX + 'px; WIDTH:226px; TOP:' + (vPosY + 21) + 'px; HEIGHT:150px;">'
	dataDiv = document.createElement(htmlString)
	mydiv.insertBefore(dataDiv)
	
	htmlString = ' <DIV id=InputDiv"' + ElementIDs[9] + '" class=DataList style="LEFT: 0px; WIDTH: 220px;TOP: 2px; HEIGHT: 110px">'
	htmlString += ' </DIV>'
	htmlString += ' <IMG src="unselect.gif" onClick="UnCheckData 1" style="LEFT: 5px;top:120px; POSITION: absolute;" ></IMG>'
	htmlString += ' <IMG src="selectall.gif" onClick="CheckAll 1" style="LEFT: 30 px;top:120px; POSITION: absolute;"></IMG>'
	htmlString += ' <IMG src="ok.gif" onClick="SaveDataDivEsc 1" style="LEFT: 171 px;top:120px; POSITION: absolute;" ></IMG>'
	htmlString += ' <IMG src="cancel.gif" onClick="HideDataDiv 1" style="LEFT: 196 px;top:120px; POSITION: absolute;"></IMG>'
	dataDiv.innerHTML = htmlString
	
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[9]++
	return anElement
}

function createNewSpeedM(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createGauge(x, y)
}

function createGauge(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[12] + ElementIDs[12]
	posfix = '00' + ElementIDs[12]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<img id="' + anID + '" AWClassName="AWGauge" AWBorder="None" AWProp="1@0.0|10|1@0.0|10|1@2@0@1@1" src="images/gauge.gif" AWName="' + language()[109] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnCell(this)" onmouseup="javascript:showGaugeMenu(this)"' 
	htmlString += ' style="position:absolute; left:' + vPosX + '; top:' + vPosY 
	htmlString += ';z-index:5;width:162;height:89px;border:2px none #FFFFFF;">'
	htmlString += '</img>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[12]++
	return anElement
}

function createNewImage(x, y, askForFile)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createImage(x, y, askForFile)
}

function createImage(x, y, askForFile)
{	var htmlString, vPosX, vPosY, fileName, anID, anElement
	anID = NameIDs[2] + ElementIDs[2]
	posfix = '00' + ElementIDs[2]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	
	fileName = ''
	if (askForFile != false)
	{	openFileDialog(['.jpg', '.jpeg', '.gif', '.bmp', '.tif', '.ico'], getProjectName())
		if (window.returnValue != null)
			fileName = getProjectName() + window.returnValue
		else
			return
	}
	htmlString = '<img id="' + anID + '" AWClassName="AWImage" src="' + fileName + '" AWImage="' + fileName + '" border="0" AWAutoFit=true AWName="' + language()[99] + posfix + '" onClick="javascript:selectComponent(this)" onmouseup="javascript:showImageMenu(this)"'
	htmlString += ' style="overflow:hidden;z-index:5;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:130;height:27px;border:1px none #FFFFFF;">'
	htmlString += '</img>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[2]++
	return anElement
}

function createNewOperator(x, y, aClassName)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createOperator(x, y, aClassName)
}

function createOperator(x, y, aClassName)
{	var htmlString, vPosX, vPosY, anID, opt, anElement, optStr,idx
	if (aClassName == "AWOperator")
	{	anID = NameIDs[10] + ElementIDs[10]
		posfix = '00' + ElementIDs[10]
		ElementIDs[10]++
		idx = 107
	}
	else
	{	anID = NameIDs[11] + ElementIDs[11]
		posfix = '00' + ElementIDs[11]
		ElementIDs[11]++
		idx = 108
	}
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<select id="' + anID + '" AWClassName="' + aClassName + '" AWName="' + language()[idx] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" onmouseup="javascript:showPeriodMenu(this)"' 
	htmlString += ' style="font-family:Verdana; font-size:10pt;z-index:5;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:130;height:27px;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	opt = new Option(language()[idx])
	anElement.add(opt)
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewLinker(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createLinker(x, y)
}

function createLinker(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement,aTR, aTD
	anID = NameIDs[13] + ElementIDs[13]
	posfix = '00' + ElementIDs[13]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	
	htmlString = '<TABLE id="' + anID + '" AWClassName="AWLinker" AWName="' + language()[110] + posfix + '" onclick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnLabel(this)" onmouseup="javascript:showLinkerMenu(' + anID + ')"'
	htmlString += ' title="Go to scenario - " cellSpacing=0 cellPadding=0 style="FONT-SIZE:12; FONT-FAMILY:Arial; CURSOR:hand; POSITION:absolute; left:' + vPosX + '; top:' + vPosY + ';HEIGHT: 41px;width:139px;color: 0000FF;FONT-WEIGHT: bold;z-index:5;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	aTR = anElement.insertRow()
	aTD = aTR.insertCell()
	aTD.id = "container"
	aTD.align = "center"
	aTD.vAlign = "middle"
	aTD.style.filter = "progid:DXImageTransform.Microsoft.DropShadow(Color=\'#AAAAAA\', OffX=-2, OffY=2, enabled=false)"
	aTD.innerHTML = '<font ondblclick="javascript:editLabel(this)" onkeypress="javascript:endEditCell(this)" onblur="javascript:endEditCell(this)" style="z-index:50">Linker<font>'
	ElementIDs[13]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewHighLight(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createHighLight(x, y)
}

function createHighLight(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[14] + ElementIDs[14]
	posfix = '00' + ElementIDs[14]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<div id="' + anID + '" AWClassName="AWHighLight" AWName="' + language()[111] + posfix + '" onClick="javascript:selectComponent(this)"'
	htmlString += ' align="center" style="font-family:Verdana; font-size:10pt; z-index:5;overflow:hidden;border=1px dashed #AAAAAA;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:130;height:27px;background-color: #FFFFFF";>' + CRLF
	htmlString += '</div>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	ElementIDs[14]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewMap(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createMap(x, y)
		//window.parent.frames("mainFrame").LoadedFav()
}

function createMap(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[15] + ElementIDs[15]
	posfix = '00' + ElementIDs[15]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	
	htmlString = '<div id="' + anID + '" AWClassName="AWMap" AWName="' + language()[112] + posfix + '" AWBorder="None" onClick="javascript:selectComponent(this)" onmouseup="javascript:showMapMenu(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnMap(this)"'
	htmlString += ' style="font-family:Verdana; font-size:10pt; z-index:5;overflow:hidden;'
	htmlString += ' position:absolute; left:' + vPosX + '; top:' + vPosY + '; width:494;height:341px;border:2px none #FFFFFF; background-color: #FFFFFF";></div>'
	anElement = document.createElement(htmlString)
	
	anElement.innerHTML = '<img id="MAPIMG" src="images/usa.gif" style="position:absolute;left:0px;top:0px;width:100%;height:100%;border:2px none #FFFFFF;z-index:2">'
	mydiv.insertBefore(anElement)
	ElementIDs[15]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewDynTable(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createDynTable(x, y)
}

function createDynTable(x, y)
{	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15
	anID = NameIDs[16] + ElementIDs[16]
	posfix = '00' + ElementIDs[16]
	posfix = '_' + posfix.substring(posfix.length - 3)
	
	htmlString = '<img id="Chart' + ElementIDs[16] + '" AWClassName="AWChart" AWShow=0 AWName="Chart' + posfix + '" onClick="javascript:selectComponent(this)" onmouseup="javascript:showChartMenu(this)" src="images/tplgraph.gif" border="0" style="position:absolute;left:' + vPosX + ';top:' + (vPosY + 80) + ';width:281;height:180;visibility:hidden"></img>'
	brother = document.createElement(htmlString)
	mydiv.insertBefore(brother)
	
	htmlString = '<DIV id="' + anID + '" AWClassName="AWDynamicTable" AWShow=1 AWName="' + language()[113] + posfix + '" onClick="javascript:selectComponent(this)" onmouseup="javascript:showTableMenu(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnTable(this)" '
	htmlString += ' style="position:absolute;left:' + vPosX + '; top:' + vPosY + ';width:240px;height:70px;overflow-X:auto;overflow-y:hidden;z-index:5;">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	
	htmlString = '<DIV id="DivTDH' + ElementIDs[16] + '" style="POSITION:absolute;WIDTH:100%;HEIGHT:100%;Top:0px;left:0px;overflow-X:hidden;overflow-y:hidden">'
	aTDiv = document.createElement(htmlString)
	anElement.insertBefore(aTDiv)
	htmlString = '<TABLE id="TDH' + ElementIDs[16] + '" border=1 cellspacing=0 cellpadding=0 class="stTable TemplBorder manita" style="POSITION: absolute;WIDTH:100%;HEIGHT:22px;Top:0px;left:0px">'
	aTable = document.createElement(htmlString)
	aTDiv.insertBefore(aTable)
	aTR = aTable.insertRow()
	aTR.height = "22px"
	aTR.style.fontSize = "11pt"
	aTR.style.fontFamily = "MS Sans Serif"
	aTR.style.backgroundColor = "#E0E0E0"
	//aTR.style.backgroundImage = "url(images/templheader1.jpg)"
	aTD = aTR.insertCell()
	aTD.align = "center"
	aTD.vAlign = "middle"
	aTD.className = " stC stW"
	aTD.width = "45px"
	aTD.innerHTML = "&nbsp;"
	
	aTD = aTR.insertCell()
	aTD.id = "container"
	aTD.align = "center"
	aTD.vAlign = "middle"
	aTD.innerHTML = "&nbsp;"
	
	htmlString = '<TABLE id="TDB' + ElementIDs[16] + '" border=1 cellspacing=0 cellpadding=0 class="stTable TemplBorder manita" style="POSITION: absolute;WIDTH:100%;HEIGHT:22px;Top:22px;left:0px">'
	aTable = document.createElement(htmlString)
	aTDiv.insertBefore(aTable)
	for (var idx = 0; idx < 2; idx++)
	{	aTR = aTable.insertRow()
		aTR.style.height = "22px"
		aTR.style.fontSize = "11pt"
		aTR.style.fontFamily = "MS Sans Serif"
	
		aTD = aTR.insertCell()
		aTD.width = "45px"
		aTD.align = "center"
		aTD.vAlign = "middle"
		aTD.style.backgroundColor = "#E0E0E0"
		//aTD.style.backgroundImage = "url(images/templnumcol1.jpg)"
		aTD.className = " stB stL"
		aTD.innerHTML = "&nbsp;"
	
		for (var i = 0; i < 1; i++)
		{	aTD = aTR.insertCell()
			aTD.align = "center"
			aTD.vAlign = "middle"
			aTD.className = " stB"
			aTD.innerHTML = "&nbsp;"
		}
	}
	ElementIDs[16]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function addTD(index, sTDMetadata, showChart)
{	var vPosX, vPosY, anID, anElement, brother, aTable
	var aTDiv, aTR, aTD, isNew
	unselect()
	if (index > -1)
	{	anElement = mydiv.all(NameIDs[16] + index)
		AddTDMD(index, sTDMetadata)
		isNew = anElement.getAttribute("AWMetaData") == null
		if (anElement != null)
			anElement.setAttribute("AWMetaData", sTDMetadata)
		else
			alert(language()[80])
		brother = mydiv.all("Chart" + index)
		if (brother != null)
			brother.setAttribute("AWMetaData", sTDMetadata)
		else
			alert(language()[20])
		if ((isNew) & (showChart == 1))
		{	anElement.setAttribute("AWShow", '0')
			anElement.style.visibility = 'hidden'
			brother.setAttribute("AWShow", '1')
			brother.style.visibility = 'visible'
			vPosX = anElement.style.posLeft
			vPosY = anElement.style.posTop
			anElement.style.posLeft = brother.style.posLeft
			anElement.style.posTop = brother.style.posTop
			brother.style.posLeft = vPosX
			brother.style.posTop = vPosY
		}
		return
	}
}

function createNewThermometer(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createThermometer(x, y)
}

function createThermometer(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement, aTR, aTD, posfix
	anID = NameIDs[17] + ElementIDs[17]
	posfix = '00' + ElementIDs[17]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<table id="' + anID + '" AWClassName="AWThermometer" AWName="' + language()[114] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnThermometer(this)" onmouseup="javascript:showThermometerMenu(this)"'
	htmlString += ' cellSpacing=0 cellPadding=0 style="Font-size:8pt; Font-family:Verdana; CURSOR: hand; color:0000FF;FONT-WEIGHT:bold;overflow:hidden;border=2px none #FFFFFF;z-index:5;'
	htmlString += ' position:absolute;left:' + vPosX + ';top:' + vPosY + ';width:20px;height:140px;background-color:#FFFFFF">'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	
	aTR = anElement.insertRow()
	aTD = aTR.insertCell()
	aTD.id = "CT"
	aTD.height = "50%"
	aTD.width = "100%"
	
	aTR = anElement.insertRow()
	aTD = aTR.insertCell()
	aTD.id = "container"
	aTD.height = "50%"
	aTD.width = "100%"
	aTD.style.backgroundColor = "#0000FF"
	
	ElementIDs[17]++
	if (window.event != null)
		window.event.cancelBubble=true
	return anElement
}

function createNewAnalysis(x, y)
{	if (window.parent.frames("treeFrame").currentStage == null)
		return alert(language()[96])
	if (window.parent.frames("treeFrame").currentStage.type != "StageOLAP")
		window.parent.frames("mainFrame").createAnalysis(x, y)
}

function createAnalysis(x, y)
{	var htmlString, vPosX, vPosY, anID, anElement
	anID = NameIDs[18] + ElementIDs[18]
	posfix = '00' + ElementIDs[18]
	posfix = '_' + posfix.substring(posfix.length - 3)
	unselect()
	vPosX = x != null ? (x + document.body.scrollLeft): 15
	vPosY = y != null ? (y + document.body.scrollTop) : 15

	htmlString = '<img id="' + anID + '" AWClassName="AWAnalysis" AWBorder="None" src="images/tplgraph.gif" AWName="' + language()[115] + posfix + '" onClick="javascript:selectComponent(this)" onDragOver="javascript:dragOverComponent()" onDrop="javascript:dropOnCell(this)" onmouseup="javascript:showAnalysisMenu(this)"' 
	htmlString += ' style="position:absolute; left:' + vPosX + '; top:' + vPosY 
	htmlString += ';z-index:5;width:281;height:180px;border:2px none #FFFFFF;">'
	htmlString += '</img>'
	anElement = document.createElement(htmlString)
	mydiv.insertBefore(anElement)
	if (window.event != null)
		window.event.cancelBubble=true
	ElementIDs[18]++
	return anElement
}
function HandleDragDim(sDrag)
{
	var dragData = window.event.dataTransfer;	
	var dragValue = "";	
	dragValue = sDrag;
	dragData.setData('text', dragValue);
	dragData.effectAllowed = 'copy';
	dragData.dropEffect = 'copy';	
}

function HandleDropDim(sCube, pDims, sMD)
{
	var oData = window.event.dataTransfer;
	var dragValue = oData.getData("text");
	var sDims = "";
	sDims = ',' + pDims + ','	;
	if (dragValue.substring(0,5) == sCube)
	{
		if (sDims.search(',' + dragValue.substring(5,10) + ',') != -1)
			UpdTD(sMD + dragValue.substring(5,10));
	}		
}

function HandleDragOverDim(sCube, pDims)
{
	var oData = window.event.dataTransfer;
	var dragValue = oData.getData("text");
	var sDims = "";	
	sDims = ',' + pDims + ',';			
	if (dragValue.substring(0,5) == sCube)
	{		
		if (sDims.search(',' + dragValue.substring(5,10) + ',') != -1)
			window.event.returnValue = false;
		else
			window.event.returnValue = true;
	}	
	else
		window.event.returnValue = true;
}
