﻿//Generating Pop-up Print Preview page
function showPrintWindow( printArea )
{ 
    var windowProps = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=600,height=800';


    //Creating new page
    var pp = window.open( "", '_blank', windowProps);
    
    //Adding HTML opening tag with <HEAD> … </HEAD> portion 
    pp.document.writeln('<HTML><HEAD><title>EmpireCLS Travel Itinerary</title>');
    pp.document.writeln('<LINK href="css/print.css" type="text/css" rel="stylesheet">');
    pp.document.writeln('<LINK href="css/printHide.css" type="text/css" rel="stylesheet" media="print">');
    

    pp.document.writeln('<base target="_self"></HEAD>');
    
    //Adding Body Tag    
    pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" ');
    pp.document.writeln(' leftMargin="0" topMargin="0" rightMargin="0">');
    
    //Adding form Tag
    pp.document.writeln('<form method="post">');
    
    //Creating two buttons Print and Close within a HTML table
    pp.document.writeln('<div class="printBar">');
    pp.document.writeln('<INPUT ID="PRINT" type="button" value="Print" onclick="window.print();" /> ');
    pp.document.writeln('<INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();" />');
    pp.document.writeln('</div>');
    
    pp.document.writeln('<div id="tripItineraryViewContainer" class="tripItineraryView" >');
    //Writing print area of the calling page
    pp.document.writeln(document.getElementById( printArea ).innerHTML);
    //pp.document.writeln( printArea.innerHTML );
    pp.document.writeln('</div>');
    //Ending Tag of </form>, </body> and </HTML>
    pp.document.writeln('</form></body></HTML>'); 
    pp.document.close();
    pp.focus(); 
    pp.print();


} 
