/* CMS-based site/PFIZER UK
*  Author: Lucy Barker, DNA an AvenueA|Razorfish company
*  global.js
*/
document.write('<sty'+'le type="text/css">.jsshow {display:inline;}</style>');

var cleardefaulttext = function(el, str) {
	$(el).onfocus = function() {if ($(el).value == str) $(el).value = ''};
	$(el).onblur = function() {if ($(el).value == '') $(el).value = str};
}

/* mootool stylee based on pullquote function by Roger Johansson, http://www.456bereastreet.com/*/
var pullquote = function() {
	$S('span').each(function(e){
		if (e.hasClass('pullquote')) {
			var bQ = new Element('blockquote');
			bQ.addClass('pullquote');
			bQ.setHTML('<p>' + e.innerHTML + '</p>');
			bQ.injectBefore(e.parentNode);
			equalHeight();// readjust the left-col height
		}
	});
}

/* get gallery linked images to trigger the rollover state of related text link in heading below */
var getgallerylinks = function() {
	if ($('gallery') != false) { // for the benefit of IE
		$('gallery').getElements('div').each(function(e) {
			if (e.hasClass('rwitem')) {
				e.getElements('a').each(function(n) {
					n.addEvent('mouseover', function() {
						if (n.innerHTML.toLowerCase().test('<img') != null) n.getNext().childNodes[0].setStyle('text-decoration', 'underline');
					});
					n.addEvent('mouseout', function() {
						if (n.innerHTML.toLowerCase().test('<img') != null) n.getNext().childNodes[0].setStyle('text-decoration', 'none');
					});	
				});	
			}
		});
	}
}



var nwin = '';
function openpop(url, w, h) {
	if (!nwin.closed && nwin.location) {
		nwin.location.href = url;
	} else {
		nwin=window.open(url,'pop','status,height=' + (h + 26) + ',width=' + w );
		if (!nwin.opener) nwin.opener = self;
	}
	if (window.focus) nwin.focus();
	return false;
}



window.addEvent('domload', function() {
	pullquote();
	getgallerylinks();
	cleardefaulttext('search-txt', 'Search');
	cleardefaulttext('findpr', 'Search');	
	if ($('print') != false) $('print').setStyle('visibility', 'visible');
});




