function newWindow(ptt)
{
	timeWindow = window.open(ptt, 'timeWin', 'toolbar=yes,location=no,scrollbars=yes,width=750,height=600')
        timeWindow.focus()
}

var metlinkWindow = null; 

function TimetableGo(idvalue){

	var dropdown = document.getElementById(idvalue);

	if(dropdown.selectedIndex == 0){
		return;
	}

	var metlinkUrl = "http://www.metlinkmelbourne.com.au/route/view/";

	var routeselect = dropdown.options[dropdown.selectedIndex].value;
	var numbers = routeselect.split(",");
	var routenum = parseInt(numbers[1]);

	if(routenum < 0){

		// Port Philip

		switch (routenum){

			case -200 :	document.location = "route_portphilip.shtml";
					break;
			case -400 :	document.location = "resources/SchoolTimetables.pdf";
					break;
			default: document.location = "nightrider.shtml";
				break;
		}

	} else {
		//document.location = "timetables/" + routenum.toString() + ".pdf";
		//if(metlinkWindow == null){
			metlinkWindow = window.open (metlinkUrl + numbers[1], 'metlinkWindow');
		//} else {
		//	metlinkWindow.location.href = metlinkUrl + numbers[1];
			metlinkWindow.focus();
		//}
		 //document.location = metlinkUrl + numbers[1];
	}
	/*
	// In Summer 2008, The Summer Holiday index page required the drop-down listbox to
	// to only show the pages listed on the Summer Holiday indx page, which was a mix
	// of normal routes and HOLiday routes.

	// This adds "HOL" to the URL to jump to, if the selected item has "HOL" in its value

	routeselect = dropdown.options[dropdown.selectedIndex].value;
	if(routeselect.search(/HOL/i) != -1){
		holiday = "HOL";
	}

	routenum = parseInt(dropdown.options[dropdown.selectedIndex].value);

	*/
}

function TimetableGoOld(idvalue){

	var dropdown = document.getElementById(idvalue);
	var prefix = "";
	var holiday = "";

	if(dropdown.selectedIndex == 0){
		return;
	}

	// In Summer 2008, The Summer Holiday index page required the drop-down listbox to
	// to only show the pages listed on the Summer Holiday indx page, which was a mix
	// of normal routes and HOLiday routes.

	// This adds "HOL" to the URL to jump to, if the selected item has "HOL" in its value

	routeselect = dropdown.options[dropdown.selectedIndex].value;
	if(routeselect.search(/HOL/i) != -1){
		holiday = "HOL";
	}

	routenum = parseInt(dropdown.options[dropdown.selectedIndex].value);

	if(routenum < 0){

		// Port Philip

		switch (routenum){

			case -200 :	document.location = "route_portphilip.shtml";
					break;
			case -400 :	document.location = "resources/SchoolTimetables.pdf";
					break;
			default: document.location = "nightrider.shtml";
				break;
		}
		

	} else {
		if(routenum == 280 || routenum == 282){
			document.location = "route" + routenum.toString() + "C.shtml";
		} else {
			document.location = "route" + routenum.toString() + holiday + "T.shtml";
		}
	}

}


function TimetableHolidayGo(idvalue){
	
	var dropdown = document.getElementById(idvalue);
	var prefix = "";
	
	if(dropdown.selectedIndex == 0){
		return;
	}

	var routeselect = dropdown.options[dropdown.selectedIndex].value;
	var numbers = routeselect.split(",");
	var routenum = parseInt(numbers[0]);

	if(routenum < 0){

		// Port Philip

		if(routenum == -200){
			document.location = "route_portphilip.shtml";
		} else {
			// Nightrider Services
			document.location = "nightrider.shtml";
		}

	} else {
		if(routenum == 283){
			document.location = "route" + routenum.toString() + "HOLC.shtml";
		} else {
			document.location = "route" + routenum.toString() + "HOLT.shtml";
		}
	}
}
/* id="timetable903" onchange="Timetable903Go('timetable903');" */
function Timetable903Go(idvalue){
	
	var dropdown = document.getElementById(idvalue);
	
	if(dropdown.selectedIndex == 0){
		return;
	}

	url = dropdown.options[dropdown.selectedIndex].value;

	if(url != ""){

			document.location = url; //resources/SchoolTimetables.pdf
	} 
}
function TimetableSchoolGo(idvalue){
	
	var dropdown = document.getElementById(idvalue);
	var prefix = "";
	
	if(dropdown.selectedIndex == 0){
		return;
	}

	routenum = parseInt(dropdown.options[dropdown.selectedIndex].value);

	if(routenum < 0){

		if(routenum == -400){
			document.location = "resources/SchoolTimetables.pdf";
		} else {
			// Nightrider Services
			document.location = "nightrider.shtml";
		}

	} 
}

function TimetableNewGo(idvalue){
	var dropdown = document.getElementById(idvalue);
	var prefix = "";
	
	if(dropdown.selectedIndex == 0){
		return;
	}

	pdffile = dropdown.options[dropdown.selectedIndex].value;

	if(pdffile != ""){
		document.location = pdffile;
	} 
}

