// JScript File

function ShowMore(strPath)
{
	window.open(strPath, "showmore", "scrollbars=1,resizable=1," +
		"toolbar=no,width=500,height=300,left=" + ((self.screen.width / 2) - 250) + ",top=" + ((self.screen.height / 2) - 150));
}

function HighlightTab(strId)
{
	var el = document.getElementById(strId);
	if (el.className != 'TabBasic TabSelected' && el.className != 'TabBasic TabSelected TabHome')
	{		
		el.className = 'TabBasic TabMouseOver';
		if (strId == 'mtl_nav_main')
			el.className = 'TabBasic TabMouseOver TabHome';
	}
	//document.getElementById(strId + '_right').className = 'TabBasic' + ' ' + 'TabMouseOverRight';
}

function UnHighlightTab(strId)
{
	var el = document.getElementById(strId);
	if (el.className != 'TabBasic TabSelected' && el.className != 'TabBasic TabSelected TabHome')
	{	
		el.className = 'TabBasic TabDefault';
		if (strId == 'mtl_nav_main')
			el.className = 'TabBasic TabDefault TabHome';
	}
	//document.getElementById(strId + '_right').className = 'TabBasic' + ' ' + 'TabDefaultRight';
}

function SelectTab(strId)
{
	var el = document.getElementById(strId);
	el.className = 'TabBasic TabSelected';
	if (strId == 'mtl_nav_main')
		el.className = 'TabBasic TabSelected TabHome';
}

function AJAXRequest(url, id, basynch)			//This function fires a request for the rss feed
{
	var el = document.getElementById(id);
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) 
	{
		req = new XMLHttpRequest();
		req.onload = function () {
			if (req.readyState == 4) 
			{
				// only if "OK"
				if (req.status == 200) 
				{
					el.innerHTML = req.responseText;
					////lockCol('tbl');
				} 
				else 
				{
					alert("There was a problem retrieving the rss data:\n" + req.statusText);
				}
			}
		};
		
		req.open("GET", url, basynch);
		req.send(null);
	} 
	// branch for IE/Windows ActiveX version
	else if (window.ActiveXObject) 
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) 
		{
			req.onreadystatechange = function () {
				if (req.readyState == 4) 
				{
				// only if "OK"
					if (req.status == 200) 
					{
						el.innerHTML = req.responseText;
						//alert(el.innerHTML);
					} 
					else 
					{
						alert("There was a problem retrieving the rss data:\n" + req.statusText);
					}
				}
			};
			req.open("GET", url, basynch);
			req.send();
		}
	}
}

function setTime(id)
{
	var el = document.getElementById(id);
    //set the tax deadline ehader
    el.innerHTML = "Tax Deadline<br/>";
	
	//todays date
	var now = new Date();
	//taxday (can't fall on a weekend)
	var taxday = new Date("15 April, " + (now.getFullYear()));
	var dayOfMonth;
    //if the this years april 15 falls on a weekend then adjust the day of the month accordingly
	if (taxday.getDay() == 0)
	    dayOfMonth = 16;
	else if (taxday.getDay() == 6)
	    dayOfMonth = 17;
	else
		dayOfMonth = 15;
	taxday = new Date( dayOfMonth + " April, " + now.getFullYear());
    // if today is after this years taxday then look at next years tax day

    if(now.getDate() == dayOfMonth && now.getMonth() == taxday.getMonth())
        el.innerHTML = el.innerHTML + "Today";
    else
	{
	    if ((Date.parse(now) - Date.parse(taxday)) > 0)
	    {
	        taxday = new Date("15 April, " + (now.getFullYear() + 1));    
            //if the this years april 15 falls on a weekend then adjust the day of the month accordingly
    	    if (taxday.getDay() < 3)
	            dayOfMonth = 15 + taxday.getDay() + 1;
	        else
		        dayOfMonth = 15;
	        taxday = new Date(dayOfMonth + " April, " + (now.getFullYear() + 1));
        }
	    //the day of the month that the next taxday falls on
	    //get the next tax day in milliseconds
	    var dt = Date.UTC(taxday.getFullYear(), 3, dayOfMonth, 5, 0, 0);
	    //get the number of milliseconds btwn now and the next tax day
	    var difMil = dt - Date.parse(now);
	    var difDay = Math.floor(difMil / 86400000);
	    difMil = difMil - (difDay * 86400000);
	    var difHour = Math.floor(difMil / 3600000);
	    difMil = difMil - (difHour * 3600000);
	    var difMin = Math.floor(difMil / 60000);
	    difMil = difMil - (difMin * 60000);
	    var difSec = Math.floor(difMil / 1000);
        
        if (difDay > 0)
            el.innerHTML = el.innerHTML + difDay + " days<br/>";
        if (difHour > 0 || difDay > 0)
            el.innerHTML = el.innerHTML + difHour + " hours<br/>";
        if (difMin > 0|| difHour > 0 || difDay > 0)
            el.innerHTML = el.innerHTML + difMin + " minutes<br/>";
        //if (difSec > 0)
            el.innerHTML = el.innerHTML + difSec + " seconds";
    		
    }
    setTimeout("setTime('" + id + "')", 500);
}