function doDate()
{
	var now = new Date()
	var month = now.getMonth() + 1
	document.write( month + "/" + now.getDate() + "/" + now.getYear())
}


function doOldDate()
{
	var now = new Date()
	var year = now.getYear() - 1
	var month = now.getMonth() + 1
	document.write(month + "/" +  now.getDate() + "/" + year )
}


function returnOldDate()
{
	var now = new Date()
	var year = now.getYear() - 1
	now.setFullYear(year);
	var month = now.getMonth() + 1
	var day = now.getDate()
	if (now.getDay() == 0 || now.getDay() == 6 )
	{
		if (day < 15) day += 2;
		else day -= 2;
	
	}
                     year = year - 2000
 	return ( month + "%2F" + day + "%2F" + year )
}

function returnnewDate()
{
	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() + 1
	return (month + "%2F" +  now.getDate() + "%2F" + year )
}


function returnyesterdaysDate()
{
	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() + 1
	var day = now.getDate() - 1
	if (now.getDay() < 2 || now.getDay() == 5 ) day = day-2;
	if (day < 1) 
	{
		day = 30;
		month = month - 1;
	}
	year = year-2000
	return (month + "%2F" +  day + "%2F" + year )
}


function getQuoteLink( ticker )
{
  document.write("<a href = 'http://bigcharts.marketwatch.com/historical/default.asp?symb=" + ticker + "&closedate="+ returnOldDate() + "&x=45y=20'>Quote</a>")
}



function getNewQuoteLink( ticker )
{

	document.write("<a href = 'http://bigcharts.marketwatch.com/historical/default.asp?symb=" + ticker + "&closedate="+ returnyesterdaysDate() + "&x=0&y=0'>Quote</a>")
}
