<!--

function leavesite() {
    if (confirm("Please Note: You are about to temporarily leave the Imaging.BayerHealthcare.com Web site by opening a new Web page. The site you are linking to, and any other site after visiting this site, is not controlled or endorsed by Bayer HealthCare Pharmaceuticals, and we are not responsible for the content presented on that site.")) {
		return true;
    }
    return false;
}

function safety(url)
{
	window.opener.location=url;
	return false;
}

/*
 * Qi Code Begins -- We are hijacking the original leavesite function to inject the survey.
 */

function Cookie(name, value, days) {
	if (this instanceof Cookie) {
		if (name && value) {
			this.bake(name, value, days);
		}
	} else {
		return new Cookie(name, value, days);
	}
}
Cookie.prototype = {

	bake: function(name, value, days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
			var expires = "; expires=" + date.toGMTString();
		}
		else {
			var expires = "";
		}
		document.cookie = name+"="+value+expires+"; path=/";
	},
	eat: function(name) {
		this.bake(name,"",-1);
	},
	pick: function(name) {
		var nameEQ = name + "=";
		var cookies = document.cookie.split(/\;\s+/) || null;
		if (cookies != null) {
			for (var i = 0, len = cookies.length; i < len; ++i) {
				if (cookies[i].indexOf(name) == 0) {
					var brokenCookies = cookies[i].split('=');
					var crumbs = {
						name: brokenCookies[0],
						value: brokenCookies[1]
					}
					return crumbs;
				}
			}
		}
		return null;
	}
};
/*

THIS CODE IS USED FOR THE SURVEY...IT IS CURRENTLY DISABLED

var leavesite_check;
function leavesite(href) {
    if (confirm("Please Note: You are about to temporarily leave the Imaging.BayerHealthcare.com Web site by opening a new Web page. The site you are linking to, and any other site after visiting this site, is not controlled or endorsed by Bayer HealthCare Pharmaceuticals, and we are not responsible for the content presented on that site.")) {
		var cookie = new Cookie();
		var results = cookie.pick('takenQuiz');	
		var newWindow2 = window.open(href, 'OutsideLink');
		if (results == null) {
			var newWindow1 = window.open('/html/survey/survey.do', 'Survey', 'height=525,width=780,scrollbars=yes, resizable=yes');
			if (window.focus) {
				newWindow1.focus();
			}
		}
		leavesite_check = 1; 
		return false;
    }
    return false;
}

window.onload = function() {
	leavesite_check = 1;
	var cookie = new Cookie();
	var results = cookie.pick('takenQuiz');
	
	if (results == null) {
		var anchors = document.getElementsByTagName('a')
		var goodAnchors = new Array, j = 0;
		for (var i = 0, len = anchors.length; i < len; ++i) {
			var test = anchors[i].getAttribute('onclick') || null;
			if (test == null) {
				goodAnchors[j] = anchors[i];
				j++;
			}
		}
		for (var k = 0, len2 = goodAnchors.length; k < len2; ++k) {
			goodAnchors[k].onclick = function(){
				leavesite_check = 2;
			}
		}
	}
}

window.onunload = function() {
	var cookie = new Cookie();
	var results = cookie.pick('takenQuiz');
	if (results == null) {
	
		if (leavesite_check == 0) {
			var newWindow1 = window.open('/html/survey/survey.do', 'Survey', 'height=525,width=780,scrollbars=yes, resizable=yes');
		}
	}
}
*/

/*
 * Qi Code Ends
 */
//-->
