﻿var arcURL= "http://www.londoncapitalgroup.com/capitalspreads/news/";

function populateYearSelect(yearBegin) {
	var d = new Date();
	curr_year = d.getFullYear();
	for(i = 0; i < 100; i++) {
		document.getElementById('myYear').options[i] = new Option(curr_year-i,curr_year-i);
		if (curr_year-i == yearBegin) break;
	}
}

function populateMonthSelect() {
	var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var theMonth;
	var theMonthi;
	var monthCounter;
	var theDate = new Date();
	for (monthCounter = 0; monthCounter < 12; monthCounter++) {
		theDate.setMonth(monthCounter);
		theMonth = theDate.getMonth()
		theMonths = monthArray[theDate.getMonth()];
		document.write('<OPTION value=' + theMonth + '>' + theMonths);
	}
}

function getTodaysComment() {
	var today = new Date();
	var dd    = today.getDate();
	var yyyy  = today.getYear();
	var mmm   = month(today.getMonth());
	mmm       = mmm.substring(0,3).toLowerCase();
	if(yyyy < 1000) yyyy += 1900;
	//displaySelectedDate(dd, mmm, yyyy)
	var fileName = arcURL + "archive/" + yyyy + "/" + mmm + "/" + dd + ".html";
	frames['contentFrame'].location.href = fileName;
}

function getDailyComment(dd, mmm, yyyy) {
	var fileName = arcURL + "archive/" + yyyy + "/" + mmm + "/" + dd + ".html";
	//displaySelectedDate(dd, mmm, yyyy)
	frames['contentFrame'].location.href = fileName;
}
function displaySelectedDate(dd, mmm, yyyy) {
	document.getElementById("selDate").innerHTML= "Daily Comment for: " + dd + "-" + mmm.toUpperCase() + "-" + yyyy;			
	//document.getElementById("selDate").innerHTML= dd + "-" + mmm.toUpperCase() + "-" + yyyy;
	//document.getElementById("selMonth").innerHTML= mmm.toUpperCase();
}

function changeAirDays(sel) {
	var prgId = 0;
	if (prgId == 0) {
		window.calUrl = '#';
		window.calParamNames = 'date';
		//window.calendarName = "BROWSE THE ARCHIVES";
		window.calendarName = "<span class=calHead>London Capital Group</span>";
		if (document.frmCalendar.myYear.options[document.frmCalendar.myYear.selectedIndex].value < 2008) {
			window.calLinks = "0111110";
		}
		else{window.calLinks = "1111111";}
		window.startDay = 0;
		window.startMonth = 0;
		window.startYear = 0;
		window.calParamValues = 'dateSelected';
		doCalendarLoad();
	}
}

function changeYear(sel) {
	window.curYear = sel.options[sel.selectedIndex].value;
	//if (document.frmCalendar.selPrograms.options.selectedIndex == 0 && sel.options[sel.selectedIndex].value < 1995) {
	if (sel.options[sel.selectedIndex].value < 2008) {
		window.calLinks = "0111110";
	}
	else {
		window.calLinks = "1111111";
	}
	doCalendarLoad();
}

//**** PRINT THE DAILY MARKET NEWS PAGE CURRENTLY VIEWING ***
function changeMonth(sel) {
	window.curMonth = sel.options[sel.selectedIndex].value;
	doCalendarLoad();
}

function CheckIsIE() {
	if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;} else { return false; }
}

function PrintThisPage() {
	if (CheckIsIE() == true) {
		document.ifWorkspace.focus();
		document.ifWorkspace.print();
	}
	else {
		window.frames['contentFrame'].focus();
		window.frames['contentFrame'].print();
	} 
} 
