﻿
function PrintTimeTable(sourceId, cssPrintPath)
{
    var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting += "scrollbars=yes,width=800, height=600, left=50, top=25";
    var content = document.getElementById(sourceId).innerHTML; 

    var ttWindow = window.open("", "", disp_setting);
    ttWindow.document.open();
    ttWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">');
    ttWindow.document.write('<html><head><link href="' + cssPrintPath + '" type="text/css" rel="stylesheet" >');
    ttWindow.document.write('<title>RIS Timetable printable version</title>'); 
    ttWindow.document.write('</head><body onLoad="self.print()">');
    //ttWindow.document.write('<div class="div_close"><a class="list_item_link" href="javascript:window.close()">close</a></div>');
    ttWindow.document.write('<center>');     
    ttWindow.document.write(content);          
    ttWindow.document.write('</center></body></html>'); 
    ttWindow.document.close(); 
    ttWindow.focus(); 
}

function GoToDatesRange(queryString, startText, startId, endText, endId)
{
    //alert("queryString: " + queryString);
    //alert("startText: " + startText + "; startId: " + startId + "; endText: " + endText + "; endId: " + endId);
    var startDate = document.getElementById(startId).value;
    var endDate = document.getElementById(endId).value;
    var queryToAdd = startText + "=" + startDate + "&" + endText + "=" + endDate;
    var fullQuery = queryString + queryToAdd;
    //alert("fullQuery: " + fullQuery);
    window.location = fullQuery;
}

function SelectText(targetId)
{
    document.getElementById(targetId).select();
}
