if (window.focus) { self.focus() }

var sFileName=new String(document.URL);
var sFileName=sFileName.split('/');
var sFileName=sFileName[sFileName.length-1];

if (sFileName.match(/Commodity/)) {
	sListName="com_market_reports.html";
} else {
	if (sFileName.match(/Index/)) {
		sListName="idx_market_reports.html";
	} else {
		sListName="forex_market_reports.html";
	}
}

function BackToList() {
	document.location=sListName;
}

function ChangeTimeframes() {
	for (i=0; i < document.forms[document.forms.length-1].optTimeframe.length; i++) {
		if (document.forms[document.forms.length-1].optTimeframe[i].checked) {
			var nTimeFrameIndex=i;
			break;
		}
	}
	if (typeof(sChart1Props)=='undefined') {
		asChart1Props=initChart1Props.split(/_/);
	} else {
		asChart1Props=sChart1Props.split(/_/);
	}
	document.images['Thumbnail'].src='http://www.theFinancials.com/Samples/' + asChart1Props[nTimeFrameIndex] + 'p.jpg'
}

function LoadThumbnail(sChartName_w, sChartName_m, sChartName_y, sNewLocation) {
	for (i=0; i < document.forms[document.forms.length-1].optTimeframe.length; i++) {
		if (document.forms[document.forms.length-1].optTimeframe[i].checked) {
			var sTimeframe=document.forms[document.forms.length-1].optTimeframe[i].value;
			break;
		}
	}
	switch (sTimeframe.toUpperCase()){
		case "W" : 
			sChartName=sChartName_w;
			break;		
		case "Y" : 
			sChartName=sChartName_y;
			break;		
		default : 
			sChartName=sChartName_m;
			break;		
	}
	sChart1Props=sChartName_w+"_"+sChartName_m+"_"+sChartName_y;
	sChartContainerName=sNewLocation.split(/_/);
	document.images[sChartContainerName[0]].src='http://www.theFinancials.com/Samples/' + sChartName + 'p.jpg'
	if (sNewLocation) {
		movePageMarker(sChartContainerName[0],sNewLocation) 
	}
}

function ZoomThumbnail(sDir, sThumbChartName, sTarget) {
	if (!sDir) {
		sDir="vortex";
	}
	if (typeof(sTarget)=='undefined') {
		sTarget="_top";
	} else {
		if (!sTarget) {
			sTarget="_top";
		}
	}
	var nCurChartID=new String(document[sThumbChartName].src);
	var nCurChartIDList=nCurChartID.split('/');
	var nCurChartID=nCurChartIDList[nCurChartIDList.length-1];
	var nCurChartID=nCurChartID.substring(0,7) + 'v.PDF';
	if (sTarget.toUpperCase()=="_BLANK") {
		window.open("http://www.theFinancials.com/Samples/" + nCurChartID);
	} else {
		top.document.location="http://www.theFinancials.com/Samples/" + nCurChartID;
	}
}

function movePageMarker(sChartContainerName,sNewLocation) {
	sNameToMatch=String(sChartContainerName+"_ChartInd_");
	for (i=0; i < document.images.length; i++) {
		sImageName=String(document.images[i].name);
		if (sImageName.substr(0,sNameToMatch.length)==sNameToMatch) {
			if (sImageName == sNewLocation) {
				document.images[sNewLocation].src="http://www.theFinancials.com/images/ActiveChart.gif";			
			} else {
				document.images[i].src = "http://www.theFinancials.com/images/blank.gif";
			}
		}
	}
	return null;
}

function drpGoToPage(drpDown) {
	var sTarget=drpDown.options[drpDown.selectedIndex].value; 
	if (sTarget=='') {
		drpDown.selectedIndex=0;
	} else {
		document.location=sTarget;
 	} 
	return true;
} 
