
var containers = new Array();
var flexPaperIncrement = 0;

if(window.addEventListener)
window.addEventListener('DOMMouseScroll', handleWheel, false);
window.onmousewheel = document.onmousewheel = handleWheel;

if(window.attachEvent) 
window.attachEvent("onmousewheel", handleWheel);

function handleWheel(event){
	for (c in containers) {
		try{
			if(!window.document.getElementById(containers[c]).hasFocus()){continue;}
			window.document.getElementById(containers[c]).setViewerFocus(true);
			window.document.getElementById(containers[c]).focus();
			
			if(navigator.appName == "Netscape"){
				if (event.detail)
					delta = 0;
				if (event.preventDefault){
					event.preventDefault();
					event.returnValue = false;
				}
			}
		}catch(err){continue;}
	}
}

function flexPaperSetup(filename, container, width, height, swfpath) {
	if (typeof(width) == 'undefined' || width <= 0) {
		width = "600";
	}
	if (typeof(height) == 'undefined' || height <= 0) {
		height = "500";
	}
	if (typeof(swfpath) == 'undefined') {
		swfpath = "";
	}
	
	containers[flexPaperIncrement] = container;
	flexPaperIncrement++;
	
	<!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. --> 
	var swfVersionStr = "9.0.124";
	<!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
	var xiSwfUrlStr = "${expressInstallSwf}";
	var flashvars = { 
		'SwfFile' : escape(filename),
		'Scale' : 0.6, 
		'ZoomTransition' : "easeOut",
		'ZoomTime' : 0.5,
		'ZoomInterval' : 0.1,
		'FitPageOnLoad' : false,
		'FitWidthOnLoad' : true,
		'PrintEnabled' : true,
		'FullScreenAsMaxWindow' : true,
		'ProgressiveLoading' : true,
		'localeChain' : "en_US"
		};
	var params = {
		'quality' : "high",
		'bgcolor' : "#ffffff",
		'allowscriptaccess' : "sameDomain",
		'allowfullscreen' : "true"
		}
	var attributes = {
		'id' : container,
		'name' : container,
		'class' : "flexpaper_object"
		};
	swfobject.embedSWF(
		swfpath + "FlexPaperViewer.swf",
		container, 
		width,
		height, 
		swfVersionStr,
		xiSwfUrlStr, 
		flashvars,
		params,
		attributes
		);
	swfobject.createCSS("#"+container, "display:block;text-align:left;margin:10px 0px;");
}
