var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printSpecial()
{
    if (document.getElementById != null){
        var html = '<HTML class=printReady>\n<HEAD>\n';

        if (document.getElementsByTagName != null)
        {
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0){
                html += headTags[0].innerHTML;
            }

            html += '\n</HE' + 'AD>\n<BODY class=printReady>\n';
        }
        var printReadyElem = document.getElementById("printReady");
        if (printReadyElem != null){
            html += printReadyElem.innerHTML;
            var newHTML=html.replace('printer_friendly.gif','1by1.gif');
            html=newHTML;
        }
        else{
            //No print class divtags
            alert("This page has not been configured for printing.");
            return;
        }

        var pageLocation=document.location+'';

        //bottom blue line
        html += '<table width="100%">';
        if (document.location.protocol == "https:"){
            html += '<tr bgcolor="#3e72ae"> <td colspan="2"><img src="https://www.gov.pe.ca/gif/1by1.gif" height="2" width="1" /><br></t'+'d></t'+'r>';
        }
        else {
            html += '<tr bgcolor="#3e72ae"> <td colspan="2"><img src="http://www.gov.pe.ca/gif/1by1.gif" height="2" width="1" /><br></t'+'d></t'+'r>';
        }
        if (document.location.protocol == "https:"){
            html += '<tr><td><img src="https://www.gov.pe.ca/gif/wordmark.gif" align="left" /></'+'td>';
        }
        else {
            html += '<tr><td><img src="http://www.gov.pe.ca/gif/wordmark.gif" align="left" /></'+'td>';
        }
        html += '<td width="90%">';
        html += '<b>This information has been taken from www.gov.pe.ca</b><br />';
        html += '<b>URL:</b> <i>'+pageLocation.replace('\&','\&amp;')+'</i><BR /><BR />';
        html += '</'+'td>';
        html += '<table width="75%"><tr><td><i>PLEASE NOTE: The inclusion of or reference to any business or organization on this page is not meant to be an endorsement by the Government of Prince Edward Island of the services offered by any particular business or organization. Further, the Government of Prince Edward Island advises that individual entries are based on information supplied by the business or organization in question. Therefore, while InfoPEI is updated to correct errors as appropriate, the Government of Prince Edward Island does not warrant that the information is accurate.</'+'i></t'+'d></ti'+'r></ta'+'ble>';
        html += '</'+'tr>';
        html += '</ta'+'ble>';
        //disclaimer
        html += '<BR />';
        html += '\n</BO' + 'DY>\n</HT' + 'ML>';
        var printWin = window.open("","printSpecial");
        printWin.document.open();
        printWin.document.write(html);
        //printWin.document.write(document.location.protocol);
        printWin.document.close();
        if (gAutoPrint){
            //printWin.print();
        }
    }
    else{
        alert("Sorry, the print ready feature is only available in modern browsers.");
    }
}
/*
  French version of printSpecial
*/
function printSpecialf()
{
    if (document.getElementById != null){
        var html = '<HTML>\n<HEAD>\n';

        if (document.getElementsByTagName != null)
        {
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0){
                html += headTags[0].innerHTML;
            }

            html += '\n</HE' + 'AD>\n<BODY>\n';
        }
        var printReadyElem = document.getElementById("printReady");
        if (printReadyElem != null){
            html += printReadyElem.innerHTML;
            var newHTML=html.replace('printer_friendly_F.gif','');
            html=newHTML;
        }
        else{
            //No print class divtags
            alert("This page has not been configured for printing.");
            return;
        }

        var pageLocation=document.location+'';

        //bottom blue line
        html += '<table width="100%">';
        if (document.location.protocol == "https:"){
            html += '<tr bgcolor="#3e72ae"> <td colspan="2"><img src="https://www.gov.pe.ca/gif/1by1.gif" height="2" width="1" /><br></t'+'d></t'+'r>';
        }
        else {
            html += '<tr bgcolor="#3e72ae"> <td colspan="2"><img src="http://www.gov.pe.ca/gif/1by1.gif" height="2" width="1" /><br></t'+'d></t'+'r>';
        }
        if (document.location.protocol == "https:"){
            html += '<tr><td><img src="https://www.gov.pe.ca/gif/stylesheet/f_wordmark.gif" align="left" /></'+'td>';
        }
        else {
            html += '<tr><td><img src="http://www.gov.pe.ca/gif/stylesheet/f_wordmark.gif" align="left" /></'+'td>';
        }
        html += '<td width="90%">';
        html += '<b>This information has been taken from www.gov.pe.ca</b><br />';
        html += '<b>URL:</b> <i>'+pageLocation.replace('\&','\&amp;')+'</i><BR /><BR />';
        html += '</'+'td>';
        html += '<table width="75%"><tr><td><i>VEUILLEZ NOTER : Le fait q\'une entreprise ou un organisme soit inclus ou mentionn&eacute; dans Info&Icirc;.-P.-&Eacute;. ne signifie pas que le gouvernement de l\'&Icirc;le-du-Prince-&Eacute;douard l\'endosse ou endosse les services offerts par cet organisme ou entreprise. De plus, le gouvernement de l\'&Icirc;le-du-Prince-&Eacute;douard notifie que les entr&eacute;es individuelles sont fond&eacute;es sur les renseignements fournis par l\'entreprise ou l\'organisme en question. Par cons&eacute;quent, m&ecirc;me si Info&Icirc;.-P.-&Eacute;. est mis &agrave; jour pour corriger les erreurs au besoin, le gouvernement de l\'&Icirc;le-du-Prince-&Eacute;douard ne garantit pas que l\'information contenue est pr&eacute;cise.</'+'i></t'+'d></ti'+'r></ta'+'ble>';
        html += '</'+'tr>';
        html += '</ta'+'ble>';
        //disclaimer
        html += '<BR />';
        html += '\n</BO' + 'DY>\n</HT' + 'ML>';
        var printWin = window.open("","printSpecial");
        printWin.document.open();
        printWin.document.write(html);
        printWin.document.close();
        if (gAutoPrint){
            //printWin.print();
        }
    }
    else{
        alert("Sorry, the print ready feature is only available in modern browsers.");
    }
}
function printEServicesReceipt()
{
    if (document.getElementById != null){
        var html = '<HTML class=printReady>\n<HEAD>\n';

        if (document.getElementsByTagName != null)
        {
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0){
                html += headTags[0].innerHTML;
            }

            html += '\n</HE' + 'AD>\n<BODY class="printReady" onLoad="window.print();return false;">\n';
        }
        var printReadyElem = document.getElementById("printReceipt");
        if (printReadyElem != null){
            html += printReadyElem.innerHTML;
        }
        else{
            //No print class divtags
            alert("This page has not been configured for printing.");
            return;
        }

        var pageLocation=document.location+'';

        //bottom blue line
        html += '\n</'+'TD></'+'TR></TA'+ 'BLE></BO' + 'DY>\n</HT' + 'ML>';
        var printWin = window.open("","printReceipt");
        printWin.document.open();
        printWin.document.write(html);
        printWin.document.close();
    }
    else{
        alert("Sorry, the print ready feature is only available in modern browsers.");
    }
}
