
function flhide() {
	flashZoom.hide();
}

var flashZoom = {
	init : function(xmlURL, swfURL) {
		flashZoom.swfURL = swfURL;
		flashZoom.xmlURL = xmlURL;

		$().ready(function() { $('.zoomLink').click(flashZoom.show); });
	},

	hide : function() {

		document.getElementsByTagName("html")[0].style.overflow="auto";	
		document.onscroll=function(){}
		document.onmousewheel=function(){}

		$('#zoomFlash').hide();
		$('#flashbg').show();

		if (this.scrollPos) {
			window.scroll(this.scrollPos[1], this.scrollPos[0]);
		}

		return false;

	},

	show : function() {

		var info = this.id.split('-');
		var picId = parseInt(info[1]);

		var url = flashZoom.xmlURL.replace('_picId_', picId);

		if( typeof( window.pageYOffset ) == 'number' ) {
			flashZoom.scrollPos = [window.pageYOffset, window.pageXOffset];
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			flashZoom.scrollPos = [document.body.scrollTop, document.body.scrollLeft];
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			flashZoom.scrollPos = [document.documentElement.scrollTop, document.documentElement.scrollLeft];
		}

		scroll(0,0);

		document.onscroll=function(){scroll(0,0);}
		document.onmousewheel=function(){return false;}		
		document.body.onmousedown=function(){return false}

		var zoom = $('#zoomFlash');
		$(document.body).append(zoom);
		zoom.show();

		document.getElementsByTagName("html")[0].style.overflow="hidden";			
		document.getElementsByTagName("body")[0].scrolling="no";	

		var so = new SWFObject(flashZoom.swfURL, "gallery", "100%", "100%", "9");

		so.addVariable("linklist", url);	
		so.addParam("allowFullScreen", "true");
		so.addParam("scaleMode","noScale");
		so.write("zoomFlash");

		$('#flashbg').hide();

		return false;
	}
};

flashZoom.init(zoomURL, zoomSWF);

