

//To protect e-mails from harvesters and spam, actual e-mail addresses are written out on page load by javascript
// <span class="mailer">info</span> -> <span class="mailer"><a href="mailto:info@bellus.com">info@bellus.com</a></span>
$(document).observe('dom:loaded',function(){
	$$('[class~=mailer]').each(function(s){
		$(s).replace('<a href="mailto:'+s.innerHTML+'@bellus.com">'+s.innerHTML+'@bellus.com</a>');	
	});
		
});


printFlash = function(obj, url, width, height, image, target){
	$(document).observe('dom:loaded',function(){
		var text = showFlash(url, target, width, height);
		if(!text && image){
			text = '<img src="'+image+'" alt="" width="'+width+'" height="'+height+'" />';
			if(target)
				text = '<a href="'+target+'">'+text+'</a>';
		}
		if(!text)
			text = "Your browser doesn't support Flash!";
		$(obj).update(text);	});
}


showFlash = function(fileName, clicktag, width, height){
	if(!width)width = '100%';
	if(!height)height = '100%';
	if(!clicktag)clicktag='/';
	clicktarget='_blank';
	wmode='opaque';
	scale=false;
	if(detectFlash()){	
		var text = '';
		text += '<object codebase="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" '+(scale?'scale="noscale" salign="lt"':'')+'>';
		text += '<param name="movie" value="'+fileName+'" />';
		text += '<param name="quality" value="high" />';
		text += '<param name="play" value="true" />';
		text += '<param name="loop" value="true" />';
		text += '<param name="flashvars" value="clickTARGET='+clicktarget+'&amp;clickTAG='+clicktag+'" />';
		if(scale){
			text += '<param name="scale" value="noscale" />';
			text += '<param name="salign" value="lt" />';
		}
		text += '<param name="wmode" value="'+wmode+'" />';
		text += '<param name="allowScriptAccess" value="always" />';
		text += '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high"  width="'+width+'" height="'+height+'" '+(scale?'scale="noscale" salign="lt"':'')+' src="'+fileName+'" wmode="'+wmode+'" flashvars="clickTARGET='+clicktarget+'&clickTAG='+clicktag+'" play="true" loop="true" allowScriptAccess="always"></embed></object>';
   		return text;
	}else return false;
}

detectFlash = function(){
	var flash_versions = 20;
	if (navigator.plugins && navigator.plugins.length) {
		for (x=0; x < navigator.plugins.length; x++) {
			if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
				return true;
				break;
			}
		}
	}
	else if (window.ActiveXObject) {
		for (x = 2; x <= flash_versions; x++) {
			try {
				oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
				if(oFlash) {
					return true;
				}
			}
			catch(e) {}
		}
	}
	return false;
}