/*
 * Smoothbox by Boris Popoff (http://gueschla.com)
 *
 * Based on Cody Lindley's Thickbox, MIT License
 *
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// on page load call TB_init
window.addEvent('domready', TB_init);

// prevent javascript error before the content has loaded
TB_WIDTH = 0;
TB_HEIGHT = 0;
var TB_doneOnce = 0 ;

// add smoothbox to href elements that have a class of .smoothbox
function TB_init(){
	$$("a.smoothbox").each(function(el){el.onclick=TB_bind});
}

function TB_bind(event) {
	var event = new Event(event);
	// stop default behaviour
	event.preventDefault();
	// remove click border
	this.blur();
	// get caption: either title or name attribute
	var caption = this.title || this.name || "";
	// get rel attribute for image groups
	var group = this.rel || false;
	// display the box for the elements href
	TB_show(caption, this.href, group);
	this.onclick=TB_bind;
	return false;
}


// called when the user clicks on a smoothbox link
function TB_show(caption, url, rel) {

	// create iframe, overlay and box if non-existent

	if ( !$("TB_overlay") )
	{
		new Element('iframe').setProperty('id', 'TB_HideSelect').injectInside(document.body);
		new Element('div').setProperty('id', 'TB_overlay').injectInside(document.body);
		TB_overlaySize();
		new Element('div').setProperty('id', 'TB_load').injectInside(document.body);
		$('TB_load').innerHTML = "<img src='images/loading.gif' />";
		TB_load_position();
		new Fx.Style('TB_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut}).start(0,0.6);
	}
	
	if ( !$("TB_load") )
	{		
		new Element('div').setProperty('id', 'TB_load').injectInside(document.body);
		$('TB_load').innerHTML = "<img src='images/loading.gif' />";
		TB_load_position();
	}
	
	if ( !$("TB_window") )
	{
		new Element('div').setProperty('id', 'TB_window').injectInside(document.body);
	}
	
	$("TB_overlay").onclick=TB_remove;
	window.onscroll=TB_positionEffect;

	// check if a query string is involved
	var baseURL = url.match(/(.+)?/)[1] || url;

	// regex to check if a href refers to an image
	var imageURL = /\.(jpe?g|png|gif|bmp)/gi;

	// check for images
	if ( baseURL.match(imageURL) ) {
		var dummy = { caption: "", url: "", html: "" };
		
		var prev = dummy,
			next = dummy,
			imageCount = "";
			
		// if an image group is given
		if ( rel ) {
			function getInfo(image, id, label) {
				return {
					caption: image.title,
					url: image.href,
					html: "<span id='TB_" + id + "'>&nbsp;&nbsp;<a href='#'>" + label + "</a></span>"
				}
			}
		
			// find the anchors that point to the group
			var imageGroup = [] ;
			$$("a.smoothbox").each(function(el){
				if (el.rel==rel) {imageGroup[imageGroup.length] = el ;}
			})

			var foundSelf = false;
			
			// loop through the anchors, looking for ourself, saving information about previous and next image
			for (var i = 0; i < imageGroup.length; i++) {
				var image = imageGroup[i];
				var urlTypeTemp = image.href.match(imageURL);
				
				// look for ourself
				if ( image.href == url ) {
					foundSelf = true;
					imageCount = (i + 1) + " / "+ (imageGroup.length);
				} else {
					// when we found ourself, the current is the next image
					if ( foundSelf ) {
						next = getInfo(image, "next", "weiter &gt;");
						// stop searching
						break;
					} else {
						// didn't find ourself yet, so this may be the one before ourself
						prev = getInfo(image, "prev", "&lt; zurück");
					}
				}
			}
		}
		
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			imgPreloader.onload = null;

			// Resizing large images
			var x = window.getWidth() - 150;
			var y = window.getHeight() - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			// TODO don't use globals
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			
			// TODO empty window content instead
			$("TB_window").innerHTML += "<a href='"+url+"' id='TB_ImageOff' title='schliessen/close' class='MagicZoom' rel='zoom-height: 450px'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='schliessen/close'>schliessen</a></div>";
			
			$("TB_closeWindowButton").onclick = TB_remove;
			
			function buildClickHandler(image) {
				return function() {
					$("TB_window").remove();
					new Element('div').setProperty('id', 'TB_window').injectInside(document.body);
					
					TB_show(image.caption, image.url, rel);
					return false;
				};
			}
			var goPrev = buildClickHandler(prev);
			var goNext = buildClickHandler(next);
			if ( $('TB_prev') ) {
				$("TB_prev").onclick = goPrev;
			}
			
			if ( $('TB_next') ) {		
				$("TB_next").onclick = goNext;
			}
			
			document.onkeydown = function(event) {
				var event = new Event(event);
				switch(event.code) {
				case 27:
					TB_remove();
					break;
				case 190:
					if( $('TB_next') ) {
						document.onkeydown = null;
						goNext();
					}
					break;
				case 188:
					if( $('TB_prev') ) {
						document.onkeydown = null;
						goPrev();
					}
					break;
				}
			}
			
			// TODO don't remove loader etc., just hide and show later
			$("TB_ImageOff").onclick = TB_remove;
			TB_position();
			TB_showWindow();
		}
		imgPreloader.src = url;
		
	} else { //code to show html pages
		
		var queryString = url.match(/\?(.+)/)[1];
		var params = TB_parseQuery( queryString );
		
		TB_WIDTH = (params['width']*1) + 30;
		TB_HEIGHT = (params['height']*1) + 40;

		var ajaxContentW = TB_WIDTH - 30,
			ajaxContentH = TB_HEIGHT - 45;
		
		if(url.indexOf('TB_iframe') != -1){				
			urlNoQuery = url.split('TB_');		
			//urlNoQuery = url;
			$("TB_window").innerHTML += "<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>schliessen</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showWindow()'> </iframe>";
		} else {
			$("TB_window").innerHTML += "<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>schliessen</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>";
		}
				
		$("TB_closeWindowButton").onclick = TB_remove;
		
			if(url.indexOf('TB_inline') != -1){	
				$("TB_ajaxContent").innerHTML = ($(params['inlineId']).innerHTML);
				TB_position();
				TB_showWindow();
			}else if(url.indexOf('TB_iframe') != -1){
				TB_position();
				if(frames['TB_iframeContent'] == undefined){//be nice to safari
					$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
					TB_showWindow();
				}
			}else{
				var handlerFunc = function(){
					TB_position();
					TB_showWindow();
				};
				var myRequest = new Ajax(url, {method: 'get',update: $("TB_ajaxContent"),onComplete: handlerFunc}).request();
			}
	}

	window.onresize=function(){ TB_position(); TB_load_position(); TB_overlaySize();}  
	
	document.onkeyup = function(event){ 	
		var event = new Event(event);
		if(event.code == 27){ // close
			TB_remove();
		}	
	}
		
}

//helper functions below

function TB_showWindow(){
	//$("TB_load").remove();
	//$("TB_window").setStyles({display:"block",opacity:'0'});
	
	if (TB_doneOnce==0) {
		TB_doneOnce = 1;
		var myFX = new Fx.Style('TB_window', 'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(){if ($('TB_load')) { $('TB_load').remove();}} }).start(0,1);
	} else {
		$('TB_window').setStyle('opacity',1);
		if ($('TB_load')) { $('TB_load').remove();}
	}
}

function TB_remove() {
 	$("TB_overlay").onclick=null;
	document.onkeyup=null;
	document.onkeydown=null;
	
	if ($('TB_imageOff')) $("TB_imageOff").onclick=null;
	if ($('TB_closeWindowButton')) $("TB_closeWindowButton").onclick=null;
	if ( $('TB_prev') ) { $("TB_prev").onclick = null; }
	if ( $('TB_next') ) { $("TB_next").onclick = null; }

	new Fx.Style('TB_window', 'opacity',{duration: 250, transition: Fx.Transitions.sineInOut, onComplete:function(){$('TB_window').remove();} }).start(1,0);
	new Fx.Style('TB_overlay', 'opacity',{duration: 400, transition: Fx.Transitions.sineInOut, onComplete:function(){$('TB_overlay').remove();} }).start(0.6,0);

	window.onscroll=null;
	window.onresize=null;	
	
	$('TB_HideSelect').remove();
	TB_init();
	TB_doneOnce = 0;
	return false;
}

function TB_position() {
	$("TB_window").setStyles({width: TB_WIDTH+'px', 
				 left: (window.getScrollLeft() + (window.getWidth() - TB_WIDTH)/2)+'px',
				 top: (window.getScrollTop() + (window.getHeight() - TB_HEIGHT)/2)+'px'});
}

function TB_positionEffect() {
	new Fx.Styles('TB_window', {duration: 75, transition: Fx.Transitions.sineInOut}).start({
		'left':(window.getScrollLeft() + (window.getWidth() - TB_WIDTH)/2)+'px',
		'top':(window.getScrollTop() + (window.getHeight() - TB_HEIGHT)/2)+'px'});
}

function TB_overlaySize(){
	// we have to set this to 0px before so we can reduce the size / width of the overflow onresize 
	$("TB_overlay").setStyles({"height": '0px', "width": '0px'});
	$("TB_HideSelect").setStyles({"height": '0px', "width": '0px'});
	$("TB_overlay").setStyles({"height": window.getScrollHeight()+'px', "width": window.getScrollWidth()+'px'});
	$("TB_HideSelect").setStyles({"height": window.getScrollHeight()+'px',"width": window.getScrollWidth()+'px'});
}

function TB_load_position() {
	if ($("TB_load")) { $("TB_load").setStyles({left: (window.getScrollLeft() + (window.getWidth() - 56)/2)+'px', top: (window.getScrollTop() + ((window.getHeight()-20)/2))+'px',display:"block"}); }
}

function TB_parseQuery ( query ) {	
	// return empty object
	/*var params = {};
	params[keepThis]  = true;
	params[TB_iframe] = true;
	params[height] = 300;
	params[width] = 500;
	
	return params;*/
	
	if( !query )
		return {};
	var params = {};
	
	// parse query
	var pairs = query.split(/[;&]/);
	for ( var i = 0; i < pairs.length; i++ ) {
		var pair = pairs[i].split('=');
		if ( !pair || pair.length != 2 )
			continue;
		// unescape both key and value, replace "+" with spaces in value
		params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
   }
   return params;
}

/* Copyright 2008 MagicToolBox.com. To use this code on your own site, visit http://magictoolbox.com */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7 g=\'E\';7 W=3Z.42.1F();6(W.2t("1v")!=-1){g=\'1v\'}u 6(W.2t("E")!=-1){g=\'E\'}u 6(W.2t("1D")!=-1){g=\'1D\'}u 6(W.2t("45")!=-1){g=\'2g\'}7 1z=1m 44();k 1o(C){m 8.3S(C)};k q(2k,2V){6(2k.3L){7 y=2k.3L[2V];y=a(y)?y:\'G\'}u 6(11.3F){7 2X=8.4j.3F(2k,1X);7 y=2X?2X[2V]:1X}m y};k 2o(e){6(e.3A){7 r=e.3A();7 2a=0;7 2d=0;6(8.16&&(8.16.1s||8.16.1u)){2d=8.16.1u;2a=8.16.1s}u 6(8.1c&&(8.1c.1s||8.1c.1u)){2d=8.1c.1u;2a=8.1c.1s}m{\'o\':r.o+2a,\'D\':r.D+2d,\'2n\':r.2n+2a,\'1W\':r.1W+2d}}}k 2T(e){7 x=0;7 y=0;6(g==\'E\'){y=e.2y;x=e.2w;6(8.16&&(8.16.1s||8.16.1u)){y=e.2y+8.16.1u;x=e.2w+8.16.1s}u 6(8.1c&&(8.1c.1s||8.1c.1u)){y=e.2y+8.1c.1u;x=e.2w+8.1c.1s}}u{y=e.2y;x=e.2w;y+=11.4f;x+=11.4k}m{\'x\':x,\'y\':y}}k 2O(){m H};7 31=k(){7 1f=1R;6(!1f[1])1f=[4,1f[0]];1j(7 2G 3X 1f[1])1f[0][2G]=1f[1][2G];m 1f[0]};k 1h(1Y,Y,1H){6(g==\'2g\'||g==\'1v\'||g==\'1D\'){3D{1Y.4g(Y,1H,H)}3B(e){41("K 40: "+e+", Y="+Y)}}u 6(g==\'E\'){1Y.43("2P"+Y,1H)}};k 3w(1Y,Y,1H){6(g==\'2g\'||g==\'1v\'||g==\'1D\'){1Y.3W(Y,1H,H)}u 6(g==\'E\'){1Y.4m("2P"+Y,1H)}};k 38(){7 1T=[];1j(7 i=0;i<1R.1n;i++)1j(7 j=0;j<1R[i].1n;j++)1T.2J(1R[i][j]);m 1T};k 3c(2F,3g){1T=[];1j(7 i=3g;i<2F.1n;i++)1T.2J(2F[i]);m 1T};k 1g(2I,3b){7 1f=3c(1R,2);m k(){2I[3b].4d(2I,38(1f,1R))}};k 1G(e){6(g==\'2g\'||g==\'1D\'||g==\'1v\'){e.3a=L;e.4c();e.4b()}u 6(g==\'E\'){11.Y.3a=L}};k K(3i,3j,3v,3x,h){4.49=\'2.2\';4.2z=H;4.M=1o(3i);4.c=1o(3j);4.b=1o(3v);4.l=1o(3x);4.t=0;4.h=h;6(!4.h["1y"]){4.h["1y"]=""}4.1d=0;4.17=0;4.O=0;4.Q=0;4.R=20;4.4h=20;4.1k=0;4.1p=0;4.1r=\'\';4.J=1X;6(4.h["1U"]!=\'\'){4.J=8.18(\'27\');4.J.5.n=\'1M\';4.J.5.1l=\'1x\';4.J.1N=\'3C\';4.J.5.2v=\'2u\';4.J.5.47=\'4i\';4.J.36=4.h["1Q"]+\'<4n/><U 46="0" 33="\'+4.h["1Q"]+\'" 1a="\'+4.h["1U"]+\'"/>\';4.M.1b(4.J)}4.3V=\'\';4.2p=H;1z.2J(4);4.2S=1g(4,"2l")};K.12.3N=k(){3w(11.8,"21",4.2S);6(4.h["n"]=="1L"){1o(4.M.C+"-3f").2Z(4.b)}};K.12.2l=k(e){7 r=2T(e);7 x=r[\'x\'];7 y=r[\'y\'];7 V=0;7 T=0;7 P=4.c;1Z(P&&P.1S!="3k"&&P.1S!="3d"){V+=P.3o;T+=P.3p;P=P.3m}6(g==\'E\'){7 r=2o(4.c);T=r[\'o\'];V=r[\'D\']}T+=a(q(4.c,\'26\'));V+=a(q(4.c,\'2K\'));6(g!=\'E\'||!(8.1e&&\'22\'==8.1e.1F())){T+=a(q(4.c,\'23\'));V+=a(q(4.c,\'2h\'))}6(x>a(T+4.O)){4.2b();m H}6(x<a(T)){4.2b();m H}6(y>a(V+4.Q)){4.2b();m H}6(y<a(V)){4.2b();m H}6(g==\'E\'){4.M.5.1O=1}m L};K.12.35=k(e){1G(e);4.M.5.2H=\'3q\'};K.12.2Y=k(e){1G(e);4.M.5.2H=\'3T\'};K.12.21=k(e){1G(e);1j(i=0;i<1z.1n;i++){6(1z[i]!=4){1z[i].2l(e)}}6(4.h&&4.h["1K"]==L){6(4.M.5.2H!=\'3q\'){m}}6(4.2z){m}6(!4.2l(e)){m}4.2z=L;7 2r=4.c;7 T=0;7 V=0;6(g==\'2g\'||g==\'1v\'||g==\'1D\'){7 P=2r;1Z(P.1S!="3k"&&P.1S!="3d"){V+=P.3o;T+=P.3p;P=P.3m}}u{7 r=2o(4.c);T=r[\'o\'];V=r[\'D\']}T+=a(q(4.c,\'26\'));V+=a(q(4.c,\'2K\'));6(g!=\'E\'||!(8.1e&&\'22\'==8.1e.1F())){T+=a(q(4.c,\'23\'));V+=a(q(4.c,\'2h\'))}7 r=2T(e);7 x=r[\'x\'];7 y=r[\'y\'];4.1k=x-T;4.1p=y-V;6((4.1k+4.R/2)>=4.O){4.1k=4.O-4.R/2}6((4.1p+4.Z/2)>=4.Q){4.1p=4.Q-4.Z/2}6((4.1k-4.R/2)<=0){4.1k=4.R/2}6((4.1p-4.Z/2)<=0){4.1p=4.Z/2}2U(1g(4,"2B"),10)};K.12.2B=k(){7 28=4.1k-4.R/2;7 2f=4.1p-4.Z/2;7 2e=28*(4.1d/4.O);7 2A=2f*(4.17/4.Q);6(8.1c.4X==\'4Y\'){2e=(4.1k+4.R/2-4.O)*(4.1d/4.O)}28+=a(q(4.c,\'26\'));2f+=a(q(4.c,\'2K\'));6(g!=\'E\'||!(8.1e&&\'22\'==8.1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\'4E\'))}6(4.J!=1X)4.J.5.1l=\'1x\';4.M.5.F=4.c.F+\'B\';4.b.5.D=\'-1P\';4.1r=\'G\';7 r=2o(4.c);6(!r){4.b.5.o=4.O+a(q(4.c,\'26\'))+a(q(4.c,\'4F\'))+a(q(4.c,\'23\'))+a(q(4.c,\'3K\'))+15+\'B\'}u{4.b.5.o=(r[\'2n\']-r[\'o\']+15)+\'B\'}3n(4.h[\'n\']){1i\'o\':4.b.5.o=\'-\'+(15+a(4.b.5.F))+\'B\';13;1i\'1W\':6(r){4.1r=r[\'1W\']-r[\'D\']+15+\'B\'}u{4.1r=4.c.z+15+\'B\'}4.b.5.o=\'G\';13;1i\'D\':4.1r=\'-\'+(15+a(4.b.5.z))+\'B\';4.b.5.o=\'G\';13;1i\'1L\':4.b.5.o=\'G\';4.1r=\'G\';13;1i\'30\':4.b.5.o=\'G\';4.1r=\'G\';13}6(4.t){4.2E();6(4.h&&4.h["1E"]==L){4.2B()}m}4.3I();4.3r();1h(11.8,"21",4.2S);1h(4.M,"21",1g(4,"21"));6(4.h&&4.h["1K"]==L){1h(4.M,"35",1g(4,"35"));1h(4.M,"2Y",1g(4,"2Y"))}6(4.h&&4.h["1E"]==L){4.1k=4.O/2;4.1p=4.Q/2;4.2B()}};K.12.37=k(25,e){6(25.2C==4.l.1a)m;7 24=8.18("1t");24.C=4.l.C;24.1a=25.2C;7 p=4.l.4H;p.4G(24,4.l);4.l=24;4.l.5.n=\'29\';4.c.1a=25.3G;6(1o(\'2m\'+4.b.C)){1o(\'2m\'+4.b.C).36=25.3z}4.2p=H;4.1I()};k 3P(C,I){7 9=11.8.32("A");1j(7 i=0;i<9.1n;i++){6(9[i].1q==C){1h(9[i],"2j",k(Y){6(g!=\'E\'){4.3t()}u{11.3u()}1G(Y);m H});1h(9[i],I.h[\'2c\'],1g(I,"37",9[i]));9[i].5.39=\'0\';9[i].2q=31;9[i].2q({I:I,4D:k(){4.I.37(1X,4)}});7 U=8.18("1t");U.1a=9[i].2C;U.5.n=\'1M\';U.5.o=\'-1P\';U.5.D=\'-1P\';8.16.1b(U);U=8.18("1t");U.1a=9[i].3G;U.5.n=\'1M\';U.5.o=\'-1P\';U.5.D=\'-1P\';8.16.1b(U)}}};k 4I(){1Z(1z.1n>0){7 I=1z.4J();I.3N()}};k 3H(){7 1Q=\'4N 4M\';7 1U=\'\';7 1J=11.8.32("1t");1j(7 i=0;i<1J.1n;i++){6(/3C/.3M(1J[i].1N)){6(1J[i].33!=\'\')1Q=1J[i].33;1U=1J[i].1a;13}}7 9=11.8.32("A");1j(7 i=0;i<9.1n;i++){6(/K/.3M(9[i].1N)){1Z(9[i].1w){6(9[i].1w.1S!=\'1t\'){9[i].2Z(9[i].1w)}u{13}}6(9[i].1w.1S!=\'1t\')4L"4B K 4P!";7 1B=2i.34(2i.52()*55);9[i].5.n="29";9[i].5.2v=\'2u\';9[i].5.39=\'0\';9[i].5.4Z=\'3y\';1h(9[i],"2j",k(Y){6(g!=\'E\'){4.3t()}u{11.3u()}1G(Y);m H});6(9[i].C==\'\'){9[i].C="4Q"+1B}6(g==\'E\'){9[i].5.1O=0}7 2r=9[i].1w;2r.C="3s"+1B;7 N=8.18("27");N.C="4U"+1B;S=1m 1A(/X(\\s+)?:(\\s+)?(\\d+)/i);v=S.1C(9[i].1q);7 X=50;6(v){X=a(v[3])}S=1m 1A(/4V\\-4o(\\s+)?:(\\s+)?(2j|4W)/i);v=S.1C(9[i].1q);7 2c=\'2j\';6(v){2c=v[3]}S=1m 1A(/I\\-F(\\s+)?:(\\s+)?(\\w+)/i);v=S.1C(9[i].1q);N.5.F=\'3l\';6(v){N.5.F=v[3]}S=1m 1A(/I\\-z(\\s+)?:(\\s+)?(\\w+)/i);v=S.1C(9[i].1q);N.5.z=\'3l\';6(v){N.5.z=v[3]}S=1m 1A(/I\\-n(\\s+)?:(\\s+)?(\\w+)/i);v=S.1C(9[i].1q);7 n=\'2n\';6(v){3n(v[3]){1i\'o\':n=\'o\';13;1i\'1W\':n=\'1W\';13;1i\'D\':n=\'D\';13;1i\'1L\':n=\'1L\';13;1i\'30\':n=\'30\';13}}S=1m 1A(/3Y\\-3R(\\s+)?:(\\s+)?(L|H)/i);v=S.1C(9[i].1q);7 1K=H;6(v){6(v[3]==\'L\')1K=L}S=1m 1A(/3U\\-4e\\-I(\\s+)?:(\\s+)?(L|H)/i);v=S.1C(9[i].1q);7 1E=H;6(v){6(v[3]==\'L\')1E=L}N.5.3h=\'1x\';N.1N="48";N.5.1O=1V;N.5.1l=\'1x\';6(n!=\'1L\'){N.5.n=\'1M\'}u{N.5.n=\'29\'}7 2D=8.18("1t");2D.C="3Q"+1B;2D.1a=9[i].2C;N.1b(2D);6(n!=\'1L\'){9[i].1b(N)}u{1o(9[i].C+\'-3f\').1b(N)}7 h={1E:1E,1K:1K,1y:9[i].3z,X:X,2c:2c,n:n,1Q:1Q,1U:1U};7 I=1m K(9[i].C,\'3s\'+1B,N.C,\'3Q\'+1B,h);9[i].2q=31;9[i].2q({I:I});I.1I();3P(9[i].C,I)}}};6(g==\'E\')3D{8.4a("4l",H,L)}3B(e){};1h(11,"3J",3H);',62,318,'||||this|style|if|var|document|aels|parseInt|bigImageCont|smallImage||||MagicZoom_ua|settings|||function|bigImage|return|position|left||MagicZoom_getStyle|||pup|else|matches||||height||px|id|top|msie|width|0px|false|zoom|loadingCont|MagicZoom|true|smallImageCont|bigCont|smallImageSizeX|tag|smallImageSizeY|popupSizeX|re|smallX|img|smallY||opacity|event|popupSizeY||window|prototype|break|||body|bigImageSizeY|createElement||src|appendChild|documentElement|bigImageSizeX|compatMode|args|MagicZoom_createMethodReference|MagicZoom_addEventListener|case|for|positionX|visibility|new|length|_el|positionY|rel|bigImageContStyleTop|scrollLeft|IMG|scrollTop|opera|firstChild|hidden|header|MagicZoom_zooms|RegExp|rand|exec|safari|bigImage_always_visible|toLowerCase|MagicZoom_stopEventPropagation|listener|initZoom|iels|drag_mode|custom|absolute|className|zIndex|10000px|loadingText|arguments|tagName|result|loadingImg|100|bottom|null|obj|while||mousemove|backcompat|paddingLeft|newBigImage|ael|borderLeftWidth|DIV|pleft|relative|wx|hiderect|thumb_change|wy|perX|ptop|gecko|paddingTop|Math|click|el|checkcoords|MagicZoomHeader|right|MagicZoom_getBounds|safariOnLoadStarted|mzextend|smallImg|ar1|indexOf|block|display|clientX|visible|clientY|recalculating|perY|showrect|href|bigImg|recalculatePopupDimensions|sequence|property|cursor|object|push|borderTopWidth|complete|bw|parseFloat|MagicView_ia|on|padding|vc68|checkcoords_ref|MagicZoom_getEventBounds|setTimeout|styleProp|vc67|css|mouseup|removeChild|inner|MagicZoom_extendElement|getElementsByTagName|alt|round|mousedown|innerHTML|replaceZoom|MagicZoom_concat|outline|cancelBubble|methodName|MagicZoom_withoutFirst|HTML|filter|big|skip|overflow|smallImageContId|smallImageId|BODY|300px|offsetParent|switch|offsetTop|offsetLeft|move|initPopup|sim|blur|focus|bigImageContId|MagicZoom_removeEventListener|bigImageId|none|title|getBoundingClientRect|catch|MagicZoomLoading|try|borderWidth|getComputedStyle|rev|MagicZoom_findZooms|initBigContainer|load|paddingRight|currentStyle|test|stopZoom|bigimgsrc|MagicZoom_findSelectors|bim|mode|getElementById|default|always|baseuri|removeEventListener|in|drag|navigator|error|alert|userAgent|attachEvent|Array|mozilla|border|textAlign|MagicZoomBigImageCont|version|execCommand|stopPropagation|preventDefault|apply|show|pageYOffset|addEventListener|popupSizey|center|defaultView|pageXOffset|BackgroundImageCache|detachEvent|br|change|Microsoft|DXImageTransform|Alpha|frameBorder|3px|progid|javascript|MozUserSelect|unselectable|onselectstart|oncontextmenu|IFRAME|Invalid|offsetWidth|selectThisZoom|paddingBottom|borderRightWidth|replaceChild|parentNode|MagicZoom_stopZooms|pop|offsetHeight|throw|Zoom|Loading|Opacity|invocation|sc|String|fromCharCode|charCodeAt|bc|thumb|mouseover|dir|rtl|textDecoration||xgdf7fsgd56|random|moz|alpha|1000000|html|MagicZoomPup'.split('|'),0,{}))


