//---------------- MISC

dt.flyouts();

function global() {

}

try {
	
	var pdialog = new YAHOO.widget.Panel("wait", {	width:"350px",
													fixedcenter:true,
													close:true,
													draggable:true,
													modal:true,
													visible:false });
													
	YAHOO.util.Event.addListener(window, "load", function(){
		pdialog.setHeader("Printing - Please wait...");
		pdialog.setBody("<a href=\"javascript:pdialog.hide()\">Click here</a> to close this message after you have finished printing");
		pdialog.render(document.body);
	});

}catch(e){}

function printPage() {

	try {
		var f_iframe, html = document.getElementById("servier_printarea").innerHTML;
		
		pdialog.show();

		try {
			document.getElementById("print_iframe").removeNode(true);
		}catch(e){}
		
		/*---- PARSE OUT UNWANTED PRINT ELEMENTS */
		html = "<img src=../images/print_header.jpg><br><br>" + html;
		html += "<br><br>&copy; 2006 Servier Laboratories Australia, an incorporated company of SERVIER All Rights Reserved";
		/*---- PARSE OUT UNWANTED PRINT ELEMENTS */
	
		print_iframe_fn = function() {
			try {
				
				try {
					print_iframe.document.createStyleSheet("../_css/universal.css");
					print_iframe.document.body.insertAdjacentHTML("afterBegin", html);
					print_iframe.focus();
					print_iframe.print();
				}catch(e) {
					var iframe_el = document.getElementById("print_iframe");
					iframe_el.contentWindow.document.write(html);
					iframe_el.contentWindow.focus();
					iframe_el.contentWindow.print();
				}
				
			}catch(e){ alert('catch');window.print() }
		}
	
		document.body.insertAdjacentHTML("beforeEnd", "<iframe id=print_iframe name=print_iframe onload=print_iframe_fn() frameborder=\"0\" height=\"0\" marginheight=\"0\" marginwidth=\"0\" width=\"0\" height=\"0\"></iframe>");
		

	} catch(e) { window.print() }
	
}

//---------------- //

// Attach onload events to modify all hyperlinks

dt.attachEvent(window,"onload", initHyperlinks);

function initHyperlinks() {
	var links = document.getElementsByTagName('a');
	for (var i = 0; i < links.length; i++) {
		if (!links[i].href.match(/servier\.com\.au/) && !links[i].href.match(/mailto:/) && !links[i].href.match(/secure\.healthlinks\.net\.au/) && !links[i].id.match(/submit_btn/) && !links[i].id.match(/reset_btn/) ) {
			links[i].onclick = confirmLeave;
		}
	}
}

function confirmLeave() {
	return confirm("You are about to leave www.servier.com.au. This link is provided for information purposes only. You should be aware that Servier Laboratories Australia pty ltd is not responsible for this external web site. Do you wish to proceed?");
}
