function jsCleanup(html){
    var re = new RegExp("<SCRIPT.*</SCRIPT>");
    while (html.match(re)){
    html = html.replace(re,"");
    }
    return html;
}

var gAutoPrint = true; // Flag for whether or not to automatically call the print function

function printFriendly(printFriendlyName1,printFriendlyName2)
{
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</HEAD>';
html += '\n<body>';


var printPageElem1 = document.getElementById(printFriendlyName1);
var printPageElem2 = document.getElementById(printFriendlyName2);

if (printPageElem1 != null || printPageElem2 != null)
{

html+= '<style>'+
    '.sIFR-flash {'+
    'display    : none !important;'+
    'height     : 0;'+
    'width      : 0;'+
    'position   : absolute;'+
    'overflow   : hidden;'+
  '}'+

  '.sIFR-alternate {'+
    'visibility : visible !important;'+
    'display    : block   !important;'+
    'position   : static  !important;'+
    'left       : auto    !important;'+
    'top        : auto    !important;'+
    'width      : auto    !important;'+
    'height     : auto    !important;'+
  '}'+
'</style>';
html += '<center>';

html += '<div id=\"wrapper\" >';
html += '<div id=\"banner\" style=\"border-bottom:1px solid #F1EFEC;\">';
html += '	<h1  style="display: block;float: right;font-size: 2em; left: -85px;margin: 0 -1px 0 0;padding: 0;position: absolute;">';
html += '		<a  href="#" >';
    html += '                <img src=\"/html/themes/Fonden Lo_skolen/images/Lo_skolen/logo.gif\" style=\"border:1px solid #F1EFEC;\"/>';
html += '		</a>';
html += '	</h1>';
html += '    <div id=\"logo2\">';
html += '            <a href=\"/web/guest/forside\">';
html += '                <img src=\"/html/themes/Fonden Lo_skolen/images/Lo_skolen/banner.gif\"/>';
html += '            </a>';
html += '        </div>';
html += '</div>';
html += '<div id=\"navigation\" style=\"min-height:2px;\">';
html += '</div>';
html += '<div id=\"content-wrapper\" style=\"width:865px;text-align:left;padding-bottom:1px;\">';
html += '   <table id=\"layout-grid\" class=\"lfr-grid\">';
html += '       <tbody>';
html += '           <tr>';
html += '               <td class=\"lfr-column seventy\" valign=\"top\" style=\"padding:19px\">';
    if (printPageElem1 != null)
    {
html +=                     printPageElem1.innerHTML;
    }
html += '               </td>';
html += '               <td class=\"lfr-column thirty\" valign=\"top\" style=\"padding:19px\">';
    if (printPageElem2 != null)
    {
html +=                     printPageElem2.innerHTML;
    }
html += '               </td>';
html += '           </tr>';
html += '       </tbody>';
html += '   </table>';
html += '</div>';
html += '   <div id=\"footer\" style=\"position:inherit;\">';
html += '       <div class=\"leftTxt\">Fonden Lo-skolen</div>';
html += '       <div class=\"rightTxt\">Gl. Helleb&aelig;kvej 70 | DK-3000 Helsing&oslash;r | Denmark | Tlf.: +45 4928';
html += '               0900 | Fax: +45 4921 6566 | <a href=\"mailto:info@loskolen.dk\"><span class=\"infoMail\">info@loskolen.dk</span></a>';
html += '       </div>';
html += '   </div>';
html += '</div>';

html += '</center>';

}
else
{
alert("Could not find the printReady section in the HTML");
return;
}

html += '\n</BODY>\n</HTML>';

      html = jsCleanup(html);

var printWin = window.open('','printFriendly','directories=no,height=640,location=no,menubar=yes,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=868');
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("Sorry, the printer friendly feature works\nonly in javascript enabled browsers.");
}
}

function sendToFriend(printFriendlyName1,printFriendlyName2)
{
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<script type=\"text/javascript\" LANGUAGE=\"JavaScript1.1\">';
html += '\n    function submission1() {';
html += '\n ';
html += '\n     if (document.getElementById(\'yourName\').value.replace(/^\\s+|\\s+$/g, \"\") == \'\') {';
html += '\n         alert(\'Indtast navn.\');';
html += '\n         return false;';
html += '\n     }\n ';
html += '\n     if (document.getElementById(\'senderAddress\').value.replace(/^\\s+|\\s+$/g, \"\") == \'\') {';
html += '\n         alert(\'Din email er ikke korrekt el. mangler\');';
html += '\n         return false;';
html += '\n     }\n ';
html += '\n     if (document.getElementById(\'friendName\').value.replace(/^\\s+|\\s+$/g, \"\") == \'\') {';
html += '\n         alert(\'Indtast modtagers navn.\');';
html += '\n         return false;';
html += '\n     }\n ';
html += '\n     if (document.getElementById(\'toAddress\').value.replace(/^\\s+|\\s+$/g, \"\") == \'\') {';
html += '\n         alert(\'Modtagers email er ikke korrekt el. mangler\');';
html += '\n         return false;';
html += '\n     }\n ';
html += '\n      return true;';
html += '\n    }';
html += '\n</script>';

html += '\n</HEAD>';
html += '\n<body>';


var printPageElem1 = document.getElementById(printFriendlyName1);
var printPageElem2 = document.getElementById(printFriendlyName2);

if (printPageElem1!= null ||printPageElem2!= null)
{

html += '<center>';

html += '<div id=\"wrapper\">';
html += '<div id=\"banner\">';
html += '	<h1 class=\"logo\">';
//html += '		<a class=\"png\" href=\"/web/guest/forside\">';
html += '		<a  href=\"/web/guest/forside\">';
html += '			FONDEN LO-SKOLEN';
html += '		</a>';
html += '	</h1>';
html += '</div>';
html += '<div id=\"navigation\" style=\"min-height:2px;\">';
html += '</div>';

    html += '<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"font-size:11px;\">';
    html += '		<form id=\"form1\" action=\"/c/ext/mailPage/SendMailToFriend\" name=\"friendsender\" method=\"post\" enctype=\"multipart/form-data\">';
    html += '			<input type=\"hidden\" name=\"subject\" value=\"Fonden Lo-skolen : Email fra en ven\">';
    var loc=String(this.location);
    html += '			<input type=\"hidden\" name=\"redirectURL\" id=\"redirectURL\" value='+loc+'>';
    html += '			<input type=\"hidden\" name=\"resultURL\" id=\"resultURL\" value=\"/html/portlet/mailPage/sendSuccess.jsp\">';
    html += '			<tr>';
    html += '				<td valign=\"top\">';
    html += '				    <font class=\"friendsender_head\"><b>Send til en ven</b></font><br>';
    html += '				    <br>';
    html += '				    <br>';
    html += '					<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size:11px;\">';

    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"><font class=\"friendsender_lead\">Dit navn :</font></td>';
    html += '							<td width=\"50%\" valign=\"top\"><input type=\"text\" id=\"yourName\" name=\"yourName\" alt=\"blank\" emsg=\"Indtast navn.\"></td>';
    html += '						</tr>';
    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"><font class=\"friendsender_lead\">Din e-mail :</font></td>';
    html += '							<td width=\"50%\" valign=\"top\"><input type=\"text\" id=\"senderAddress\" name=\"senderAddress\" alt=\"email\" emsg=\"Din email er ikke korrekt el. mangler\"></td>';
    html += '						</tr>';
    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"><font class=\"friendsender_lead\">Modtagers navn :</font></td>';
    html += '							<td width=\"50%\" valign=\"top\"><input type=\"text\" id=\"friendName\" name=\"friendName\" alt=\"blank\" emsg=\"Indtast modtagers navn.\"></td>';
    html += '						</tr>';
    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"><font class=\"friendsender_lead\">Modtagers e-mail :</font></td>';
    html += '							<td width=\"50%\" valign=\"top\"><input type=\"text\" name=\"toAddress\" id=\"toAddress\" alt=\"email\" emsg=\"Modtagers email er ikke korrekt el. mangler\"></td>';
    html += '						</tr>';
    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"><font class=\"friendsender_lead\">Evt. besked :</font></td>';
    html += '							<td width=\"50%\" valign=\"top\"><textarea name=\"messageInput\" cols=\"30\" rows=\"6\"></textarea></td>';
    html += '						</tr>';
    html += '						<tr>';
    html += '							<td width=\"50%\" valign=\"top\"></td>';
    html += '							<td width=\"50%\" valign=\"top\" style=\"padding-top:5px;padding-bottom:13px;\"><input type=\"image\" src=\"/html/themes/Fonden Lo_skolen/images/Lo_skolen/sendButton.gif\" value=\"submit\" onClick=\"return submission1();\"></td>';
    html += '						</tr>';
    html += '					</table>';


    html += '				</td>';
    html += '			</tr>';
    html += '		</form>';

    html += '		<tr>';
    html += '			<td align=\"left\" valign=\"top\">';
    html += '			    <font size=\"1\"><b>Sender link til f&oslash;lgende side :</b></font><br>';
    html += '           </td>';
    html += '       </tr>';
    html += '   </table>';

html += '<div id=\"content-wrapper\" style=\"background-color:#FFFFFF;text-align:left;margin-top:15px; padding:15px 0 1px 0; border-top:1px dotted #cccccc;\" >';
html += '   <table id=\"layout-grid\" class=\"lfr-grid\">';
html += '       <tbody>';
html += '           <tr>';
html += '               <td class=\"lfr-column seventy\" valign=\"top\" style=\"padding:19px\">';
    if (printPageElem1 != null)
    {
html +=                     printPageElem1.innerHTML;
    }
html += '               </td>';
html += '               <td class=\"lfr-column thirty\" valign=\"top\" style=\"padding:19px\">';
    if (printPageElem2 != null)
    {
html +=                     printPageElem2.innerHTML;
    }
html += '               </td>';
html += '           </tr>';
html += '       </tbody>';
html += '   </table>';
html += '</div>';


html += '   <div id=\"footer\" style=\"position:inherit;\">';
html += '       <div class=\"leftTxt\">Fonden Lo-skolen</div>';
html += '       <div class=\"rightTxt\">Gl. Helleb&aelig;kvej 70 | DK-3000 Helsing&oslash;r | Denmark | Tlf.: +45 4928';
html += '               0900 | Fax: +45 4921 6566 | <a href=\"mailto:info@loskolen.dk\"><span class=\"infoMail\">info@loskolen.dk</span></a>';
html += '       </div>';
html += '   </div>';
html += '</div>';
html += '</center>';

}
else
{
alert("Could not find the printReady section in the HTML");
return;
}

html += '\n</BODY>\n</HTML>';

var printWin = window.open('','printFriendly','directories=no,height=640,location=no,menubar=yes,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=950');
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
//if (gAutoPrint)
//printWin.print();
}
else
{
alert("Sorry, the printer friendly feature works\nonly in javascript enabled browsers.");
}
}
