// JavaScript Document
function DB_pxToNum (size) {return Number(String(size).substr(0,String(size).length-2));}

function DB_linkIframeSlider (iframeID,containerID,handleID,mode) {
	$(iframeID).addEvent('load', function (e) {
		if ($(containerID).slajder && $(containerID).slajder.$events && $(containerID).slajder.$events.onChange)
			delete $(containerID).slajder.$events.onChange;
		if ($(containerID).slajder && $(containerID).slajder.$events && $(containerID).slajder.$events.onTick)
			delete $(containerID).slajder.$events.onTick;
		windowFrame = $(iframeID).clientHeight;
		windowFull = $(iframeID).contentWindow.document.body.clientHeight;
		if (windowFull>windowFrame-20) {
			slideFull = DB_pxToNum($(containerID).style.height);
			$(handleID).style.height = ''+Math.floor((slideFull*(windowFrame-20))/windowFull)+'px';
			$(containerID).slajder = new Slider($(containerID), $(handleID), 
				{ 	steps: (windowFull-windowFrame+20), 
					mode: mode,
					onChange: function (pos) {$(iframeID).contentWindow.scroll(0,Math.floor(pos));}
				}).set(0);
			}
		else
			$(handleID).style.height = '0px';
		});
	}