<html>
<head>
<title>Health e-Learning</title>
<link rel="stylesheet" href="hexml.pack.css" type="text/css" />
<script type="text/javascript" src="hexml.pack.js"></script>
<style type="text/css">
	body {
		overflow: hidden;
	}
	#linkViewer {
		padding: 0;
		border-spacing: 0;
		width: 100%;
		border: 0;
	}

	#viewerHeader{


		height: 50px;
		width: 100%;
		border-bottom: 2px #000080 solid !important;
		background-color:#fff;
	}


</style>
</head>
<body>
	<table id="viewerHeader">
		<tr style="vertical-align: middle">
			<td style="width: 34%"><img src="banner_logo.gif" id="logo"/></td>
			<td style="text-align: center; width: 33%"><span id="returnLink">Click here to return to your course material.</span></td>
			<td style="text-align: right; width: 33%"><a href="#" id="brokenLink">Click here to report a broken link.</a></td>
		</tr>
	</table>

<iframe id="linkViewer" scrolling="auto"></iframe>
	<script type="text/javascript">
		var linkViewer = document.getElementById('linkViewer');
		var temp = window.location.search.substring(1).split("&");
		var params = {};
		for (var i=0; i<temp.length; i++) {
			var temp2 = temp[i].split('=');
			params[decodeURIComponent(temp2[0])] = decodeURIComponent(temp2[1]);
		}

		linkViewer.src = params.url;

		function resizeFrame() {
			linkViewer.style.height = jQuery(window).height() - 55;
		}

		resizeFrame();

		jQuery(window).resize(resizeFrame);

		jQuery('#brokenLink')
			.click(function() {
				jQuery(this)
					.html("Please wait...")
					.unbind('click')
					.click(function() {
						return false;
					})
				;

				jQuery.ajax({
					url : "http://www.health-e-learning.com/reportLink.php?jsoncallback=?",
					data : params,
					dataType : "jsonp",
					success: function(data, textStatus) {
								if(data.success == true) {
									showAlertBox("Thanks for letting us know. We will fix it as soon as possible.");
								}
								else {
									var subject = encodeURIComponent("Broken link in " + params.course + " (Topic " + params.topic + ")");
									var body = encodeURIComponent(params.course + " Topic " + params.topic + " (" + params.url + ")");
									var mailToURL = "mailto:freddy@health-e-learning.com?subject=" + subject + "&body=" + body;
									window.location = mailToURL;

								}
								jQuery("#brokenLink").html("Thank you!");
							}
				});
				return false;
			})
		;

		if (window.opener) {
			jQuery('#returnLink')
				.wrap('<a/>')
				.parent()
				.attr('href', '#')
				.click(function() {
					window.close();
					return false;
				})
			;
		} else {
			jQuery('#returnLink')
				.html("Close this window to return to your course material")
			;
		}
	</script>
</body>
</html>