function CallPrint(sDivId) { 	 
	 var prtContent = document.getElementById(sDivId);
	 var WinPrint = window.open('','','letf=0,top=0,width=1024,height=768,toolbar=1,scrollbars=1,status=0'); 	 
	 WinPrint.document.write(CleanHtml(prtContent.innerHTML));
	 WinPrint.focus(); 
	 // Hack to get scriptet flash files to play/display corrcetly.
	 WinPrint.location.reload(true);	 
}

function CleanHtml (sHtml) {

	// Visualize all hidden content
	sHtml = sHtml.replace(/display: none/gi, "display: block");

	// Inactive all js
	sHtml = sHtml.replace(/animatedcollapse/gi, "//animatedcollapse");

	// inactive all flash calls
	sHtml = sHtml.replace(/UFO.create/gi, "//UFO.create");

	// Make all tabs inactive
	sHtml = sHtml.replace(/cpTabActive/gi, "cpTabInActive");

	// Make all tabs <p>
	sHtml = sHtml.replace(/margin-bottom: 0px;/gi, "");		

	// Rename and hide the slide divider div
	sHtml = sHtml.replace(/qadivider/gi, "hideqadivider");
	// Rename adn hide the slideupdown
	sHtml = sHtml.replace(/slideupdown/gi, "hideslideupdown");
	// Rename adn hide the rolllink
	sHtml = sHtml.replace(/rolllink/gi, "hiderolllink");
	// Rename adn hide the rollimg
	sHtml = sHtml.replace(/rollimg/gi, "hiderollimg");
	
	// Delete the divs containing the horizontal tab
	var sStart = sHtml.indexOf("<!-- TABS div START -->");
	var sEnd = sHtml.indexOf("<!-- TABS div END -->");	
	var sTabDiv = sHtml.substring(sStart, sEnd);
	sHtml = sHtml.replace(/tabswrapper/gi, "hidetabswrapper");
	sHtml = sHtml.replace(sTabDiv, "");

	return ( HtmlHeader() + sHtml + HtmlEnd() );
}

function HtmlHeader () {
	var sHtml;
	sHtml = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + "\n";
	sHtml += "  <head>" + "\n";
	sHtml += "    <title>Life-changing careers</title>" + "\n";
	sHtml += "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />" + "\n";
	sHtml += "    <meta http-equiv=\"PRAGMA\" content=\"NO-CACHE\" />" + "\n";
	sHtml += "    <link href=\"/ui/css/careerprint.css\" rel=\"stylesheet\" type=\"text/css\" />" + "\n";	
	
	sHtml += "    <script type=\"text/javascript\" src=\"/ui/js/ufo.js\"></script>" + "\n\n";
	sHtml += "    <script type=\"text/javascript\">" + "\n";	
	sHtml += "      function PrintPage() {" + "\n";
	sHtml += "         document.getElementById('content').removeChild(document.getElementById('content').children[0]);" + "\n";
	sHtml += "         window.print();" + "\n";
	sHtml += "         window.close();" + "\n";
	sHtml += "        }" + "\n\n";
	sHtml += "    </script>" + "\n\n";

	sHtml += "  </head>" + "\n";
	sHtml += "<body id=\"subpage\" onload=\"PrintPage()\">" + "\n\n";
	sHtml += "    <div id=\"wrapper\" style=\"background: none;\">" + "\n";
	sHtml += "        <div id=\"header\" style=\"background: none;\">" + "\n";	
	sHtml += "            <a href=\"/default.asp\"><img src=\"/ui/images/apis.png\" class=\"apis\" /></a>" + "\n";
	sHtml += "        </div>" + "\n\n";	
	sHtml += "        <div id=\"mainarea\" style=\"background: none;\">" + "\n";
	sHtml += "          <div id=\"content\" class=\"tabpage\">" + "\n";

	return (sHtml);
}

function HtmlEnd () {

	var sHtml;

	sHtml = "        </div>" + "<!-- close content/tabpage -->" + "\n\n";
	sHtml = "        </div>" + "<!-- close mainarea -->" + "\n\n";
	
	/*sHtml += "        <div id=\"footer\" class=\"printfooter\" style=\"background: url(/ui/images/footerWideCareer_bg.gif) no-repeat; height: 70px; margin-top: 15px; width: 970px;\">" + "\n";
	sHtml += "          <ul style=\"margin-top: -20px;\">" + "\n";
	sHtml += "          <li id=\"usflag\"><a href=\"/redirect/usa.htm\" target=\"_blank\">Novo Nordisk in the USA</a></li>" + "\n";
	sHtml += "          <li id=\"dkflag\"><a href=\"/redirect/denmark.htm\" target=\"_blank\">Novo Nordisk in Denmark</a></li>" + "\n";
	sHtml += "          <li id=\"globeicon\"><a href=\"/redirect/globaloffices.htm\">Novo Nordisk around the world</a></li>" + "\n";
	sHtml += "          <li id=\"copyright\"><a href=\"javascript:NewWindow('/utils/copyright.asp', 'a517201042110PM', '335', '500')\">&copy; Novo Nordisk A/S 2009</a></li>" + "\n";
	sHtml += "          </ul>" + "\n";
	sHtml += "        </div>" + "\n";*/
	sHtml += "    </div>" + "<!-- close wrapper -->" + "\n";

	sHtml += "</body>" + "\n";
	sHtml += "</html>";

	return (sHtml);
}

                        
