
	
var siteroot = (typeof(fullsiteroot) == "function") && (typeof(sitehost) == "function") ? fullsiteroot().replace(sitehost(), "") : "/";
var Behaviour = {
	//param: Object sheet = {cssRule : callback}
	//	where cssRule is a string and callback is a function that passes a DOM element as its parameter and returns null, i.e. void callback(DOMElement element)
	register : function(sheet) {Behaviour.list.push(sheet);},
	//call apply after ajaxing stuff if you want behaviour rules to apply to ajaxed elements
	apply : function() {
		for (h = 0; sheet = Behaviour.list[h]; h++) {
			for (selector in sheet) {
				list = $$(selector);
				if (!list) continue;
				for (i = 0; element = list[i]; i++) sheet[selector](element);
			}
		}
	},
	//private
	list : new Array()
}


Event.observe(window,"load",function() {

	$('searchmenulink').observe('click', function(){
		$('searchbar').show();
		$('searchtext').focus();
	})
	
	if ($('flashbanner')){
		if (swfobject.hasFlashPlayerVersion("8.0.0")) {
			var params = {wmode: "transparent"}
			var swffile = siteroot + "local/flash/banner_770x386_v2.swf";
			swfobject.embedSWF(swffile, "flashbanner", "770", "386", "8.0.0","","",params);
		}
		else {
			var getflash = confirm ("Your browser currently does not support Flash Player 8.0, Click on OK if you wish to navigate away from this site and install this plug-in or click on Cancel if you wish to proceed without the plug-in. By clicking on Cancel the site may not function correctly.");
			if (getflash){ window.open('http://www.adobe.com/products/flashplayer/');}
		}
	}

	Behaviour.register({
		//CSS hover script for elements that don't accept css hover class in IE6
		"li" : function(element) {
			var timeout;
			Event.observe(element, "mouseover", function() {
				clearTimeout(timeout);
				Element.addClassName(element, "over");
			});
			Event.observe(element, "mouseout", function() {
				timeout = setTimeout(function() {Element.removeClassName(element, "over");}, 10);

			});
		}
	});
	Behaviour.apply();

});

var prevention = function() {
	location.href= siteroot + 'bridgepoint_solution/prevention/';
};

var research = function() {
	location.href= siteroot + 'bridgepoint_solution/research/';
};

var complex = function() {
	location.href= siteroot + 'complex_chronic/';
};

var impact = function() {
	location.href= siteroot + 'complex_chronic/impact_on_healthcare/';
};

var facility = function() {
	location.href= siteroot + 'bridgepoint_solution/facility/';
};

var smallText = function() {
	var maincontent = $$('.maincontent');
	removeSizeClasses(maincontent[0]);
	maincontent[0].addClassName('smalltext');
	var rightbar = $$('.calloutmenu');
	if (rightbar.length > 0) {
		removeSizeClasses(rightbar[0]);
		rightbar[0].addClassName('smalltext');
	}
}

var mediumText = function() {
	var maincontent = $$('.maincontent');
	removeSizeClasses(maincontent[0]);
	maincontent[0].addClassName('mediumtext');
	var rightbar = $$('.calloutmenu');
	if (rightbar.length > 0) {
		removeSizeClasses(rightbar[0]);
		rightbar[0].addClassName('mediumtext');
	}
}

var largeText = function() {
	var maincontent = $$('.maincontent');
	removeSizeClasses(maincontent[0]);
	maincontent[0].addClassName('largetext');
	//text[0].style.fontSize = '140%';
	var rightbar = $$('.calloutmenu');
	if (rightbar.length > 0) {
		removeSizeClasses(rightbar[0]);
		rightbar[0].addClassName('largetext');
	}
}

var removeSizeClasses = function(textElement) {
	textElement.removeClassName('smalltext');
	textElement.removeClassName('mediumtext');
	textElement.removeClassName('largetext');
}

