// view page source (no word wrap)
(function () {
	var srcWin = window.open('about:blank'),
		newDoc = srcWin.document,
		html = '<html><head><title>Source of: %l</title><script>if (navigator.userAgent.indexOf(\'iPhone\') != -1) { window.onload = function () { setTimeout(function () { window.scrollTo(0, 1); }, 100); }; }</script><base href="%l"/></head><body><pre>%s</pre></body></html>',
		src = document.documentElement.innerHTML.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/(href|src)=('|")(.*?)(\2)/g, function (s, attr, q, url) { return attr + '=' + q + '<a href="' + url + '">' + url + '</a>' + q; });

	newDoc.open();
	newDoc.write(html.replace(/%l/g, location.href).replace(/%s/g, src));
	newDoc.close();
})()

// view page source (with word wrap)
(function () {
	var srcWin = window.open('about:blank'),
		newDoc = srcWin.document,
		html = '<html><head><title>Source of: %l</title><script>if (navigator.userAgent.indexOf(\'iPhone\') != -1) { window.onload = function () { setTimeout(function () { window.scrollTo(0, 1); }, 100); }; }</script><base href="%l"/></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%s</pre></body></html>',
		src = document.documentElement.innerHTML.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/(href|src)=('|")(.*?)(\2)/g, function (s, attr, q, url) { return attr + '=' + q + '<a href="' + url + '">' + url + '</a>' + q; });

	newDoc.open();
	newDoc.write(html.replace(/%l/g, location.href).replace(/%s/g, src));
	newDoc.close();
})()
