if (window.focus) { self.focus() }

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, sChartName_3y, 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;		
		case "Y3" : 
			sChartName=sChartName_3y;
			break;		
		default : 
			sChartName=sChartName_m;
			break;		
	}
	sChart1Props=sChartName_w+"_"+sChartName_m+"_"+sChartName_y+"_"+sChartName_3y;
	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 GetCSVData(sChartName, bNewWindow) {
	alert("Click OK to view an OUTDATED SAMPLE of a data file.  Subscribers' files are current-day.");
	if (typeof(bNewWindow)=='undefined') {
		bNewWindow=true;
	}
	if (bNewWindow) {
		window.open("http://www.theFinancials.com/Samples/data/i001824.csv");
	} else {
		top.document.location="http://www.theFinancials.com/Samples/data/i001824.csv";
	}
}

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;
} 
