// JavaScript Document
// For use with the PersDashBoard 


function initdt(n)
{
	//alert("Yea....")
	//startingUp()
}

function startingUp()
{
	
	var viewportwidth;
	var viewportheight;
	if (window.screen) {
	window.moveTo(0,0);
	this.resizeTo(screen.availWidth,screen.availHeight);
	}
	//alert("Getting things done");
    viewportwidth = document.documentElement.clientWidth,
    viewportheight = document.documentElement.clientHeight


	RSpace = viewportheight  - document.getElementById("mf").offsetHeight -200;
	document.getElementById("mf").height = RSpace;
//	document.getElementById("leftSide").height = RSpace;	
//	document.getElementById("rightFrame").height = RSpace;  
	doResize();

}

function sizeAltered()
{

	var viewportwidth;
	var viewportheight;

    viewportwidth = document.documentElement.clientWidth,
    viewportheight = document.documentElement.clientHeight


	RSpace = viewportheight  - document.getElementById("mf").offsetHeight ;
	document.getElementById("mf").height = RSpace;
	document.getElementById("leftSide").height = RSpace;	
	document.getElementById("rightFrame").height = RSpace;
	//alert("Resize Fired");
}

function max()
{
if (window.screen) {
window.moveTo(0,0);
window.outerHeight = screen.availHeight;
window.outerWidth = screen.availWidth;
}
}


var Perspective = 1;
var Agency = 1;
var Reports = 2;
var theDocument ="";






function tab1()
{
		Agency = 1 ;
		resetTabs();
		document.getElementById("x1").className = "selected";
		//document.getElementById("mf").src = "agencies/t/dashboarda_t_fut.htm";
		document.getElementById("x1").checked ;	
		updateMainFrame();
}

function tab2()
{
		Agency = 2;

		//document.getElementById("rf").src = "leftPanel.html"
		resetTabs();
		document.getElementById("x2").className = "selected";
		document.getElementById("x2").checked ;	
		updateMainFrame();
}

function tab3()
{
		Agency = 3;
		resetTabs();
		document.getElementById("x3").className = "selected";
		document.getElementById("x3").checked ;	
		updateMainFrame();
}

function tab4()
{
		Agency = 4;

		//document.getElementById("rf").src = "http://mted115.mtaent.org:9090/approot/dashboard/agencies/ag_com.htm"
		resetTabs();
		document.getElementById("x4").className = "selected";
	//alert("agency is " + Agency + "    Perspective is " + Perspective);
		document.getElementById("x4").checked ;		
		updateMainFrame();
}
function tab5()
{
		Agency = 5;

		//document.getElementById("rf").src = "http://mted115.mtaent.org:9090/approot/dashboard/agencies/ag_com.htm"
		resetTabs();
		document.getElementById("x5").className = "selected";
		document.getElementById("x5").checked ;	
		updateMainFrame();
}

function tab6()
{
		Agency = 6;

		//document.getElementById("rf").src = "http://mted115.mtaent.org:9090/approot/dashboard/agencies/ag_com.htm"
		resetTabs();
		document.getElementById("x6").className = "selected";
		document.getElementById("x6").checked ;	
		updateMainFrame();
}

function tab7()
{
		Agency = 7;

		//document.getElementById("rf").src = "http://mted115.mtaent.org:9090/approot/dashboard/agencies/ag_com.htm"
		resetTabs();
		document.getElementById("x7").className = "selected";
		document.getElementById("x7").checked ;	
		updateMainFrame();
}

function tab8()
{
		
		Agency = 8;

		//document.getElementById("rf").src = "http://mted115.mtaent.org:9090/approot/dashboard/agencies/ag_com.htm"
		resetTabs();
		document.getElementById("x8").className = "selected";
		document.getElementById("x8").checked ;	
		updateMainFrame();
}

function tab9()
{		
		Agency = 9;
		resetTabs();
		document.getElementById("x8").className = "selected";
		document.getElementById("x8").checked ;			
		updateMainFrame();
		
}

function tab10()
{		
		Agency = 10;
		resetTabs();
		document.getElementById("x8").className = "selected";
		document.getElementById("x8").checked ;			
		updateMainFrame();
		
}




function resetTabs() 
{
	//document.getElementById("x1").className = "bGround";
	document.getElementById("x2").className = "bGround";
	document.getElementById("x3").className = "bGround";
	document.getElementById("x4").className = "bGround";
	//document.getElementById("x5").className = "bGround";
	document.getElementById("x7").className = "bGround";
	document.getElementById("x8").className = "bGround";
	//document.getElementById("y1").className = "bGround";
	//document.getElementById("y2").className = "bGround";
	

}



function resetButtons()
{
	
	//var newImage = Image(110,32);
	//var newTab = Image(110,32);
	//newTab.src = "lm_Y1.png";
	//document.getElementById("leftNavBut1").src = newTab.src;
	//newTab.src = "lm_Y2.png";
	//document.getElementById("leftNavBut2").src = newTab.src;
	//newTab.src = "lm_Y3.png";
	//document.getElementById("leftNavBut3").src = newTab.src;
	//newTab.src = "lm_Y4.png";
	//document.getElementById("leftNavBut4").src = newTab.src;
	//newTab.src = "lm_Y5.png";
	//document.getElementById("leftNavBut5").src = newTab.src;
}

function updateMainFrame()
{
	// IN version 10 the Top level reports tab has been taken away so it will always be REPORT 2
	// Also , perspective has been taken away so Perpective will always be 1
	//the switch logic is being left in just in case management changes their mind again about how we are presenting this stuff.
	
	var documentX = "";
	//alert("IN UPDATEMF : We are on Agency "+ Agency + "   Report : "+ Reports + "   And Perspective : "+ Perspective);

// ALL Perspectives
if ( (Agency == 1 )	)
	{
	
		switch ( Perspective )
		{
			case 1 :
					
					documentX = "agencies//hqadmin/dashboardmth.htm";		
					documentY = "agencies/hqadmin/dashboardytd.htm";	
					documentZ = "agencies/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/dashboardmth_cp.htm";		
					documentY = "agencies/dashboardytd_cp.htm";	
					documentZ = "agencies/dashboardye_cp.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/dashboardmth_ep.htm";		
					documentY = "agencies/dashboardytd_ep.htm";	
					documentZ = "agencies/dashboardye_ep.htm";	
					break;			
			case 4:
					
					documentX = "agencies/dashboardmth_fp.htm";		
					documentY = "agencies/dashboardytd_fp.htm";	
					documentZ = "agencies/dashboardye_fp.htm";			
					break;			
			case 5:
					documentX = "agencies/dashboardmth_ip.htm";		
					documentY = "agencies/dashboardytd_ip.htm";	
					documentZ = "agencies/dashboardye_ip.htm";	
					break;	


			default:
					documentX = "agencies/dashboardmth.htm";		
					documentY = "agencies/dashboardytd.htm";	
					documentZ = "agencies/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
//TBTA 
if ( (Agency == 2 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/tbta/dashboardmth.htm";		
					documentY = "agencies/tbta/dashboardytd.htm";	
					documentZ = "agencies/tbta/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/tbta/cp/dashboardmth.htm";		
					documentY = "agencies/tbta/cp/dashboardytd.htm";	
					documentZ = "agencies/tbta/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/tbta/ep/dashboardmth.htm";		
					documentY = "agencies/tbta/ep/dashboardytd.htm";	
					documentZ = "agencies/tbta/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/tbta/fp/dashboardmth.htm";		
					documentY = "agencies/tbta/fp/dashboardytd.htm";	
					documentZ = "agencies/tbta/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/tbta/ip/dashboardmth.htm";		
					documentY = "agencies/tbta/ip/dashboardytd.htm";	
					documentZ = "agencies/tbta/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/tbta/dashboardmth.htm";		
					documentY = "agencies/tbta/dashboardytd.htm";	
					documentZ = "agencies/tbta/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}

if ( (Agency == 3 )	)
	{//alert("LIRR" );
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/lirr/dashboardmth.htm";		
					documentY = "agencies/lirr/dashboardytd.htm";	
					documentZ = "agencies/lirr/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/lirr/cp/dashboardmth.htm";		
					documentY = "agencies/lirr/cp/dashboardytd.htm";	
					documentZ = "agencies/lirr/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/lirr/ep/dashboardmth.htm";		
					documentY = "agencies/lirr/ep/dashboardytd.htm";	
					documentZ = "agencies/lirr/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/lirr/fp/dashboardmth.htm";		
					documentY = "agencies/lirr/fp/dashboardytd.htm";	
					documentZ = "agencies/lirr/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/lirr/ip/dashboardmth.htm";		
					documentY = "agencies/lirr/ip/dashboardytd.htm";	
					documentZ = "agencies/lirr/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/lirr/dashboardmth.htm";		
					documentY = "agencies/lirr/dashboardytd.htm";	
					documentZ = "agencies/lirr/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}

	
if ( (Agency == 4 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/mnr/dashboardmth.htm";		
					documentY = "agencies/mnr/dashboardytd.htm";	
					documentZ = "agencies/mnr/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/mnr/cp/dashboardmth.htm";		
					documentY = "agencies/mnr/cp/dashboardytd.htm";	
					documentZ = "agencies/mnr/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/mnr/ep/dashboardmth.htm";		
					documentY = "agencies/mnr/ep/dashboardytd.htm";	
					documentZ = "agencies/mnr/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/mnr/fp/dashboardmth.htm";		
					documentY = "agencies/mnr/fp/dashboardytd.htm";	
					documentZ = "agencies/mnr/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/mnr/ip/dashboardmth.htm";		
					documentY = "agencies/mnr/ip/dashboardytd.htm";	
					documentZ = "agencies/mnr/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/mnr/dashboardmth.htm";		
					documentY = "agencies/mnr/dashboardytd.htm";	
					documentZ = "agencies/mnr/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
	
if ( (Agency == 5 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/mtahq/dashboardmth.htm";		
					documentY = "agencies/mtahq/dashboardytd.htm";	
					documentZ = "agencies/mtahq/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/mtahq/cp/dashboardmth.htm";		
					documentY = "agencies/mtahq/cp/dashboardytd.htm";	
					documentZ = "agencies/mtahq/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/mtahq/ep/dashboardmth.htm";		
					documentY = "agencies/mtahq/ep/dashboardytd.htm";	
					documentZ = "agencies/mtahq/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/mtahq/fp/dashboardmth.htm";		
					documentY = "agencies/mtahq/fp/dashboardytd.htm";	
					documentZ = "agencies/mtahq/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/mtahq/ip/dashboardmth.htm";		
					documentY = "agencies/mtahq/ip/dashboardytd.htm";	
					documentZ = "agencies/mtahq/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/mtahq/dashboardmth.htm";		
					documentY = "agencies/mtahq/dashboardytd.htm";	
					documentZ = "agencies/mtahq/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
	
	
	
	
	
	if ( (Agency == 6 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/nyctransit/dashboardmth.htm";		
					documentY = "agencies/nyctransit/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/nyctransit/cp/dashboardmth.htm";		
					documentY = "agencies/nyctransit/cp/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/nyctransit/ep/dashboardmth.htm";		
					documentY = "agencies/nyctransit/ep/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/nyctransit/fp/dashboardmth.htm";		
					documentY = "agencies/nyctransit/fp/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/nyctransit/ip/dashboardmth.htm";		
					documentY = "agencies/nyctransit/ip/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/nyctransit/dashboardmth.htm";		
					documentY = "agencies/nyctransit/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
	
	
	if ( (Agency == 7 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/nyctransit/dashboardmth.htm";		
					documentY = "agencies/nyctransit/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/nyctransit/cp/dashboardmth.htm";		
					documentY = "agencies/nyctransit/cp/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/nyctransit/ep/dashboardmth.htm";		
					documentY = "agencies/nyctransit/ep/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/nyctransit/fp/dashboardmth.htm";		
					documentY = "agencies/nyctransit/fp/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/nyctransit/ip/dashboardmth.htm";		
					documentY = "agencies/nyctransit/ip/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/nyctransit/dashboardmth.htm";		
					documentY = "agencies/nyctransit/dashboardytd.htm";	
					documentZ = "agencies/nyctransit/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
	
	if ( (Agency == 8 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/mtabus/dashboardmth.htm";		
					documentY = "agencies/mtabus/dashboardytd.htm";	
					documentZ = "agencies/mtabus/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/mtabus/cp/dashboardmth.htm";		
					documentY = "agencies/mtabus/cp/dashboardytd.htm";	
					documentZ = "agencies/mtabus/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/mtabus/ep/dashboardmth.htm";		
					documentY = "agencies/mtabus/ep/dashboardytd.htm";	
					documentZ = "agencies/mtabus/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/mtabus/fp/dashboardmth.htm";		
					documentY = "agencies/mtabus/fp/dashboardytd.htm";	
					documentZ = "agencies/mtabus/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/mtabus/ip/dashboardmth.htm";		
					documentY = "agencies/mtabus/ip/dashboardytd.htm";	
					documentZ = "agencies/mtabus/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/mtabus/dashboardmth.htm";		
					documentY = "agencies/mtabus/dashboardytd.htm";	
					documentZ = "agencies/mtabus/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
		if ( (Agency == 10 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/capcons/dashboardmth.htm";		
					documentY = "agencies/capcons/dashboardytd.htm";	
					documentZ = "agencies/capcons/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/mtabus/cp/dashboardmth.htm";		
					documentY = "agencies/mtabus/cp/dashboardytd.htm";	
					documentZ = "agencies/mtabus/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/mtabus/ep/dashboardmth.htm";		
					documentY = "agencies/mtabus/ep/dashboardytd.htm";	
					documentZ = "agencies/mtabus/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/mtabus/fp/dashboardmth.htm";		
					documentY = "agencies/mtabus/fp/dashboardytd.htm";	
					documentZ = "agencies/mtabus/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/mtabus/ip/dashboardmth.htm";		
					documentY = "agencies/mtabus/ip/dashboardytd.htm";	
					documentZ = "agencies/mtabus/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/mtabus/dashboardmth.htm";		
					documentY = "agencies/mtabus/dashboardytd.htm";	
					documentZ = "agencies/mtabus/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
if ( (Agency == 9 )	)
	{
		switch ( Perspective )
				{
			case 1 :
					
					documentX = "agencies/libus/dashboardmth.htm";		
					documentY = "agencies/libus/dashboardytd.htm";	
					documentZ = "agencies/libus/dashboardye.htm";		
					break;			
			case 2:
					
					documentX = "agencies/libus/cp/dashboardmth.htm";		
					documentY = "agencies/libus/cp/dashboardytd.htm";	
					documentZ = "agencies/libus/cp/dashboardye.htm";		
					break;			
			case 3 :
					
					documentX = "agencies/libus/ep/dashboardmth.htm";		
					documentY = "agencies/libus/ep/dashboardytd.htm";	
					documentZ = "agencies/libus/ep/dashboardye.htm";	
					break;			
			case 4:
					
					documentX = "agencies/libus/fp/dashboardmth.htm";		
					documentY = "agencies/libus/fp/dashboardytd.htm";	
					documentZ = "agencies/libus/fp/dashboardye.htm";			
					break;			
			case 5:
					documentX = "agencies/libus/ip/dashboardmth.htm";		
					documentY = "agencies/libus/ip/dashboardytd.htm";	
					documentZ = "agencies/libus/ip/dashboardye.htm";	
					break;	


			default:
					documentX = "agencies/libus/dashboardmth.htm";		
					documentY = "agencies/libus/dashboardytd.htm";	
					documentZ = "agencies/libus/dashboardye.htm";			
					break;

		}
		//documentX = "agencies/dashboarda.htm";		
		
	}
	
	
	
	//alert("We are on Agency "+ Agency + "Report : "+ Reports + "And Perspective : "+ Perspective+ "   Document = "+ documentX);
	
	 //alert("Phase is Default"+ documentX);
	//alert("reached the update" + Agency + " Document X " + documentX);
	if (Reports == 1) 
	{
		scrollOFF();
		document.getElementById("mf").src = documentX;
		theDocument = documentX;
	}
	if (Reports == 2) 
	{
		scrollOFF();
		document.getElementById("mf").src = documentY;
		theDocument = documentY;
	}//alert("we should have passed the update"+theDocument);

	if (Reports == 3) 
	{
		scrollOFF();
		document.getElementById("mf").src = documentZ;
		theDocument = documentZ;
	}
	if (Reports == 4) 
	{
			scrollOFF();
			document.getElementById("mf").src = "FredTab.html";	
		// report 4 is special. it always shows the same thing
	}

	//alert("we should have passed the update"+theDocument);

	doResize();
	//return theDocument;
}

function doSearch()
{
	scrollON();
		document.getElementById("mf").src = "search.html";
		//window.open("search.html", "search");
}

function feedBack()
{
		scrollON();
		document.getElementById("mf").src = "feedback2.html";
}

function returnToHome(){
			document.getElementById("mf").src ="Introduction.htm";
}
function search1(){
		
	document.getElementById("searchform").action="http://search.mta.info/search";
	//document.getElementById("searchform").target="mf";
}

function search2(){
			document.getElementById("searchform").action="search.html";
			document.getElementById("searchform").target="_top";
}


function scrollON()
{
	document.getElementById('DivID2').innerHTML ='<iframe id=\"mf\" name=\"mainFrame\" src=\"Introduction.htm\" frameborder=\"0\"   align=\"top\"     scrolling=\"yes\"  height=\"650\"  width=\"100%\"  ></iframe>';	
doResize();
}

function scrollOFF()
{
	document.getElementById('DivID2').innerHTML ='<iframe id=\"mf\" name=\"mainFrame\" src=\"Introduction.htm\" frameborder=\"0\"   align=\"top\"     scrolling=\"no\"  height=\"650\"  width=\"100%\"  ></iframe>';	
doResize();
}

