	//var strImageServer = 'http://vmresin.vm.quartal.com:8100/htmlmonitor/components'
	var strImageServer
	var strPriceChartComponent = 'pricechart.gif'
	var strVolumeChartComponent = 'volumechart.gif'
	var strComparisonChartComponent = 'comparisonchart.gif'
	var strLanguage = "fi"
	var strPeriod
	var strPrimaryShare
	var strPrimaryIndex
	var strPrimaryInstrument
	var arrInstruments
	
	var transparentGif = new Image();
	transparentGif.src = '/htmlmonitor/images/spacer.gif';

	objForm=window.document.forms['monitorselector']
	
	//prepare();
	strLanguage = objForm.language.value
	strClient = objForm.client.value

	objFields = objForm.elements
	strImageServer = objForm.elements['imageComponentRoot'].value
	strPrimaryShare = objFields.primaryshare.value
	arrInstruments = objFields.instrumentlist.value


	function collectValues()
		{
			// parse Time Range
			if (objFields.timeselectortype.value =='select') 
				{
					objTimeRange=objFields.time
					strPeriod = objTimeRange.options[objTimeRange.selectedIndex].value
				}
			else if  (objFields.timeselectortype.value =='radio') 
				{
					objTimeRange=objFields.elements['period']
					for(var i=0 ; i < objTimeRange.length ; i++)
					{
						if (objTimeRange[i].checked) strPeriod = objTimeRange[i].value
					}
				}
			else if (objFields.timeselectortype.value =='hidden') 	
				{
					objTimeRange=objFields.period.value
					if (objTimeRange) strPeriod = objTimeRange
				}
			update();
		}



function update()
	{

	strPrimaryInstrument = strPrimaryShare
	if(strPrimaryInstrument==null) strPrimaryInstrument = strPrimaryIndex
	if(strPrimaryInstrument==null) strPrimaryInstrument = 'null'

	strPriceChartURL = strImageServer + '/' + strClient +'/' + strLanguage + '/' + strPriceChartComponent + '?instruments.tradingCodes=' + strPrimaryInstrument + '&timerange.name=' + strPeriod;

	strVolumeChartURL = strImageServer + '/' + strClient +'/' + strLanguage + '/' + strVolumeChartComponent + '?instruments.tradingCodes=' + strPrimaryInstrument + '&timerange.name=' + strPeriod;

	strComparisonChartURL = strImageServer + '/' + strClient +'/' + strLanguage + '/' + strComparisonChartComponent + '?instruments.tradingCodes=' + arrInstruments + '&timerange.name=' + strPeriod;
	
//	alert ('comparisoncharturl'  + strComparisonChartURL);
	
	// first change the images to transparent gifs
	// this should make the images blank until the actual images have
	// been loaded. 

	window.document.images['pricechart'].src = transparentGif.src 
	window.document.images['volumechart'].src = transparentGif.src
	window.document.images['comparisonchart'].src = transparentGif.src


	window.document.images['pricechart'].src = strPriceChartURL
	window.document.images['volumechart'].src = strVolumeChartURL
	window.document.images['comparisonchart'].src = strComparisonChartURL
	}


function updatePeriod(timeperiod)
{
	objFields.period.value=timeperiod
	collectValues()
} 


var activeLink;

function setActiveLink(linkId)
	{
		if(!document.layers)
		{
			if( activeLink != null ){
				document.getElementById(activeLink).className = 'selectorlink'
			}
			activeLink = linkId;
			document.getElementById(activeLink).className = 'activelink'
		}
	}
