hs.dim = function(exp) {
	function fix(prop) {
		return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
			' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
	}

	if (!hs.dimmer) {
    	var sel = '.highslide-dimming',
			dec = (hs.ieLt7 || (hs.ie && document.compatMode == 'BackCompat')) ?
				'position: absolute; '+
				'left:'+ fix('scrollLeft') +
				'top:'+ fix('scrollTop') +
				'width:'+ fix('clientWidth') +
				'height:'+ fix('clientHeight') :
				'position: fixed; width: 100%; height: 100%; left: 0; top: 0';


		var style = hs.createElement('style', { type: 'text/css' }, null,
				document.getElementsByTagName('HEAD')[0]);
		if (!hs.ie) {
			style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
		} else {
			var last = document.styleSheets[document.styleSheets.length - 1];
			if (typeof(last.addRule) == "object") last.addRule(sel, dec);
		}

		hs.dimmer = hs.createElement ('div',
			{
				className: 'highslide-dimming',
				owner: '',
				onclick: function() {
					/**/
						hs.close();
				}
			}, {
                visibility: 'visible',
				opacity: 0
			}, hs.container, true);
	}

	hs.dimmer.style.display = '';

	hs.dimmer.owner += '|'+ exp.key;
	if (hs.geckoMac && hs.dimmingGeckoFix)
		hs.setStyles(hs.dimmer, {
			background: 'url('+ hs.graphicsDir + 'geckodimmer.png)',
			opacity: 1
		});
	else
		hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration);
}

hs.undim = function(key) {
	if (!hs.dimmer) return;
	if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, '');

	if (
		(typeof key != 'undefined' && hs.dimmer.owner != '')
		|| (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
	) return;

	if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none';
	else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() {
		hs.dimmer.style.display = 'none';
	});
}
hs.setDimmerSize = function() {};

