/*
File: jqzoom.wr.1.0.1.js
File: _swfobject.2.2.js
File: sifr.436.js
File: global.js
File: ../Skin/Lala/Scripts.js
*/


/*
 * JQZoom Evolution 1.0.1 - Javascript Image magnifier
 *
 * Copyright (c) Engineer Renzi Marco(www.mind-projects.it)
 *
 * $Date: 12-12-2008
 *
 *	ChangeLog:
 *  
 * $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
 */
(function($)
{
    $.fn.jqzoom = function(options)
    {
        var settings = {
            zoomType: 'standard', //standard/reverse/innerzoom
            zoomWidth: 200,		//zoomed width default width
            zoomHeight: 200,		//zoomed div default width
            xOffset: 10,		//zoomed div default offset
            yOffset: 0,
            position: "right" ,//zoomed div default position,offset position is to the right of the image
            lens:true, //zooming lens over the image,by default is 1;
			lensReset : false,
			imageOpacity: 0.2,
			title : true,
			alwaysOn: false,
			showEffect: 'show',
			hideEffect: 'hide',
			fadeinSpeed: 'fast',
			fadeoutSpeed: 'slow',
			preloadImages :true,
			showPreload: true,
			preloadText : 'Loading zoom',
			preloadPosition : 'center',   //bycss,
            activateEvent : "click" // hover and click
        };

			//extending options
			options = options || {};
        	$.extend(settings, options);


		return this.each(function()
		{
			var a = $(this);
			var aTitle = a.attr('title'); //variabile per memorizzare il titolo href
			$(a).removeAttr('title');
			$(a).css('outline-style','none');


			var img = $("img", this);
			var imageTitle = img.attr('title');
			img.removeAttr('title');	//variabile per memorizzare il titolo immagine


			var smallimage = new Smallimage( img );
			var smallimagedata = {};
			//imageborder
			var btop = 0;
			var bleft = 0;

			var loader = null;     //variabile per memorizzare oggetto loader
			loader = new Loader();

			var ZoomTitle = (trim(aTitle).length > 0) ? aTitle :
			(trim(imageTitle).length > 0) ? imageTitle : null;  //setting zoomtitle
			var ZoomTitleObj = new zoomTitle();

			var largeimage = new Largeimage( a[0].href );

			var lens = new Lens();
			var lensdata = {};
			//lensborder



			var largeimageloaded = false;
			var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
			var stage = null; // quadrato che mostra l'immagine ingrandita
			var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
			var mousepos = {};
			var firstime = 0;
			var preloadshow = false;
			var isMouseDown = false;
			var dragstatus = false
            var timeout = null;
            //loading smallimagedata
			smallimage.loadimage();

            //ritorna false al click dell href
			$(this).click(function(){return false;});

			//se settato alwaysOn attivo lo Zoom e lo mostro.

			if (settings.activateEvent == "hover") {
                $(this).mouseover(function(e) {
                    if (timeout) {
                        clearTimeout(timeout);
                        timeout = null;
                    }
                    if (!running) {
                        mousepos.x = e.pageX;
                        mousepos.y	= e.pageY;
                        hoverActivation();
                    }
                });
                $(this).mouseout(function() {
                    timeout = setTimeout(hoverDeactivation, 200);
                });
            } else {
                $(this).click(function(e) {
                    if (!running) {
                        mousepos.x = e.pageX;
                        mousepos.y	= e.pageY;
                        activate();
                    } else {
                        deactivate();
                    }
                });
            }


			//ALWAYS ON
			if(settings.alwaysOn)
			{
				setTimeout(function(){activate();},150);
			}


            function hoverActivation() {
                document.jqzoomCheckObj = a;
                activate();
            }
            function activate()
			{
                // WELTRETTER CODE
                $(".productbigpicture a").each(function(){this.stopZoom();});
                // / WELTRETTER CODE
                if ( !running ) {

					//finding border
					smallimage.findborder();

					running = true;

					//rimuovo il titolo al mouseover
					imageTitle = img.attr('title');
					img.removeAttr('title');
					aTitle = a.attr('title');
					$(a).removeAttr('title');

					//se non cè creo l'oggetto largeimage
					if (!largeimage || $.browser.safari) {
						largeimage = new Largeimage( a[0].href );
					}

					//se l'immagine grande non è stata caricata la carico
					if(!largeimageloaded || $.browser.safari)
					{
						largeimage.loadimage();
					}else
					{
					//after preload
						if(settings.zoomType != 'innerzoom')
						{
							stage = new Stage();
							stage.activate();
						}
						lens = new Lens;
						lens.activate();
					}

					//hack per MAC
				/*	if($.browser.safari)
					{
						if(settings.zoomType != 'innerzoom') //se innerzoom non mostro la finestra dello zoom
						{
							stage = new Stage();
							stage.activate();
						}
						if($('div.jqZoomPup').length <= 0)
						{
						lens = new Lens();
						}
						//if(settings.zoomType == 'innerzoom'){lens = new Lens()};
						lens.activate();
						(settings.alwaysOn) ? lens.center() : lens.setposition(null);
					}
					*/
					a[0].blur();
                    return false;
				}
			}
            this.startZoom = activate;

            function hoverDeactivation() {
                //alert("jqzoomCheckObj: " + document.jqzoomCheckObj + "\na: " +  a + "\nif: " + (document.jqzoomCheckObj == a));
                if(document.jqzoomCheckObj == a) {
                    deactivate();
                }
            }

            function deactivate()
			{
				if(settings.zoomType == 'reverse' &&  !settings.alwaysOn)
				{
					img.css({'opacity' : 1});
				}
				if(!settings.alwaysOn)
				{
					//resetting parameters
					running = false;
					largeimageloaded = false;
					$(lens.node).unbind('mousemove');
					lens.remove();
					if($('div.jqZoomWindow').length > 0 && stage)
					{
						stage.remove();
					}
					if($('div.jqZoomTitle').length > 0)
					{
						ZoomTitleObj.remove();
					}
					//resetting title
					img.attr('title',imageTitle);
					a.attr('title',aTitle);
					$().unbind();

					a.unbind('mousemove');
					//resetto il parametro che mi dice che è la prima volta che mostor lo zoom
					firstime = 0;
					//remove ieiframe
					if(jQuery('.zoom_ieframe').length > 0)
					{
						jQuery('.zoom_ieframe').remove();
					}
				}else
				{
					if(settings.lensReset)
					{
						switch(settings.zoomType)
						{
							case 'innerzoom':
							largeimage.setcenter();
							break;
							default:
							lens.center();
							break;
						}
					}
				}

				//non so se serve da provare
				if(settings.alwaysOn)
				{
					activate();
				}
			};

            this.stopZoom = deactivate;




		//smallimage
		function Smallimage( image )
		{
			this.node = image[0];

			this.loadimage = function() {
				this.node.src = image[0].src;
			};
			this.findborder = function()
			{
				var bordertop = '';
				bordertop = $(img).css('border-top-width');
				btop = '';
				var borderleft = '';
				borderleft = $(img).css('border-left-width');
				bleft = '';
				/*if($.browser.msie)
				{
					var temp = bordertop.split(' ');

					bordertop = temp[1];
					var temp = borderleft.split(' ');
					borderleft = temp[1];
				}*/

				if(bordertop)
				{
					for(i=0;i<3;i++)
					{
						var x = [];
						x = bordertop.substr(i,1);

						if(isNaN(x) == false)
						{
							btop = btop +''+ bordertop.substr(i,1);
						}else
						{
							break;
						}
					}
				}

				if(borderleft)
				{
					for(i=0;i<3;i++)
					{
						if(!isNaN(borderleft.substr(i,1)))
						{
							bleft = bleft + borderleft.substr(i,1)
						}else
						{
							break;
						}
					}
				}
				btop = (btop.length > 0) ? eval(btop) : 0;
				bleft = (bleft.length > 0) ? eval(bleft) : 0;


			}
			this.node.onload = function()
			{
				//setto il cursor e la posizione dell'href


				a.css({'cursor':'url(/Images/magnify.cur),crosshair','display':'block'});

				if(a.css('position')!= 'absolute' && a.parent().css('position'))
				{
					a.css({'cursor':'url(/Images/magnify.cur),crosshair','position':'relative','display':'block'});
				}
				if(a.parent().css('position') != 'absolute')
				{
					a.parent().css('position','relative');
					//a.css('position','relative');
				}
				else{
				//a.css('position','relative');
				}
				if($.browser.safari || $.browser.opera)
				{
					$(img).css({position:'absolute',top:'0px',left:'0px'});
				}
				/*if(a.css('position')!= 'absolute' && a.parent().css('position'))
				{
					a.css({'cursor':'url(/Images/magnify.cur),crosshair','position':'relative','display':'block'});
				}
				if(a.parent().css('position') != 'absolute')
				{
					alert('in');
					a.parent().css('position','relative');
					//a.css('position','relative');
				}
				else{
				//a.css('position','relative');
				}*/



				/*
				if(a.parent().css('position') != 'relative' && a.css('position') != 'absolute')
				{
				a.css({'cursor':'url(/Images/magnify.cur),crosshair','position':'relative','display':'block'});
				}*/

				//al docuemnt ready viene caricato l'src quindi viene azionato l'onload e carico tutti i dati
				smallimagedata.w = $( this ).width();
				smallimagedata.h = $( this ).height();


				//non viene fatta assegnazione alla variabile globale
				smallimagedata.h = $( this ).height();
				smallimagedata.pos = $( this ).offset();
				smallimagedata.pos.l = $( this ).offset().left;
				smallimagedata.pos.t = $( this ).offset().top;
				smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l;
				smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t;

				//per sicurezza setto l'altezza e la width dell'href
				a.height(smallimagedata.h);
				a.width(smallimagedata.w);


				//PRELOAD IMAGES
				if(settings.preloadImages)
				{
					largeimage.loadimage();
				}



			};



			return this;
		};



		//Lens
		function Lens()
		{


			//creating element and adding class
			this.node = document.createElement("div");
			$(this.node).addClass('jqZoomPup');

			this.node.onerror = function() {
				$( lens.node ).remove();
				lens = new Lens();
				lens.activate() ;
			};




			//funzione privata per il caricamento dello zoom
			this.loadlens = function()
			{


				switch(settings.zoomType)
				{
					case 'reverse':
						this.image = new Image();
						this.image.src = smallimage.node.src; // fires off async
						this.node.appendChild( this.image );
						$( this.node ).css({'opacity' : 1});
					break;
					case 'innerzoom':

						this.image = new Image();
						this.image.src = largeimage.node.src; // fires off async
						this.node.appendChild( this.image );
						$( this.node ).css({'opacity' : 1});
					break
					default:
					break;
				}



				switch(settings.zoomType)
				{
					case 'innerzoom':
						lensdata.w = smallimagedata.w;
						lensdata.h = smallimagedata.h;
					break;
					default:
						lensdata.w = (settings.zoomWidth)/scale.x;
						lensdata.h = (settings.zoomHeight)/scale.y;
					break;
				}

			$( this.node ).css({
					width: lensdata.w + 'px',
					height: lensdata.h + 'px',
					position: 'absolute',
					/*cursor: 'url(/Images/magnify.cur),crosshair',*/
					display: 'none',
					//border: '1px solid blue'
					borderWidth: 1+'px'
				});
			a.append(this.node);
			}
			return this;
		};

		Lens.prototype.activate = function()
		{
			//carico la lente
			this.loadlens();

			switch(settings.zoomType)
			{
				case 'reverse':
					img.css({'opacity' : settings.imageOpacity});

					(settings.alwaysOn) ? lens.center() : lens.setposition(null);
					//lens.center();
					//bindo ad a il mousemove della lente
					a.bind( 'mousemove', function(e)
					{
						mousepos.x = e.pageX;
						mousepos.y = e.pageY;
						lens.setposition( e );
					});
				break;
				case 'innerzoom':

					//	lens = new Lens();
					//	lens.activate();

					$( this.node ).css({top : 0 ,left: 0});
				   	if(settings.title)
					{
						ZoomTitleObj.loadtitle();
					}

					largeimage.setcenter();

				   	a.bind( 'mousemove', function(e)
				   	{
						mousepos.x = e.pageX;
						mousepos.y = e.pageY;
						largeimage.setinner( e );

					/*if(settings.zoomType == 'innerzoom' && running)
					{
						$(a).mousemove(function(){
							if($('div.jqZoomPup').length <= 0)
							{
								lens = new Lens();
								lens.activate();
							}
						});
					}*/

						/*if($('div.jqZoomPup').length <= 0)
							{
								lens = new Lens();
								lens.activate();
							}*/

					});
				break;
				default:
					/*$(document).mousemove(function(e){
					if(isMouseDown && dragstatus != false){
					lens.setposition( e );
					}
					});
					lens.center()


					dragstatus = 'on'
					$(document).mouseup(function(e){
					if(isMouseDown && dragstatus != false){
						isMouseDown = false;
						dragstatus = false;

					}
					});

					$(this.node).mousedown(function(e){
					$('div.jqZoomPup').css("cursor", "move");
					$(this.node).css("position", "absolute");

				// set z-index
					$(this.node).css("z-index", parseInt( new Date().getTime()/1000 ));
					if($.browser.safari)
					{
						$(a).css("cursor", "move");
					}
					isMouseDown    = true;
					dragstatus = 'on';
					lens.setposition( e );
					});
					*/


					(settings.alwaysOn) ? lens.center() : lens.setposition(null);

					//bindo ad a il mousemove della lente
					$(a).bind( 'mousemove', function(e)
					{

						mousepos.x = e.pageX;
						mousepos.y = e.pageY;
						lens.setposition( e );
					});

				break;
			}


			return this;
		};

		Lens.prototype.setposition = function( e)
		{


			if(e)
			{
				mousepos.x = e.pageX;
				mousepos.y	= e.pageY;
			}

            if(firstime == 0)
			{
			 	var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
			 	var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2 ;
				//ADDED

				$('div.jqZoomPup').show()
				if(settings.lens)
				{
					this.node.style.visibility = 'visible';
				}
				else
				{
					this.node.style.visibility = 'hidden';
					$('div.jqZoomPup').hide();
				}
				//ADDED
				firstime = 1;

			}else
			{
				var lensleft = mousepos.x - (smallimagedata.pos.l+$("#productdisplay .productimagewrapper").get(0).offsetLeft) - (lensdata.w)/2 ;
				var lenstop = mousepos.y - smallimagedata.pos.t -(lensdata.h)/2 ;
			}


				//a sinistra
				if(overleft())
				{
					lensleft = 0  + bleft;
				}else
				//a destra
				if(overright())
				{
					if($.browser.msie)
					{
					lensleft = smallimagedata.w - lensdata.w  + bleft + 1  ;
					}else
					{
					lensleft = smallimagedata.w - lensdata.w  + bleft - 1  ;
					}


				}

				//in alto
				if(overtop())
				{
					lenstop = 0 + btop ;
				}else
				//sotto
				if(overbottom())
				{

					if($.browser.msie)
					{
					lenstop = smallimagedata.h - lensdata.h  + btop + 1 ;
					}else
					{
					lenstop = smallimagedata.h - lensdata.h - 1 + btop  ;
					}

				}
				lensleft = parseInt(lensleft);
				lenstop = parseInt(lenstop);

				//setto lo zoom ed un eventuale immagine al centro
				$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });

				if(settings.zoomType == 'reverse')
				{
					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - bleft +1)  });
				}

				this.node.style.left = lensleft + 'px';
				this.node.style.top = lenstop + 'px';

				//setto l'immagine grande
				largeimage.setposition();

				function overleft() {
					return mousepos.x - (lensdata.w +2*1)/2  - bleft < (smallimagedata.pos.l+$("#productdisplay .productimagewrapper").get(0).offsetLeft);
				}

				function overright() {

					return mousepos.x + (lensdata.w + 2* 1)/2  > (smallimagedata.pos.r+$("#productdisplay .productimagewrapper").get(0).offsetLeft) + bleft ;
				}

				function overtop() {
					return mousepos.y - (lensdata.h + 2* 1)/2  - btop < smallimagedata.pos.t;
				}

				function overbottom() {
					return mousepos.y + (lensdata.h + 2* 1)/2    > smallimagedata.pos.b + btop;
				}

			return this;
		};


		//mostra la lente al centro dell'immagine
		Lens.prototype.center = function()
		{
			$('div.jqZoomPup',a).css('display','none');
			var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
			var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2;
			this.node.style.left = lensleft + 'px';
			this.node.style.top = lenstop + 'px';
			$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });

			if(settings.zoomType == 'reverse')
			{
				/*if($.browser.safari){
					alert('safari');
					alert(2*bleft);
					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - 2*bleft)  });
				}else
				{*/
					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -(lenstop - btop + 1) ,'left': -( lensleft  - bleft +1)   });
				//}
			}

			largeimage.setposition();
			if($.browser.msie)
			{
				$('div.jqZoomPup',a).show();
			}else
			{
				setTimeout(function(){$('div.jqZoomPup').fadeIn('fast');},10);
			}
		};


		//ritorna l'offset
		Lens.prototype.getoffset = function() {
			var o = {};
			o.left = parseInt(this.node.style.left) ;
			o.top =  parseInt(this.node.style.top) ;
			return o;
		};

		//rimuove la lente
		Lens.prototype.remove = function()
		{

			if(settings.zoomType == 'innerzoom')
			{
				$('div.jqZoomPup',a).fadeOut('fast',function(){/*$('div.jqZoomPup img').remove();*/$(this).remove();});
			}else
			{
				//$('div.jqZoomPup img').remove();
				$('div.jqZoomPup',a).remove();
			}
		};

		Lens.prototype.findborder = function()
		{
			var bordertop = '';
			bordertop = $('div.jqZoomPup').css('borderTop');
			//alert(bordertop);
			lensbtop = '';
			var borderleft = '';
			borderleft = $('div.jqZoomPup').css('borderLeft');
			lensbleft = '';
			if($.browser.msie)
			{
				var temp = bordertop.split(' ');

				bordertop = temp[1];
				var temp = borderleft.split(' ');
				borderleft = temp[1];
			}

			if(bordertop)
			{
				for(i=0;i<3;i++)
				{
					var x = [];
					x = bordertop.substr(i,1);

					if(isNaN(x) == false)
					{
						lensbtop = lensbtop +''+ bordertop.substr(i,1);
					}else
					{
						break;
					}
				}
			}

			if(borderleft)
			{
				for(i=0;i<3;i++)
				{
					if(!isNaN(borderleft.substr(i,1)))
					{
						lensbleft = lensbleft + borderleft.substr(i,1)
					}else
					{
						break;
					}
				}
			}


			lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0;
			lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0;
		}

		//LARGEIMAGE
		function Largeimage( url )
		{
			this.url = url;
			this.node = new Image();

			/*if(settings.preloadImages)
			{
			 	preload.push(new Image());
				preload.slice(-1).src = url ;
			}*/

			this.loadimage = function()
			{


				if(!this.node)
				this.node = new Image();

				this.node.style.position = 'absolute';
				this.node.style.display = 'none';
				this.node.style.left = '-5000px';
				this.node.style.top = '10px';
				loader = new Loader();

				if(settings.showPreload && !preloadshow)
				{
					loader.show();
					preloadshow = true;
				}

				$("#productdisplay .productimagewrapper").append(this.node);
				this.node.src = this.url; // fires off async
			}

			this.node.onload = function()
			{
				this.style.display = 'block';
				var w = Math.round($(this).width());
				var	h = Math.round($(this).height());

				this.style.display = 'none';

				//setting scale
				scale.x = (w / smallimagedata.w);
				scale.y = (h / smallimagedata.h);





				if($('div.preload').length > 0)
				{
					$('div.preload').remove();
				}

				largeimageloaded = true;

				if(settings.zoomType != 'innerzoom' && running){
					stage = new Stage();
					stage.activate();
				}

				if(running)
				{
				//alert('in');
				lens = new Lens();

				lens.activate() ;

				}
				//la attivo

				if($('div.preload').length > 0)
				{
					$('div.preload').remove();
				}
			}
			return this;
		}


		Largeimage.prototype.setposition = function()
		{
          	this.node.style.left = Math.ceil( - scale.x * parseInt(lens.getoffset().left) + bleft) + 'px';
			this.node.style.top = Math.ceil( - scale.y * parseInt(lens.getoffset().top) +btop) + 'px';
		};

		//setto la posizione dell'immagine grande nel caso di innerzoom
		Largeimage.prototype.setinner = function(e) {
          	this.node.style.left = Math.ceil( - scale.x * Math.abs(e.pageX - smallimagedata.pos.l)) + 'px';
			this.node.style.top = Math.ceil( - scale.y * Math.abs(e.pageY - smallimagedata.pos.t)) + 'px';
			$('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left  });
		};


		Largeimage.prototype.setcenter = function() {
          	this.node.style.left = Math.ceil(- scale.x * Math.abs((smallimagedata.w)/2)) + 'px';
			this.node.style.top = Math.ceil( - scale.y * Math.abs((smallimagedata.h)/2)) + 'px';


			$('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left  });
		};


		//STAGE
		function Stage()
		{

			var leftpos = smallimagedata.pos.l;
			var toppos = smallimagedata.pos.t;
			//creating element and class
			this.node = document.createElement("div");
			$(this.node).addClass('jqZoomWindow');
			$(this.node).click(function(e) {
                deactivate();
            });

			/* WELTRETTER REMOVED CODE
			$( this.node )
				.css({
					position: 'absolute',
					width: Math.round(settings.zoomWidth) + 'px',
					height: Math.round(settings.zoomHeight) + 'px',
					display: 'none',
					zIndex: 10000,
					overflow: 'hidden'
				});
		    */


            /* WELTRETTER REMOVED CODE
			//fa il positionamento
		    switch(settings.position)
		    {
		    	case "right":

				leftpos = (smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width)
				? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
				: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));

				topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
				toppos = (topwindow < screen.height && topwindow > 0)
				?  smallimagedata.pos.t + settings.yOffset
				:  smallimagedata.pos.t;

		    	break;
		    	case "left":

				leftpos = (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0)
				? (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth)
				: (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset));

				topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
				toppos = (topwindow < screen.height && topwindow > 0)
				?  smallimagedata.pos.t + settings.yOffset
				:  smallimagedata.pos.t;

		    	break;
		    	case "top":

				toppos = (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0)
				? (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight)
				: (smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset));


				leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
				leftpos = (leftwindow < screen.width && leftwindow > 0)
				? smallimagedata.pos.l + settings.xOffset
				: smallimagedata.pos.l;

		    	break;
		    	case "bottom":


				toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $('body').height())
				? (smallimagedata.pos.b + Math.abs(settings.yOffset))
				: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));


				leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
				leftpos = (leftwindow < screen.width && leftwindow > 0)
				? smallimagedata.pos.l + settings.xOffset
				: smallimagedata.pos.l;

		    	break;
		    	default:

				leftpos = (smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width)
				? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
				: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));

				toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height)
				? (smallimagedata.pos.b + Math.abs(settings.yOffset))
				: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));

		    	break;
		    }
            toppos -= $("#mainwrapper").offset().top;
            leftpos -= $("#mainwrapper").offset().left;
            this.node.style.left = leftpos + 'px';
			this.node.style.top = toppos + 'px';
             */
			return this;
		}


		Stage.prototype.activate = function()
		{

			if ( !this.node.firstChild )
					this.node.appendChild( largeimage.node );


			if(settings.title)
			{
				ZoomTitleObj.loadtitle();
			}



			$("#productdisplay").append(this.node);

            Zoomer.positionZoomWindow(img.get(0));
			switch(settings.showEffect)
			{
				case 'show':
					$(this.node).show();
				break;
				case 'fadein':
					$(this.node).fadeIn(settings.fadeinSpeed);
				break;
				default:
					$(this.node).show();
				break;
			}

			$(this.node).show();

            if ($.browser.msie && $.browser.version < 7) {
	        this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>')
	          .css({ position: "absolute", left:this.node.style.left,top:this.node.style.top,zIndex: 99,width:settings.zoomWidth,height:settings.zoomHeight })
	          .insertBefore(this.node);
	     	 };


			largeimage.node.style.display = 'block';
		}

		Stage.prototype.remove = function() {
			switch(settings.hideEffect)
			{
				case 'hide':
					$('.jqZoomWindow').remove();
				break;
				case 'fadeout':
					$('.jqZoomWindow').fadeOut(settings.fadeoutSpeed);
				break;
				default:
					$('.jqZoomWindow').remove();
				break;
			}
		}

		function zoomTitle()
		{

			this.node =  jQuery('<div />')
				.addClass('jqZoomTitle')
				.html('' + ZoomTitle +'');

			this.loadtitle = function()
			{
				if(settings.zoomType == 'innerzoom')
				{
					$(this.node)
					.css({position: 'absolute',
						  top: smallimagedata.pos.b +3,
						  left: (smallimagedata.pos.l+1),
						  width:smallimagedata.w
						  })
					.appendTo('#productdisplay .productimagewrapper');
				}else
				{
					$(this.node).appendTo(stage.node);
				}
			};
		}

		zoomTitle.prototype.remove = function() {
			$('.jqZoomTitle').remove();
		}


		function Loader()
		{

			this.node = document.createElement("div");
			$(this.node).addClass('preload');
			$(this.node).html(settings.preloadText);//appendo il testo

			$(this.node )
				.appendTo("#productdisplay .productimagewrapper")
				.css('visibility','hidden');



			this.show = function()
			{
				switch(settings.preloadPosition)
				{
					case 'center':
						loadertop =  smallimagedata.pos.t + (smallimagedata.h - $(this.node ).height())/2;
						loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node ).width())/2;
					break;
					default:
					var loaderoffset = this.getoffset();
					loadertop = !isNaN(loaderoffset.top) ? smallimagedata.pos.t + loaderoffset.top : smallimagedata.pos.t + 0;
					loaderleft = !isNaN(loaderoffset.left) ? smallimagedata.pos.l + loaderoffset.left : smallimagedata.pos.l + 0;
					break;
				}

				//setting position
				$(this.node).css({
							top: loadertop  ,
							left: loaderleft ,
							position: 'absolute',
							visibility:'visible'
					    	});
			}
			return this;
		}

		Loader.prototype.getoffset = function()
		{
			var o = null;
			o = $('div.preload').offset();
			return o;
		}

		});
	}
})(jQuery);

	function trim(stringa)
	{
	    while (stringa.substring(0,1) == ' '){
	        stringa = stringa.substring(1, stringa.length);
	    }
	    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
	        stringa = stringa.substring(0,stringa.length-1);
	    }
	    return stringa;
	}

var swfobject=function(){var c="undefined",g="object",I="Shockwave Flash",O="ShockwaveFlash.ShockwaveFlash",s="application/x-shockwave-flash",F="SWFObjectExprInst",D="onreadystatechange",d=window,b=document,j=navigator,N=false,t=[U],i=[],u=[],n=[],o,q,z,G,l=false,p=false,f,v,K=true,a=function(){var m=typeof b.getElementById!=c&&typeof b.getElementsByTagName!=c&&typeof b.createElement!=c,h=j.userAgent.toLowerCase(),f=j.platform.toLowerCase(),l=f?/win/.test(f):/win/.test(h),o=f?/mac/.test(f):/mac/.test(h),n=/webkit/.test(h)?parseFloat(h.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=!+"\131",e=[0,0,0],a=null;if(typeof j.plugins!=c&&typeof j.plugins[I]==g){a=j.plugins[I].description;if(a&&!(typeof j.mimeTypes!=c&&j.mimeTypes[s]&&!j.mimeTypes[s].enabledPlugin)){N=true;i=false;a=a.replace(/^.*\s+(\S+\s+\S+$)/,"$1");e[0]=parseInt(a.replace(/^(.*)\..*$/,"$1"),10);e[1]=parseInt(a.replace(/^.*\.(.*)\s.*$/,"$1"),10);e[2]=/[a-zA-Z]/.test(a)?parseInt(a.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else if(typeof d.ActiveXObject!=c)try{var k=new ActiveXObject(O);if(k){a=k.GetVariable("$version");if(a){i=true;a=a.split(" ")[1].split(",");e=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}}}catch(p){}return {w3:m,pv:e,wk:n,ie:i,win:l,mac:o}}(),V=function(){if(!a.w3)return;(typeof b.readyState!=c&&b.readyState=="complete"||typeof b.readyState==c&&(b.getElementsByTagName("body")[0]||b.body))&&m();if(!l){typeof b.addEventListener!=c&&b.addEventListener("DOMContentLoaded",m,false);if(a.ie&&a.win){b.attachEvent(D,function(){if(b.readyState=="complete"){b.detachEvent(D,arguments.callee);m()}});d==top&&(function(){if(l)return;try{b.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}m()})()}a.wk&&(function(){if(l)return;if(!/loaded|complete/.test(b.readyState)){setTimeout(arguments.callee,0);return}m()})();J(m)}}();function m(){if(l)return;try{var c=b.getElementsByTagName("body")[0].appendChild(h("span"));c.parentNode.removeChild(c)}catch(e){return}l=true;for(var d=t.length,a=0;a<d;a++)t[a]()}function H(a){if(l)a();else t[t.length]=a}function J(a){if(typeof d.addEventListener!=c)d.addEventListener("load",a,false);else if(typeof b.addEventListener!=c)b.addEventListener("load",a,false);else if(typeof d.attachEvent!=c)T(d,"onload",a);else if(typeof d.onload=="function"){var e=d.onload;d.onload=function(){e();a()}}else d.onload=a}function U(){if(N)Q();else B()}function Q(){var i=b.getElementsByTagName("body")[0],e=h(g);e.setAttribute("type",s);var d=i.appendChild(e);if(d){var f=0;(function(){if(typeof d.GetVariable!=c){var b=d.GetVariable("$version");if(b){b=b.split(" ")[1].split(",");a.pv=[parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10)]}}else if(f<10){f++;setTimeout(arguments.callee,10);return}i.removeChild(e);d=null;B()})()}else B()}function B(){var p=i.length;if(p>0)for(var h=0;h<p;h++){var g=i[h].id,f=i[h].callbackFn,d={success:false,id:g};if(a.pv[0]>0){var b=e(g);if(b)if(r(i[h].swfVersion)&&!(a.wk&&a.wk<312)){k(g,true);if(f){d.success=true;d.ref=A(g);f(d)}}else if(i[h].expressInstall&&y()){var j={};j.data=i[h].expressInstall;j.width=b.getAttribute("width")||"0";j.height=b.getAttribute("height")||"0";if(b.getAttribute("class"))j.styleclass=b.getAttribute("class");if(b.getAttribute("align"))j.align=b.getAttribute("align");for(var o={},m=b.getElementsByTagName("param"),q=m.length,l=0;l<q;l++)if(m[l].getAttribute("name").toLowerCase()!="movie")o[m[l].getAttribute("name")]=m[l].getAttribute("value");x(j,o,g,f)}else{P(b);f&&f(d)}}else{k(g,true);if(f){var n=A(g);if(n&&typeof n.SetVariable!=c){d.success=true;d.ref=n}f(d)}}}}function A(f){var b=null,a=e(f);if(a&&a.nodeName=="OBJECT")if(typeof a.SetVariable!=c)b=a;else{var d=a.getElementsByTagName(g)[0];if(d)b=d}return b}function y(){return !p&&r("6.0.65")&&(a.win||a.mac)&&!(a.wk&&a.wk<312)}function x(g,j,i,m){p=true;z=m||null;G={success:false,id:i};var f=e(i);if(f){if(f.nodeName=="OBJECT"){o=w(f);q=null}else{o=f;q=i}g.id=F;if(typeof g.width==c||!/%$/.test(g.width)&&parseInt(g.width,10)<310)g.width="310";if(typeof g.height==c||!/%$/.test(g.height)&&parseInt(g.height,10)<137)g.height="137";b.title=b.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",l="MMredirectURL="+d.location.toString().replace(/&/g,"%26")+"&MMplayerType="+n+"&MMdoctitle="+b.title;if(typeof j.flashvars!=c)j.flashvars+="&"+l;else j.flashvars=l;if(a.ie&&a.win&&f.readyState!=4){var k=h("div");i+="SWFObjectNew";k.setAttribute("id",i);f.parentNode.insertBefore(k,f);f.style.display="none";(function(){if(f.readyState==4)f.parentNode.removeChild(f);else setTimeout(arguments.callee,10)})()}C(g,j,i)}}function P(b){if(a.ie&&a.win&&b.readyState!=4){var c=h("div");b.parentNode.insertBefore(c,b);c.parentNode.replaceChild(w(b),c);b.style.display="none";(function(){if(b.readyState==4)b.parentNode.removeChild(b);else setTimeout(arguments.callee,10)})()}else b.parentNode.replaceChild(w(b),b)}function w(f){var d=h("div");if(a.win&&a.ie)d.innerHTML=f.innerHTML;else{var e=f.getElementsByTagName(g)[0];if(e){var b=e.childNodes;if(b)for(var i=b.length,c=0;c<i;c++)!(b[c].nodeType==1&&b[c].nodeName=="PARAM")&&!(b[c].nodeType==8)&&d.appendChild(b[c].cloneNode(true))}}return d}function C(b,f,q){var n,l=e(q);if(a.wk&&a.wk<312)return n;if(l){if(typeof b.id==c)b.id=q;if(a.ie&&a.win){var o="";for(var d in b)if(b[d]!=Object.prototype[d])if(d.toLowerCase()=="data")f.movie=b[d];else if(d.toLowerCase()=="styleclass")o+=' class="'+b[d]+'"';else if(d.toLowerCase()!="classid")o+=" "+d+'="'+b[d]+'"';var p="";for(var m in f)if(f[m]!=Object.prototype[m])p+='<param name="'+m+'" value="'+f[m]+'" />';l.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+o+">"+p+"</object>";u[u.length]=b.id;n=e(b.id)}else{var j=h(g);j.setAttribute("type",s);for(var i in b)if(b[i]!=Object.prototype[i])if(i.toLowerCase()=="styleclass")j.setAttribute("class",b[i]);else i.toLowerCase()!="classid"&&j.setAttribute(i,b[i]);for(var k in f)f[k]!=Object.prototype[k]&&k.toLowerCase()!="movie"&&S(j,k,f[k]);l.parentNode.replaceChild(j,l);n=j}}return n}function S(d,c,b){var a=h("param");a.setAttribute("name",c);a.setAttribute("value",b);d.appendChild(a)}function M(c){var b=e(c);if(b&&b.nodeName=="OBJECT")if(a.ie&&a.win){b.style.display="none";(function(){if(b.readyState==4)R(c);else setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)}function R(c){var a=e(c);if(a){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}function e(c){var a=null;try{a=b.getElementById(c)}catch(d){}return a}function h(a){return b.createElement(a)}function T(b,a,c){b.attachEvent(a,c);n[n.length]=[b,a,c]}function r(d){var c=a.pv,b=d.split(".");b[0]=parseInt(b[0],10);b[1]=parseInt(b[1],10)||0;b[2]=parseInt(b[2],10)||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false}function L(k,j,d,m){if(a.ie&&a.mac)return;var l=b.getElementsByTagName("head")[0];if(!l)return;var e=d&&typeof d=="string"?d:"screen";if(m){f=null;v=null}if(!f||v!=e){var i=h("style");i.setAttribute("type","text/css");i.setAttribute("media",e);f=l.appendChild(i);if(a.ie&&a.win&&typeof b.styleSheets!=c&&b.styleSheets.length>0)f=b.styleSheets[b.styleSheets.length-1];v=e}if(a.ie&&a.win)f&&typeof f.addRule==g&&f.addRule(k,j);else f&&typeof b.createTextNode!=c&&f.appendChild(b.createTextNode(k+" {"+j+"}"))}function k(a,c){if(!K)return;var b=c?"visible":"hidden";if(l&&e(a))e(a).style.visibility=b;else L("#"+a,"visibility:"+b)}function E(a){var d=/[\\\"<>\.;]/,b=d.exec(a)!=null;return b&&typeof encodeURIComponent!=c?encodeURIComponent(a):a}var W=function(){a.ie&&a.win&&window.attachEvent("onunload",function(){for(var e=n.length,b=0;b<e;b++)n[b][0].detachEvent(n[b][1],n[b][2]);for(var d=u.length,c=0;c<d;c++)M(u[c]);for(var f in a)a[f]=null;a=null;for(var g in swfobject)swfobject[g]=null;swfobject=null})}();return {registerObject:function(c,e,f,d){if(a.w3&&c&&e){var b={};b.id=c;b.swfVersion=e;b.expressInstall=f;b.callbackFn=d;i[i.length]=b;k(c,false)}else d&&d({success:false,id:c})},getObjectById:function(b){if(a.w3)return A(b)},embedSWF:function(o,b,l,j,m,n,d,i,h,e){var f={success:false,id:b};if(a.w3&&!(a.wk&&a.wk<312)&&o&&b&&l&&j&&m){k(b,false);H(function(){l+="";j+="";var a={};if(h&&typeof h===g)for(var s in h)a[s]=h[s];a.data=o;a.width=l;a.height=j;var p={};if(i&&typeof i===g)for(var t in i)p[t]=i[t];if(d&&typeof d===g)for(var q in d)if(typeof p.flashvars!=c)p.flashvars+="&"+q+"="+d[q];else p.flashvars=q+"="+d[q];if(r(m)){var u=C(a,p,b);a.id==b&&k(b,true);f.success=true;f.ref=u}else if(n&&y()){a.data=n;x(a,p,b,e);return}else k(b,true);e&&e(f)})}else e&&e(f)},switchOffAutoHideShow:function(){K=false},ua:a,getFlashPlayerVersion:function(){return {major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:r,createSWF:function(c,d,b){if(a.w3)return C(c,d,b);else return undefined},showExpressInstall:function(d,e,b,c){a.w3&&y()&&x(d,e,b,c)},removeSWF:function(b){a.w3&&M(b)},createCSS:function(e,d,c,b){a.w3&&L(e,d,c,b)},addDomLoadEvent:H,addLoadEvent:J,getQueryParamValue:function(e){var c=b.location.search||b.location.hash;if(c){if(/\?/.test(c))c=c.split("?")[1];if(e==null)return E(c);for(var d=c.split("&"),a=0;a<d.length;a++)if(d[a].substring(0,d[a].indexOf("="))==e)return E(d[a].substring(d[a].indexOf("=")+1))}return ""},expressInstallCallback:function(){if(p){var b=e(F);if(b&&o){b.parentNode.replaceChild(o,b);if(q){k(q,true);if(a.ie&&a.win)o.style.display="block"}z&&z(G)}p=false}}}}()

/*****************************************************************************
scalable Inman Flash Replacement (sIFR) version 3, revision 436.

Copyright 2006 â€“ 2008 Mark Wubben, <http://novemberborn.net/>

Older versions:
* IFR by Shaun Inman
* sIFR 1.0 by Mike Davidson, Shaun Inman and Tomas Jogin
* sIFR 2.0 by Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben

See also <http://novemberborn.net/sifr3> and <http://wiki.novemberborn.net/sifr3>.

This software is licensed and provided under the CC-GNU LGPL.
See <http://creativecommons.org/licenses/LGPL/2.1/>
*****************************************************************************/

var sIFR = new function() {
  var self = this;

  var ClassNames  = {
    ACTIVE    : 'sIFR-active',
    REPLACED  : 'sIFR-replaced',
    IGNORE    : 'sIFR-ignore',
    ALTERNATE : 'sIFR-alternate',
    CLASS     : 'sIFR-class',
    LAYOUT    : 'sIFR-layout',
    FLASH     : 'sIFR-flash',
    FIX_FOCUS : 'sIFR-fixfocus',
    DUMMY     : 'sIFR-dummy'
  };
  
  ClassNames.IGNORE_CLASSES = [ClassNames.REPLACED, ClassNames.IGNORE, ClassNames.ALTERNATE];
  
  this.MIN_FONT_SIZE        = 6;
  this.MAX_FONT_SIZE        = 126;
  this.FLASH_PADDING_BOTTOM = 5;
  this.VERSION              = '436';

  this.isActive             = false;
  this.isEnabled            = true;
  this.fixHover             = true;
  this.autoInitialize       = true;
  this.setPrefetchCookie    = true;
  this.cookiePath           = '/';
  this.domains              = [];
  this.forceWidth           = true;
  this.fitExactly           = false;
  this.forceTextTransform   = true;
  this.useDomLoaded         = true;
  this.useStyleCheck        = false;
  this.hasFlashClassSet     = false;
  this.repaintOnResize      = true;
  this.replacements         = [];
  
  var elementCount          = 0; // The number of replaced elements.
  var isInitialized         = false;

  function Errors() {
    this.fire = function(id) {
      if(this[id + 'Alert']) alert(this[id + 'Alert']);
      throw new Error(this[id]);
    };
  
    this.isFile      = 'sIFR: Did not activate because the page is being loaded from the filesystem.';
    this.isFileAlert = 'Hi!\n\nThanks for using sIFR on your page. Unfortunately sIFR couldn\'t activate, because it was loaded '
                        + 'directly from your computer.\nDue to Flash security restrictions, you need to load sIFR through a web'
                        + ' server.\n\nWe apologize for the inconvenience.';
  };
  
  function Util(sIFR) {
    function capitalize($) {
      return $.toLocaleUpperCase();
    }
    
    this.normalize = function(str) {
      // Replace linebreaks and &nbsp; by whitespace, then normalize.
      // Flash doesn't support no-breaking space characters, hence they're replaced by a normal space.
      return str.replace(/\n|\r|\xA0/g, Util.SINGLE_WHITESPACE).replace(/\s+/g, Util.SINGLE_WHITESPACE);
    };
    
    this.textTransform = function(type, str) {
      switch(type) {
        case 'uppercase':
          return str.toLocaleUpperCase();
        case 'lowercase':
          return str.toLocaleLowerCase();
        case 'capitalize':
          return str.replace(/^\w|\s\w/g, capitalize);
      }
      return str;
    };
    
    this.toHexString = function(str) {
      if(str.charAt(0) != '#' || str.length != 4 && str.length != 7) return str;
      
      str = str.substring(1);
      return '0x' + (str.length == 3 ? str.replace(/(.)(.)(.)/, '$1$1$2$2$3$3') : str);
    };
    
    this.toJson = function(obj, strFunc) {
      var json = '';
  
      switch(typeof(obj)) {
        case 'string':
          json = '"' + strFunc(obj) + '"';
          break;
        case 'number':
        case 'boolean':
          json = obj.toString();
          break;
        case 'object':
          json = [];
          for(var prop in obj) {
            if(obj[prop] == Object.prototype[prop]) continue;
            json.push('"' + prop + '":' + this.toJson(obj[prop]));
          }
          json = '{' + json.join(',') + '}';
          break;
      }
  
      return json;
    };
  
    this.convertCssArg = function(arg) {
      if(!arg) return {};
      if(typeof(arg) == 'object') {
        if(arg.constructor == Array) arg = arg.join('');
        else return arg;
      }
  
      var obj = {};
      var rules = arg.split('}');
  
      for(var i = 0; i < rules.length; i++) {
        var $ = rules[i].match(/([^\s{]+)\s*\{(.+)\s*;?\s*/);
        if(!$ || $.length != 3) continue;
  
        if(!obj[$[1]]) obj[$[1]] = {};
  
        var properties = $[2].split(';');
        for(var j = 0; j < properties.length; j++) {
          var $2 = properties[j].match(/\s*([^:\s]+)\s*\:\s*([^;]+)/);
          if(!$2 || $2.length != 3) continue;
          obj[$[1]][$2[1]] = $2[2].replace(/\s+$/, '');
        }
      }
  
      return obj;
    };
  
    this.extractFromCss = function(css, selector, property, remove) {
      var value = null;
  
      if(css && css[selector] && css[selector][property]) {
        value = css[selector][property];
        if(remove) delete css[selector][property];
      }
  
      return value;
    };
    
    this.cssToString = function(arg) {
      var css = [];
      for(var selector in arg) {
        var rule = arg[selector];
        if(rule == Object.prototype[selector]) continue;
  
        css.push(selector, '{');
        for(var property in rule) {
          if(rule[property] == Object.prototype[property]) continue;
          var value = rule[property];
          if(Util.UNIT_REMOVAL_PROPERTIES[property]) value = parseInt(value, 10);
          css.push(property, ':', value, ';');
        }
        css.push('}');
      }
  
      return css.join('');
    };
  
    this.escape = function(str) {
      return escape(str).replace(/\+/g, '%2B');
    };
    
    this.encodeVars = function(vars) {
      return vars.join('&').replace(/%/g, '%25');
    };
    
    this.copyProperties = function(from, to) {
      for(var property in from) {
        if(to[property] === undefined) to[property] = from[property];
      }
      return to;
    };
    
    this.domain = function() {
      var domain = '';
      // When trying to access document.domain on a Google-translated page with Firebug, I got an exception. 
      // Try/catch to be safe.
      try { domain = document.domain } catch(e) {};
      return domain;
    };
    
    this.domainMatches = function(domain, match) {
      if(match == '*' || match == domain) return true;
  
      var wildcard = match.lastIndexOf('*');
      if(wildcard > -1) {
        match = match.substr(wildcard + 1);
        var matchPosition = domain.lastIndexOf(match);
        if(matchPosition > -1 && (matchPosition + match.length) == domain.length) return true;
      }
      
      return false;
    };
    
    this.uriEncode = function(s) {
      return encodeURI(decodeURIComponent(s));  // Decode first, in case the URI was already encoded.
    };
    
    this.delay = function(ms, func, scope) {
      var args = Array.prototype.slice.call(arguments, 3);
      setTimeout(function() { func.apply(scope, args) }, ms);
    };
  };
  
  Util.UNIT_REMOVAL_PROPERTIES = {leading: true, 'margin-left': true, 'margin-right': true, 'text-indent': true};
  Util.SINGLE_WHITESPACE       = ' ';
  
  
  function DomUtil(sIFR) {
    var self = this;
    
    function getDimensionFromStyle(node, property, offsetProperty)
    {
      var dimension = self.getStyleAsInt(node, property, sIFR.ua.ie);
      if(dimension == 0) {
        dimension = node[offsetProperty];
        for(var i = 3; i < arguments.length; i++) dimension -= self.getStyleAsInt(node, arguments[i], true);
      }
      return dimension;
    }
    
    this.getBody = function() {
      return document.getElementsByTagName('body')[0] || null;
    };
    
    this.querySelectorAll = function(selector) {
      return window.parseSelector(selector);
    };
  
    this.addClass = function(name, node) {
      if(node) node.className = ((node.className || '') == '' ? '' : node.className + ' ') + name;
    };
    
    this.removeClass = function(name, node) {
      if(node) node.className = node.className.replace(new RegExp('(^|\\s)' + name + '(\\s|$)'), '').replace(/^\s+|(\s)\s+/g, '$1');
    };
  
    this.hasClass = function(name, node) {
      return new RegExp('(^|\\s)' + name + '(\\s|$)').test(node.className);
    };
    
    this.hasOneOfClassses = function(names, node) {
      for(var i = 0; i < names.length; i++) {
        if(this.hasClass(names[i], node)) return true;
      }
      return false;
    };
    
    this.ancestorHasClass = function(node, name) {
      node = node.parentNode;
      while(node && node.nodeType == 1) {
        if(this.hasClass(name, node)) return true;
        node = node.parentNode;
      }
      return false;
    };
  
    this.create = function(name, className) {
      var node = document.createElementNS ? document.createElementNS(DomUtil.XHTML_NS, name) : document.createElement(name);
      if(className) node.className = className;
      return node;
    };
    
    this.getComputedStyle = function(node, property) {
      var result;
      if(document.defaultView && document.defaultView.getComputedStyle) {
        var style = document.defaultView.getComputedStyle(node, null);
        result = style ? style[property] : null;
      } else {
        if(node.currentStyle) result = node.currentStyle[property];
      }
      return result || ''; // Ensuring a string.
    };
  
    this.getStyleAsInt = function(node, property, requirePx) {
      var value = this.getComputedStyle(node, property);
      if(requirePx && !/px$/.test(value)) return 0;
      return parseInt(value) || 0;
    };
    
    this.getWidthFromStyle = function(node) {
      return getDimensionFromStyle(node, 'width', 'offsetWidth', 'paddingRight', 'paddingLeft', 'borderRightWidth', 'borderLeftWidth');
    };
  
    this.getHeightFromStyle = function(node) {
      return getDimensionFromStyle(node, 'height', 'offsetHeight', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth');
    };
  
    this.getDimensions = function(node) {
      var width  = node.offsetWidth;
      var height = node.offsetHeight;
      
      if(width == 0 || height == 0) {
        for(var i = 0; i < node.childNodes.length; i++) {
          var child = node.childNodes[i];
          if(child.nodeType != 1) continue;
          width  = Math.max(width, child.offsetWidth);
          height = Math.max(height, child.offsetHeight);
        }
      }
      
      return {width: width, height: height};
    };
    
    this.getViewport = function() {
      return {
        width:  window.innerWidth  || document.documentElement.clientWidth  || this.getBody().clientWidth,
        height: window.innerHeight || document.documentElement.clientHeight || this.getBody().clientHeight
      };
    };
    
    this.blurElement = function(element) {
      try {
        element.blur();
        return;
      } catch(e) {};
      
      // Move the focus to an input element, and then destroy it.
      var input = this.create('input');
      input.style.width  = '0px';
      input.style.height = '0px';
      element.parentNode.appendChild(input);
      input.focus();
      input.blur();
      input.parentNode.removeChild(input);
    };
  };
  
  DomUtil.XHTML_NS = 'http://www.w3.org/1999/xhtml';
  
  function UserAgentDetection(sIFR) {
    var ua              = navigator.userAgent.toLowerCase();
    var product         = (navigator.product || '').toLowerCase();
    var platform        = navigator.platform.toLowerCase();
  
    this.parseVersion = UserAgentDetection.parseVersion;
  
    this.macintosh        = /^mac/.test(platform);
    this.windows          = /^win/.test(platform);
    this.linux            = /^linux/.test(platform);
    this.quicktime        = false;
  
    this.opera            = /opera/.test(ua);
    this.konqueror        = /konqueror/.test(ua);
    this.ie               = false/*@cc_on || true @*/;
    this.ieSupported      = this.ie         && !/ppc|smartphone|iemobile|msie\s5\.5/.test(ua)/*@cc_on && @_jscript_version >= 5.5 @*/
    this.ieWin            = this.windows    && this.ie/*@cc_on && @_jscript_version >= 5.1 @*/;
    this.windows          = this.windows    && (!this.ie || this.ieWin);
    this.ieMac            = this.macintosh  && this.ie/*@cc_on && @_jscript_version < 5.1 @*/;
    this.macintosh        = this.macintosh  && (!this.ie || this.ieMac);
    this.safari           = /safari/.test(ua);
    this.webkit           = !this.konqueror && /applewebkit/.test(ua);
    this.khtml            = this.webkit     || this.konqueror;
    this.gecko            = !this.khtml     && product == 'gecko';
                          
    this.ieVersion        = this.ie         && /.*msie\s(\d\.\d)/.exec(ua)           ? this.parseVersion(RegExp.$1) : '0';
    this.operaVersion     = this.opera      && /.*opera(\s|\/)(\d+\.\d+)/.exec(ua)   ? this.parseVersion(RegExp.$2) : '0';
    this.webkitVersion    = this.webkit     && /.*applewebkit\/(\d+).*/.exec(ua)     ? this.parseVersion(RegExp.$1) : '0';
    this.geckoVersion     = this.gecko      && /.*rv:\s*([^\)]+)\)\s+gecko/.exec(ua) ? this.parseVersion(RegExp.$1) : '0';
    this.konquerorVersion = this.konqueror  && /.*konqueror\/([\d\.]+).*/.exec(ua)   ? this.parseVersion(RegExp.$1) : '0';
  
    this.flashVersion   = 0;
  
    if(this.ieWin) {
      var axo;
      var stop = false;
      try {
        axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
      } catch(e) {
        // In case the Flash 7 registry key does not exist, we need to test for specific 
        // Flash 6 installs before we can use the general key. 
        // See also <http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/>.
        // Many thanks to Geoff Stearns and Bobby van der Sluis for clarifying the problem and providing
        // examples of non-crashing code.
        try {
          axo                   = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
          this.flashVersion     = this.parseVersion('6');
          axo.AllowScriptAccess = 'always';
        } catch(e) { stop = this.flashVersion == this.parseVersion('6'); }
        
        if(!stop) try { axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); } catch(e) {}
      }
      
      if(!stop && axo) {
        this.flashVersion = this.parseVersion((axo.GetVariable('$version') || '').replace(/^\D+(\d+)\D+(\d+)\D+(\d+).*/g, '$1.$2.$3'));
      }
    } else if(navigator.plugins && navigator.plugins['Shockwave Flash']) {
      var d = navigator.plugins['Shockwave Flash'].description.replace(/^.*\s+(\S+\s+\S+$)/, '$1');
      var v = d.replace(/^\D*(\d+\.\d+).*$/, '$1');
      if(/r/.test(d)) v += d.replace(/^.*r(\d*).*$/, '.$1');
      else if(/d/.test(d)) v += '.0';
      this.flashVersion = this.parseVersion(v);
      
      // Watch out for QuickTime, which could be stealing the Flash handling! Also check to make sure the plugin for the Flash
      // MIMEType is enabled.
      var foundEnabled = false;
      for(var i = 0, valid = this.flashVersion >= UserAgentDetection.MIN_FLASH_VERSION; valid && i < navigator.mimeTypes.length; i++) {
        var mime = navigator.mimeTypes[i];
        if(mime.type != 'application/x-shockwave-flash') continue;
        if(mime.enabledPlugin) {
          foundEnabled = true;
          if(mime.enabledPlugin.description.toLowerCase().indexOf('quicktime') > -1) {
            valid = false;
            this.quicktime = true;
          }
        }
      }
      
      if(this.quicktime || !foundEnabled) this.flashVersion = this.parseVersion('0');
    }
    this.flash = this.flashVersion >= UserAgentDetection.MIN_FLASH_VERSION;
    this.transparencySupport  = this.macintosh || this.windows
                                               || this.linux && (
                                                    this.flashVersion >= this.parseVersion('10')
                                                    && (
                                                      this.gecko && this.geckoVersion >= this.parseVersion('1.9')
                                                      || this.opera
                                                    )
                                                  );
    this.computedStyleSupport = this.ie || !!document.defaultView.getComputedStyle;
    this.fixFocus             = this.gecko  && this.windows;
    this.nativeDomLoaded      = this.gecko  || this.webkit    && this.webkitVersion  >= this.parseVersion('525')
                                            || this.konqueror && this.konquerorMajor >  this.parseVersion('03') || this.opera;
    this.mustCheckStyle       = this.khtml  || this.opera;
    this.forcePageLoad        = this.webkit && this.webkitVersion < this.parseVersion('523')
    this.properDocument       = typeof(document.location) == 'object';
  
    this.supported            = this.flash  && this.properDocument && (!this.ie || this.ieSupported) && this.computedStyleSupport
                                            && (!this.opera  || this.operaVersion  >= this.parseVersion('9.61')) 
                                            && (!this.webkit || this.webkitVersion >= this.parseVersion('412'))
                                            && (!this.gecko  || this.geckoVersion  >= this.parseVersion('1.8.0.12'))
                                            && (!this.konqueror/* || this.konquerorVersion >= this.parseVersion('4.1')*/);
  };
  
  UserAgentDetection.parseVersion = function(s) {
    return s.replace(
      /(^|\D)(\d+)(?=\D|$)/g,
      function(s, nonDigit, digits) {
        s = nonDigit;
        for(var i = 4 - digits.length; i >= 0; i--) s += '0';
        return s + digits;
      }
    );
  };
  UserAgentDetection.MIN_FLASH_VERSION = UserAgentDetection.parseVersion('8');
  
  function FragmentIdentifier(sIFR) {
    this.fix = sIFR.ua.ieWin && window.location.hash != '';
  
    var cachedTitle;
    this.cache = function() {
      cachedTitle = document.title;
    };
  
    function doFix() {
      document.title = cachedTitle;
    }
  
    this.restore = function() {
      if(this.fix) setTimeout(doFix, 0);
    };
  };
  function PageLoad(sIFR) {
    var dummy = null;
    
    function pollLoad() {
      try {
        // IE hack courtesy of Diego Perini â€“ <http://javascript.nwbox.com/IEContentLoaded/>.
        // Merged polling taken from jQuery â€“ <http://dev.jquery.com/browser/trunk/jquery/src/event.js>
        if(sIFR.ua.ie || document.readyState != 'loaded' && document.readyState != 'complete') {
          document.documentElement.doScroll('left');
        }
      } catch(e) {
        return setTimeout(pollLoad, 10);
      }
      afterDomLoad();
    };
    
    function afterDomLoad() {
      if(sIFR.useStyleCheck) checkStyle();
      else if(!sIFR.ua.mustCheckStyle) fire(null, true);
    };
    
    function checkStyle() {
      dummy = sIFR.dom.create("div", ClassNames.DUMMY);
      sIFR.dom.getBody().appendChild(dummy);
      pollStyle();
    };
    
    function pollStyle() {
      if(sIFR.dom.getComputedStyle(dummy, 'marginLeft') == '42px') afterStyle();
      else setTimeout(pollStyle, 10);
    };
    
    function afterStyle() {
      if(dummy && dummy.parentNode) dummy.parentNode.removeChild(dummy);
      dummy = null;
      fire(null, true);
    };
    
    function fire(evt, preserveReplacements) {
      sIFR.initialize(preserveReplacements);
      
      // Remove handlers to prevent memory leak in Firefox 1.5, but only after onload.
      if(evt && evt.type == 'load') {
        if(document.removeEventListener) document.removeEventListener('DOMContentLoaded', fire, false);
        if(window.removeEventListener) window.removeEventListener('load', fire, false);
      }
    };
    
    // Unload detection based on the research from Moxiecode. <http://blog.moxiecode.com/2008/04/08/unload-event-never-fires-in-ie/>
    function verifyUnload() {
      sIFR.prepareClearReferences();
      if(document.readyState == 'interactive') {
        document.attachEvent('onstop', unloadByStop);
        setTimeout(function() { document.detachEvent('onstop', unloadByStop) }, 0);
      }
    };
    
    function unloadByStop() {
      document.detachEvent('onstop', unloadByStop);
      fireUnload();
    };
    
    function fireUnload() {
      sIFR.clearReferences();
    };
    
    this.attach = function() {
      if(window.addEventListener) window.addEventListener('load', fire, false);
      else window.attachEvent('onload', fire);
      
      if(!sIFR.useDomLoaded || sIFR.ua.forcePageLoad || sIFR.ua.ie && window.top != window) return;
      
      if(sIFR.ua.nativeDomLoaded) {
        document.addEventListener('DOMContentLoaded', afterDomLoad, false);
      } else if(sIFR.ua.ie || sIFR.ua.khtml) {
        pollLoad();
      } 
    };
    
    this.attachUnload = function() {
      if(!sIFR.ua.ie) return;
      window.attachEvent('onbeforeunload', verifyUnload);
      window.attachEvent('onunload', fireUnload);
    }
  };
  
  var PREFETCH_COOKIE = 'sifrFetch';
  
  function Prefetch(sIFR) {
    var hasPrefetched = false;
    
    this.fetchMovies = function(movies) {
      if(sIFR.setPrefetchCookie && new RegExp(';?' + PREFETCH_COOKIE + '=true;?').test(document.cookie)) return;
  
      try { // We don't know which DOM actions the user agent will allow
        hasPrefetched = true;
        prefetch(movies);
      } catch(e) {}
  
      if(sIFR.setPrefetchCookie) document.cookie = PREFETCH_COOKIE + '=true;path=' + sIFR.cookiePath;
    };
  
    this.clear = function() {
      if(!hasPrefetched) return;
  
      try {
        var nodes = document.getElementsByTagName('script');
        for(var i = nodes.length - 1; i >= 0; i--) {
          var node = nodes[i];
          if(node.type == 'sifr/prefetch') node.parentNode.removeChild(node);
        }
      } catch(e) {}
    };
    
    function prefetch(args) {
      for(var i = 0; i < args.length; i++) {
        document.write('<scr' + 'ipt defer type="sifr/prefetch" src="' + args[i].src + '"></' + 'script>');
      }
    }
  };
  
  function BrokenFlashIE(sIFR) {
    var active      = sIFR.ua.ie;
    var fixFlash    = active && sIFR.ua.flashVersion < sIFR.ua.parseVersion('9.0.115');
    var resetMovies = {};
    var registry    = {};
    
    this.fixFlash = fixFlash;
    
    this.register = function(flashNode) {
      if(!active) return;
      
      var id = flashNode.getAttribute('id');
      // Try cleaning up previous Flash <object>
      this.cleanup(id, false);
      
      registry[id] = flashNode;
      delete resetMovies[id];
      
      if(fixFlash) window[id] = flashNode;
    };
    
    this.reset = function() {
      if(!active) return false;
      
      for(var i = 0; i < sIFR.replacements.length; i++) {
        var flash = sIFR.replacements[i];
        var flashNode = registry[flash.id];
        if(!resetMovies[flash.id] && (!flashNode.parentNode || flashNode.parentNode.nodeType == 11)) {
          flash.resetMovie();
          resetMovies[flash.id] = true;
        }
      }
      
      return true;
    };
    
    this.cleanup = function(id, usePlaceholder) {
      var node = registry[id];
      if(!node) return;
      
      for(var expando in node) {
        if(typeof(node[expando]) == 'function') node[expando] = null;
      }
      registry[id] = null;
      if(fixFlash) window[id] = null;
      
      if(node.parentNode) {
        if(usePlaceholder && node.parentNode.nodeType == 1) {
          // Replace the Flash node by a placeholde element with the same dimensions. This stops the page from collapsing
          // when the Flash movies are removed.
          var placeholder          = document.createElement('div');
          placeholder.style.width  = node.offsetWidth  + 'px';
          placeholder.style.height = node.offsetHeight + 'px';
          node.parentNode.replaceChild(placeholder, node);
        } else {
          node.parentNode.removeChild(node);
        }
      }
    };
    
    this.prepareClearReferences = function() {
      if(!fixFlash) return;
      
      // Disable Flash cleanup, see <http://blog.deconcept.com/2006/05/18/flash-player-bug-streaming-content-innerhtml-ie/>
      // for more info.
      __flash_unloadHandler      = function(){};
      __flash_savedUnloadHandler = function(){};
    };
    
    this.clearReferences = function() {
      // Since we've disabled Flash' own cleanup, add all objects on the page to our registry so they can be cleaned up.
      if(fixFlash) {
        var objects = document.getElementsByTagName('object');
        for(var i = objects.length - 1; i >= 0; i--) registry[objects[i].getAttribute('id')] = objects[i];
      }
      
      for(var id in registry) {
        if(Object.prototype[id] != registry[id]) this.cleanup(id, true);
      }
    };
  }
  
  function FlashInteractor(sIFR, id, vars, forceWidth, events) {
    this.sIFR         = sIFR;
    this.id           = id;
    this.vars         = vars;
    // Type of value depends on SWF builder. This could use some improvement!
    this.movie        = null;
    
    this.__forceWidth = forceWidth;
    this.__events     = events;
    this.__resizing   = 0;
  }
  
  FlashInteractor.prototype = {
    getFlashElement: function() {
      return document.getElementById(this.id);
    },
    
    getAlternate: function() {
      return document.getElementById(this.id + '_alternate');
    },
    
    getAncestor: function() {
      var ancestor = this.getFlashElement().parentNode;
      return !this.sIFR.dom.hasClass(ClassNames.FIX_FOCUS, ancestor) ? ancestor : ancestor.parentNode;
    },
    
    available: function() {
      var flashNode = this.getFlashElement();
      return flashNode && flashNode.parentNode;
    },
    
    call: function(type) {
      var flashNode = this.getFlashElement();
      
      if (!flashNode[type]) {
        return false;
      }
      // In Firefox 2, exposed Flash methods aren't proper functions, there's no `apply()` method! This workaround
      // does work, though.
      return Function.prototype.apply.call(flashNode[type], flashNode, Array.prototype.slice.call(arguments, 1));
    },
    
    attempt: function() {
      if(!this.available()) return false;
      
      try {
        this.call.apply(this, arguments);
      } catch(e) {
        if(this.sIFR.debug) throw e;
        return false;
      }
      
      return true;
    },
    
    updateVars: function(name, value) {
      for(var i = 0; i < this.vars.length; i++) {
        if (this.vars[i].split('=')[0] == name) {
          this.vars[i] = name + '=' + value;
          break;
        }
      }
      
      var vars = this.sIFR.util.encodeVars(this.vars);
      this.movie.injectVars(this.getFlashElement(), vars);
      this.movie.injectVars(this.movie.html, vars);
    },
    
    storeSize: function(type, value) {
      this.movie.setSize(type, value);
      this.updateVars(type, value);
    },
    
    fireEvent: function(name) {
      if(this.available() && this.__events[name]) this.sIFR.util.delay(0, this.__events[name], this, this);
    },
    
    resizeFlashElement: function(height, width, firstResize) {
      if(!this.available()) return;
      
      this.__resizing++;
      
      var flashNode = this.getFlashElement();
      flashNode.setAttribute('height', height);
      
      // Reset element height as declared by `MovieCreator`
      this.getAncestor().style.minHeight = '';
      
      this.updateVars('renderheight', height);
      this.storeSize('height', height);
      if(width !== null) {
        flashNode.setAttribute('width', width);
        // Don't store the size, it may cause Flash to wrap the text when the movie is reset.
        this.movie.setSize('width', width);
      }
      if(this.__events.onReplacement) {
        this.sIFR.util.delay(0, this.__events.onReplacement, this, this);
        delete this.__events.onReplacement;
      }
      
      if(firstResize) {
        this.sIFR.util.delay(0, function() {
          this.attempt('scaleMovie');
          this.__resizing--;
        }, this);
      } else {
        this.__resizing--;
      }
    },
    
    blurFlashElement: function() {
      if(this.available()) this.sIFR.dom.blurElement(this.getFlashElement());
    },
    
    resetMovie: function() {
      this.sIFR.util.delay(0, this.movie.reset, this.movie, this.getFlashElement(), this.getAlternate());
    },
    
    resizeAfterScale: function() {
      if(this.available() && this.__resizing == 0) this.sIFR.util.delay(0, this.resize, this);
    },
    
    resize: function() {
      if(!this.available()) return;
      
      this.__resizing++;
      
      var flashNode      = this.getFlashElement();
      var currentWidth   = flashNode.offsetWidth;
      
      // The Flash movie has no dimensions, which means it's not visible anyway. No need to recalculate.
      if(currentWidth == 0) return;
      
      var originalWidth  = flashNode.getAttribute('width');
      var originalHeight = flashNode.getAttribute('height');
      
      var ancestor       = this.getAncestor();
      var minHeight      = this.sIFR.dom.getHeightFromStyle(ancestor);
      
      // Remove Flash movie from flow
      flashNode.style.width  = '1px';
      flashNode.style.height = '1px';
      
      // Set a minimal height on the flashNode's parent, to stop a reflow
      ancestor.style.minHeight = minHeight + 'px';
      
      // Restore original content
      var nodes = this.getAlternate().childNodes;
      var clones = [];
      for(var i = 0; i < nodes.length; i++) {
        var node = nodes[i].cloneNode(true);
        clones.push(node);
        ancestor.appendChild(node);
      }
      
      // Calculate width
      var width = this.sIFR.dom.getWidthFromStyle(ancestor);
      
      // Remove original content again
      for(var i = 0; i < clones.length; i++) ancestor.removeChild(clones[i]);
      
      // Reset Flash movie flow
      flashNode.style.width = flashNode.style.height = ancestor.style.minHeight = '';
      flashNode.setAttribute('width', this.__forceWidth ? width : originalWidth);
      flashNode.setAttribute('height', originalHeight);
      
      // IE can get mightily confused about where to draw the Flash <object>. This is a workaround to force IE to repaint
      // the <object>.
      if(sIFR.ua.ie) {
        flashNode.style.display = 'none';
        var repaint = flashNode.offsetHeight;
        flashNode.style.display = '';
      }
      
      // Resize!
      if(width != currentWidth) {
        if(this.__forceWidth) this.storeSize('width', width);
        this.attempt('resize', width);
      }
      
      this.__resizing--;
    },
    
    // `content` must not be util.escaped when passed in.
    // alternate may be an array of nodes to be appended to the alternate content, use this
    // in XHTML documents.
    replaceText: function(content, alternate) {
      var escapedContent = this.sIFR.util.escape(content);
      if(!this.attempt('replaceText', escapedContent)) return false;
      
      this.updateVars('content', escapedContent);
      var node = this.getAlternate();
      if(alternate) {
        while(node.firstChild) node.removeChild(node.firstChild);
        for(var i = 0; i < alternate.length; i++) node.appendChild(alternate[i]);
      } else {
        try { node.innerHTML = content; } catch(e) {};
      }
      
      return true;
    },
    
    changeCSS: function(css) {
      css = this.sIFR.util.escape(this.sIFR.util.cssToString(this.sIFR.util.convertCssArg(css)));
      this.updateVars('css', css);
      return this.attempt('changeCSS', css);
    },
    
    remove: function() {
      if(this.movie && this.available()) this.movie.remove(this.getFlashElement(), this.id);
    }
  };
  
  var MovieCreator = new function() {
    this.create = function(sIFR, brokenFlash, node, fixFocus, id, src, width, height, vars, wmode, backgroundColor) {
      var klass = sIFR.ua.ie ? IEFlashMovie : FlashMovie;
      return new klass(
        sIFR, brokenFlash, node, fixFocus, 
        id, src, width, height, 
        ['flashvars', vars, 'wmode', wmode, 'bgcolor', backgroundColor, 'allowScriptAccess', 'always', 'quality', 'best']
      );
    }
    
    function FlashMovie(sIFR, brokenFlash, node, fixFocus, id, src, width, height, params) {
      var object = sIFR.dom.create('object', ClassNames.FLASH);
      var attrs  = ['type', 'application/x-shockwave-flash', 'id', id, 'name', id, 'data', src, 'width', width, 'height', height];
      for(var i = 0; i < attrs.length; i += 2) object.setAttribute(attrs[i], attrs[i + 1]);
      
      var insertion = object;
      if(fixFocus) {
        insertion = dom.create("div", ClassNames.FIX_FOCUS);
        insertion.appendChild(object);
      }
      
      for(var i = 0; i < params.length; i+=2) {
        if(params[i] == 'name') continue;
        
        var param = dom.create('param');
        param.setAttribute('name', params[i]);
        param.setAttribute('value', params[i + 1]);
        object.appendChild(param);
      }
      
      // Before removing the existing content, set its height such that the element
      // does not collapse. Height is restored in `FlashInteractor#resizeFlashElement`.
      node.style.minHeight = height + 'px';
      
      while(node.firstChild) node.removeChild(node.firstChild);
      node.appendChild(insertion);
      
      this.html = insertion.cloneNode(true);
    }
    
    FlashMovie.prototype = {
      reset: function(flashNode, alternate) {
        flashNode.parentNode.replaceChild(this.html.cloneNode(true), flashNode);
      },
      
      remove: function(flashNode, id) {
        flashNode.parentNode.removeChild(flashNode);
      },
      
      setSize: function(type, value) {
        this.html.setAttribute(type, value);
      },
      
      injectVars: function(flash, encodedVars) {
        var params = flash.getElementsByTagName('param');
        for(var i = 0; i < params.length; i++) {
          if(params[i].getAttribute('name') == 'flashvars') {
            params[i].setAttribute('value', encodedVars);
            break;
          }
        }
      }
    };
    
    function IEFlashMovie(sIFR, brokenFlash, node, fixFocus, id, src, width, height, params) {
      this.dom    = sIFR.dom;
      this.broken = brokenFlash;
      
      this.html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + id +
        '" width="' + width + '" height="' + height + '" class="' + ClassNames.FLASH + '">' +
        '<param name="movie" value="' + src + '"></param></object>'
        ;
      var paramsHtml = '';
      for(var i = 0; i < params.length; i+=2) {
        paramsHtml += '<param name="' + params[i] + '" value="' + params[i + 1] + '"></param>';
      }
      this.html      = this.html.replace(/(<\/object>)/, paramsHtml + '$1');
      
      // Before removing the existing content, set its height such that the element
      // does not collapse. Height is restored in `FlashInteractor#resizeFlashElement`.
      node.style.minHeight = height + 'px';
      
      node.innerHTML = this.html;
      
      this.broken.register(node.firstChild);
    }
    
    IEFlashMovie.prototype = {
      reset: function(flashNode, alternate) {
        alternate            = alternate.cloneNode(true);
        var parent           = flashNode.parentNode;
        parent.innerHTML     = this.html;
        this.broken.register(parent.firstChild);
        parent.appendChild(alternate);
      },
      
      remove: function(flashNode, id) {
        this.broken.cleanup(id);
      },
      
      setSize: function(type, value) {
         this.html = this.html.replace(type == 'height' ? /(height)="\d+"/ : /(width)="\d+"/, '$1="' + value + '"');
      },
      
      injectVars: function(flash, encodedVars) {
        if(flash != this.html) return;
        this.html = this.html.replace(/(flashvars(=|\"\svalue=)\")[^\"]+/, '$1' + encodedVars);
      }
    };
  }
  
  this.errors =             new Errors(self);
  var util    = this.util = new Util(self);
  var dom     = this.dom  = new DomUtil(self);
  var ua      = this.ua   = new UserAgentDetection(self);
  var hacks   = {
    fragmentIdentifier:     new FragmentIdentifier(self),
    pageLoad:               new PageLoad(self),
    prefetch:               new Prefetch(self),
    brokenFlashIE:          new BrokenFlashIE(self)
  };
  this.__resetBrokenMovies = hacks.brokenFlashIE.reset;
  
  var replaceKwargsStore = {
    kwargs: [],
    replaceAll:  function(preserve) {
      for(var i = 0; i < this.kwargs.length; i++) self.replace(this.kwargs[i]);
      if(!preserve) this.kwargs = [];
    }
  };
  
  this.activate = function(/* â€¦ */) {
    if(!ua.supported || !this.isEnabled || this.isActive || !isValidDomain() || isFile()) return;
    hacks.prefetch.fetchMovies(arguments);
    
    this.isActive = true;
    this.setFlashClass();
    hacks.fragmentIdentifier.cache();
    hacks.pageLoad.attachUnload();
    
    if(!this.autoInitialize) return;
    
    hacks.pageLoad.attach();
  };
  
  this.setFlashClass = function() {
    if(this.hasFlashClassSet) return;
    
    dom.addClass(ClassNames.ACTIVE, dom.getBody() || document.documentElement);
    this.hasFlashClassSet = true;
  };
  
  this.removeFlashClass = function() {
    if(!this.hasFlashClassSet) return;
    
    dom.removeClass(ClassNames.ACTIVE, dom.getBody());
    dom.removeClass(ClassNames.ACTIVE, document.documentElement);
    this.hasFlashClassSet = false;
  };
  
  this.initialize = function(preserveReplacements) {
    if(!this.isActive || !this.isEnabled) return;
    if(isInitialized) {
      if(!preserveReplacements) replaceKwargsStore.replaceAll(false);
      return;
    }
    
    isInitialized = true;
    replaceKwargsStore.replaceAll(preserveReplacements);
    
    if(self.repaintOnResize) {
      if(window.addEventListener) window.addEventListener('resize', resize, false);
      else window.attachEvent('onresize', resize);
    }
    
    hacks.prefetch.clear();
  };
  
  this.replace = function(kwargs, mergeKwargs) {
    if(!ua.supported) return;
    
    // This lets you specify two kwarg objects so you don't have to repeat common settings.
    // The first object will be merged with the second, while properties in the second 
    // object have priority over those in the first. The first object is unmodified
    // for further use, the resulting second object will be used in the replacement.
    if(mergeKwargs) kwargs = util.copyProperties(kwargs, mergeKwargs);
    
    if(!isInitialized) return replaceKwargsStore.kwargs.push(kwargs);
    
    if(this.onReplacementStart) this.onReplacementStart(kwargs);
    
    var nodes = kwargs.elements || dom.querySelectorAll(kwargs.selector);
    if(nodes.length == 0) return;
    
    var src             = getSource(kwargs.src);
    var css             = util.convertCssArg(kwargs.css);
    var filters         = getFilters(kwargs.filters);
    
    var forceSingleLine = kwargs.forceSingleLine === true;
    var preventWrap     = kwargs.preventWrap === true && !forceSingleLine;
    var fitExactly      = forceSingleLine || (kwargs.fitExactly == null ? this.fitExactly : kwargs.fitExactly) === true;
    var forceWidth      = fitExactly || (kwargs.forceWidth == null ? this.forceWidth : kwargs.forceWidth) === true;
    var ratios          = kwargs.ratios || [];
    var pixelFont       = kwargs.pixelFont === true;
    var tuneHeight      = parseInt(kwargs.tuneHeight) || 0;
    var events          = !!kwargs.onRelease || !!kwargs.onRollOver || !!kwargs.onRollOut;
    
    // Alignment should be handled by the browser in this case.
    if(fitExactly) util.extractFromCss(css, '.sIFR-root', 'text-align', true);
    
    var fontSize        = util.extractFromCss(css, '.sIFR-root', 'font-size', true)        || '0';
    var backgroundColor = util.extractFromCss(css, '.sIFR-root', 'background-color', true) || '#FFFFFF';
    var kerning         = util.extractFromCss(css, '.sIFR-root', 'kerning', true)          || '';
    var opacity         = util.extractFromCss(css, '.sIFR-root', 'opacity', true)          || '100';
    var cursor          = util.extractFromCss(css, '.sIFR-root', 'cursor', true)           || 'default';
    var leading         = parseInt(util.extractFromCss(css, '.sIFR-root', 'leading'))      || 0;
    var gridFitType     = kwargs.gridFitType ||
                            (util.extractFromCss(css, '.sIFR-root', 'text-align') == 'right') ? 'subpixel' : 'pixel';
    var textTransform   = this.forceTextTransform === false 
                            ? 'none'
                            : util.extractFromCss(css, '.sIFR-root', 'text-transform', true) || 'none';
    // Only font sizes specified in pixels are supported.
    fontSize            = /^\d+(px)?$/.test(fontSize) ? parseInt(fontSize) : 0;
    // Make sure to support percentages and decimals
    opacity             = parseFloat(opacity) < 1 ? 100 * parseFloat(opacity) : opacity;
    
    var cssText = kwargs.modifyCss ? '' : util.cssToString(css);
    var wmode   = kwargs.wmode || '';
    if(!wmode) {
      if(kwargs.transparent) wmode = 'transparent';
      else if(kwargs.opaque) wmode = 'opaque';
    } 
    if(wmode == 'transparent') {
      if(!ua.transparencySupport) wmode = 'opaque';
      else backgroundColor = 'transparent';
    } else if(backgroundColor == 'transparent') {
      backgroundColor = '#FFFFFF';
    }
    
    for(var i = 0; i < nodes.length; i++) {
      var node = nodes[i];
      
      if(dom.hasOneOfClassses(ClassNames.IGNORE_CLASSES, node) || dom.ancestorHasClass(node, ClassNames.ALTERNATE)) continue;
      
      // Opera does not allow communication with hidden Flash movies. Visibility is tackled by sIFR itself, but
      // `display:none` isn't. Additionally, WebKit does not return computed style information for elements with
      // `display:none`. We'll prevent elements which have `display:none` or are contained in such an element from
      // being replaced. It's a bit hard to detect this, but we'll check for the dimensions of the element and its
      // `display` property.
      
      var dimensions = dom.getDimensions(node);
      var height     = dimensions.height;
      var width      = dimensions.width;
      var display    = dom.getComputedStyle(node, 'display');
      
      if(!height || !width || !display || display == 'none') continue;
      
      // Get the width (to approximate the final size).
      width = dom.getWidthFromStyle(node);
      
      var size, lines;
      if(!fontSize) {
        var calculation    = calculate(node);
        size               = Math.min(this.MAX_FONT_SIZE, Math.max(this.MIN_FONT_SIZE, calculation.fontSize));
        if(pixelFont) size = Math.max(8, 8 * Math.round(size / 8));
        
        lines = calculation.lines;
      } else {
        size  = fontSize;
        lines = 1;
      }
      
      var alternate = dom.create('span', ClassNames.ALTERNATE);
      // Clone the original content to the alternate element.
      var contentNode = node.cloneNode(true);
      // Temporarily append the contentNode to the document, to get around IE problems with resolved hrefs
      node.parentNode.appendChild(contentNode);
      for(var j = 0, l = contentNode.childNodes.length; j < l; j++) {
        var child = contentNode.childNodes[j];
        // Let's not keep <style> or <script> in the alternate content, since it may be
        // reintroduced to the DOM after resizing.
        if (!/^(style|script)$/i.test(child.nodeName)) {
          alternate.appendChild(child.cloneNode(true));
        }
      }
      
      // Allow the sIFR content to be modified
      if(kwargs.modifyContent) kwargs.modifyContent(contentNode, kwargs.selector);
      if(kwargs.modifyCss) cssText = kwargs.modifyCss(css, contentNode, kwargs.selector);
      
      var content = parseContent(contentNode, textTransform, kwargs.uriEncode);
      // Remove the contentNode again
      contentNode.parentNode.removeChild(contentNode);
      if(kwargs.modifyContentString) content.text = kwargs.modifyContentString(content.text, kwargs.selector);
      if(content.text == '') continue;
      
      // Approximate the final height to avoid annoying movements of the page
      var renderHeight = Math.round(lines * getRatio(size, ratios) * size) + this.FLASH_PADDING_BOTTOM + tuneHeight;
      if (lines > 1 && leading) {
        renderHeight += Math.round((lines - 1) * leading);
      }
      
      var forcedWidth = forceWidth ? width : '100%';
      
      var id   = 'sIFR_replacement_' + elementCount++;
      var vars = ['id='              + id,
                  'content='         + util.escape(content.text),
                  'width='           + width,
                  'renderheight='    + renderHeight, 
                  'link='            + util.escape(content.primaryLink.href   || ''),
                  'target='          + util.escape(content.primaryLink.target || ''),
                  'size='            + size, 
                  'css='             + util.escape(cssText),
                  'cursor='          + cursor,
                  'tunewidth='       + (kwargs.tuneWidth || 0),
                  'tuneheight='      + tuneHeight,
                  'offsetleft='      + (kwargs.offsetLeft || ''),
                  'offsettop='       + (kwargs.offsetTop  || ''),
                  'fitexactly='      + fitExactly,
                  'preventwrap='     + preventWrap,
                  'forcesingleline=' + forceSingleLine,
                  'antialiastype='   + (kwargs.antiAliasType || ''),
                  'thickness='       + (kwargs.thickness || ''),
                  'sharpness='       + (kwargs.sharpness || ''),
                  'kerning='         + kerning,
                  'gridfittype='     + gridFitType,
                  'flashfilters='    + filters,
                  'opacity='         + opacity,
                  'blendmode='       + (kwargs.blendMode || ''), 
                  'selectable='      + (kwargs.selectable == null || wmode != '' && !sIFR.ua.macintosh && sIFR.ua.gecko && sIFR.ua.geckoVersion >= sIFR.ua.parseVersion('1.9')
                                         ? 'true' 
                                         : kwargs.selectable === true
                                       ),
                  'fixhover='        + (this.fixHover === true),
                  'events='          + events,
                  'delayrun='        + hacks.brokenFlashIE.fixFlash,
                  'version='         + this.VERSION];
      
      var encodedVars = util.encodeVars(vars);
      var interactor  = new FlashInteractor(self, id, vars, forceWidth, {
        onReplacement: kwargs.onReplacement,
        onRollOver: kwargs.onRollOver,
        onRollOut: kwargs.onRollOut,
        onRelease: kwargs.onRelease
      });
      interactor.movie = MovieCreator.create(
        sIFR, hacks.brokenFlashIE, node, ua.fixFocus && kwargs.fixFocus, 
        id, src, forcedWidth, renderHeight, 
        encodedVars, wmode, backgroundColor
      );
      this.replacements.push(interactor);
      this.replacements[id] = interactor;
      if(kwargs.selector) {
        if(!this.replacements[kwargs.selector]) this.replacements[kwargs.selector] = [interactor];
        else this.replacements[kwargs.selector].push(interactor);
      }
      alternate.setAttribute('id', id + '_alternate');
      node.appendChild(alternate);
      dom.addClass(ClassNames.REPLACED, node);
    }
    
    hacks.fragmentIdentifier.restore();
  };
  
  this.getReplacementByFlashElement = function(node) {
    for(var i = 0; i < self.replacements.length; i++) {
      if(self.replacements[i].id == node.getAttribute('id')) return self.replacements[i];
    }
  };
  
  this.redraw = function() {
    for(var i = 0; i < self.replacements.length; i++) self.replacements[i].resetMovie();
  };
  
  this.prepareClearReferences = function() {
    hacks.brokenFlashIE.prepareClearReferences();
  };
  
  this.clearReferences = function() {
    hacks.brokenFlashIE.clearReferences();
    hacks = null;
    replaceKwargsStore = null;
    delete self.replacements;
  };
  
  // The goal here is not to prevent usage of the Flash movie, but running sIFR on possibly translated pages
  function isValidDomain() {
    if(self.domains.length == 0) return true;
    
    var domain = util.domain();
    for(var i = 0; i < self.domains.length; i++) {
      if(util.domainMatches(domain, self.domains[i])) {
        return true;
      }
    }
    
    return false;
  }
  
  function isFile() {
    if(document.location.protocol == 'file:') {
      if(self.debug) self.errors.fire('isFile');
      return true;
    }
    return false;
  }
  
  function getSource(src) {
    if(ua.ie && src.charAt(0) == '/') {
      src = window.location.toString().replace(/([^:]+)(:\/?\/?)([^\/]+).*/, '$1$2$3') + src;
    }
    
    return src;
  }
  
  // Gives a font-size to required vertical space ratio
  function getRatio(size, ratios) {
    for(var i = 0; i < ratios.length; i += 2) {
      if(size <= ratios[i]) return ratios[i + 1];
    }
    return ratios[ratios.length - 1] || 1;
  }
  
  function getFilters(obj) {
    var filters = [];
    for(var filter in obj) {
      if(obj[filter] == Object.prototype[filter]) continue;
      
      var properties = obj[filter];
      filter = [filter.replace(/filter/i, '') + 'Filter'];
      
      for(var property in properties) {
        if(properties[property] == Object.prototype[property]) continue;
        // Double-escaping (see end of function) makes it easier to parse the resulting string
        // in AS.
        filter.push(property + ':' + util.escape(util.toJson(properties[property], util.toHexString)));
      }
      
      filters.push(filter.join(','));
    }
    
    return util.escape(filters.join(';'));
  }
  
  function resize(evt) {
    var current  = resize.viewport;
    var viewport = dom.getViewport();
    
    if(current && viewport.width == current.width && viewport.height == current.height) return;
    resize.viewport = viewport;
    
    if(self.replacements.length == 0) return; // Nothing replaced yet, resize event is not important.
    
    if(resize.timer) clearTimeout(resize.timer);
    resize.timer = setTimeout(function() {
      delete resize.timer;
      for(var i = 0; i < self.replacements.length; i++) self.replacements[i].resize();
    }, 200);
  }
  
  function calculate(node) {
    var fontSize = dom.getComputedStyle(node, 'fontSize');
    var deduce = fontSize.indexOf('px') == -1;
    
    var html = node.innerHTML;
    if (deduce) {
      node.innerHTML = 'X';
    }
    
    // Reset padding and border, so offsetHeight works properly
    node.style.paddingTop = node.style.paddingBottom = node.style.borderTopWidth = node.style.borderBottomWidth = '0px';
    // 2em magically makes offsetHeight correct in IE
    node.style.lineHeight = '2em';
    // Provided display is block
    node.style.display = 'block';
    
    fontSize = deduce ? node.offsetHeight / 2 : parseInt(fontSize, 10);
    
    if (deduce) {
      node.innerHTML = html;
    }
    
    var lines = Math.round(node.offsetHeight / (2 * fontSize));
    
    node.style.paddingTop = node.style.paddingBottom = node.style.borderTopWidth = node.style.borderBottomWidth
                          = node.style.lineHeight = node.style.display = '';
    
    if (isNaN(lines) || !isFinite(lines) || lines == 0) {
      lines = 1;
    }
    
    return {fontSize: fontSize, lines: lines};
  }
  
  function parseContent(source, textTransform, uriEncode) {
    uriEncode = uriEncode || util.uriEncode;
    var stack = [], content = [];
    var primaryLink = null;
    var nodes = source.childNodes;
    var whiteSpaceEnd = false, firstText = false;
    
    var i = 0;
    while(i < nodes.length) {
      var node = nodes[i];
      
      if(node.nodeType == 3) {
        var text = util.textTransform(textTransform, util.normalize(node.nodeValue)).replace(/</g, '&lt;');
        if(whiteSpaceEnd && firstText) text = text.replace(/^\s+/, '');
        content.push(text);
        whiteSpaceEnd = /\s$/.test(text);
        firstText = false;
      }
      
      if(node.nodeType == 1 && !/^(style|script)$/i.test(node.nodeName)) {
        var attributes = [];
        var nodeName   = node.nodeName.toLowerCase();
        var className  = node.className || '';
        // If there are multiple classes, look for the specified sIFR class
        if(/\s+/.test(className)) {
          if(className.indexOf(ClassNames.CLASS) > -1) className = className.match('(\\s|^)' + ClassNames.CLASS + '-([^\\s$]*)(\\s|$)')[2];
          // or use the first class. This is because Flash does not support the use of multiple class names.
          // Flash doesn't support IDs either.
          else className = className.match(/^([^\s]+)/)[1];
        }
        if(className != '') attributes.push('class="' + className + '"');
        
        if(nodeName == 'a') {
          var href   = uriEncode(node.getAttribute('href') || '');
          var target = node.getAttribute('target') || '';
          attributes.push('href="' + href + '"', 'target="' + target + '"');
          
          if(!primaryLink) {
            primaryLink = {
              href: href,
              target: target
            };
          }
        }
        
        content.push('<' + nodeName + (attributes.length > 0 ? ' ' : '') + attributes.join(' ') + '>');
        firstText = true;
        
        if(node.hasChildNodes()) {
          // Push the current index to the stack and prepare to iterate
          // over the childNodes.
          stack.push(i);
          i = 0;
          nodes = node.childNodes;
          continue;
        } else if(!/^(br|img)$/i.test(node.nodeName)) content.push('</', node.nodeName.toLowerCase(), '>');
      }
      
      if(stack.length > 0 && !node.nextSibling) {
        // Iterating the childNodes has been completed. Go back to the position
        // before we started the iteration. If that position was the last child,
        // go back even further.
        do {
          i = stack.pop();
          nodes = node.parentNode.parentNode.childNodes;
          node = nodes[i];
          if(node) content.push('</', node.nodeName.toLowerCase(), '>');
        } while(i == nodes.length - 1 && stack.length > 0);
      }
      
      i++;
    }
    
    return {text: content.join('').replace(/^\s+|\s+$|\s*(<br>)\s*/g, '$1'), primaryLink: primaryLink || {}};
  }
};

/*=:project
    parseSelector 2.0.2
    
  =:description
    Provides an extensible way of parsing CSS selectors against a DOM in 
    JavaScript.

  =:file
    Copyright: 2006-2008 Mark Wubben.
    Author: Mark Wubben, <http://novemberborn.net/>
       
  =:license
    This software is licensed and provided under the CC-GNU LGPL. 
    See <http://creativecommons.org/licenses/LGPL/2.1/>
    
  =:support
    parseSelector supports the following user agents:
      * Internet Explorer 6 and above
      * Firefox 1.0 and above, and equivalent Gecko engine versions
      * Safari 2.0 and above
      * Opera 8.0 and above
      * Konqueror 3.5.5 and above
    It might work in other browsers and versions, but there are no guarantees. There is
    no verification made when parseSelector is run to ascertain the browser is supported.
  
  =:notes
    The parsing of CSS selectors as streams has been based on Dean Edwards
    excellent work with cssQuery. See <http://dean.edwards.name/my/cssQuery/>
    for more info.
*/

var parseSelector = (function() {
  var SEPERATOR       = /\s*,\s*/
  var WHITESPACE      = /\s*([\s>+~(),]|^|$)\s*/g;
  var IMPLIED_ALL     = /([\s>+~,]|[^(]\+|^)([#.:@])/g;
  var STANDARD_SELECT = /(^|\))[^\s>+~]/g;
  var INSERT_SPACE    = /(\)|^)/;
  var STREAM          = /[\s#.:>+~()@]|[^\s#.:>+~()@]+/g;
  
  function parseSelector(selector, node) {
    node = node || document.documentElement;
    var argSelectors = selector.split(SEPERATOR), result = [];
    
    for(var i = 0; i < argSelectors.length; i++) {
      var nodes = [node], stream = toStream(argSelectors[i]);
      for(var j = 0; j < stream.length;) {
        var token = stream[j++], filter = stream[j++], args = '';
        if(stream[j] == '(') {
          while(stream[j++] != ')' && j < stream.length) args += stream[j];
          args = args.slice(0, -1);
        }
        nodes = select(nodes, token, filter, args);
      }
      result = result.concat(nodes);
    }
    
    return result;
  }

  function toStream(selector) {
    var stream = selector.replace(WHITESPACE, '$1').replace(IMPLIED_ALL, '$1*$2').replace(STANDARD_SELECT, insertSpaces);
    return stream.match(STREAM) || [];
  }
  
  function insertSpaces(str) {
    return str.replace(INSERT_SPACE, '$1 ');
  }
  
  function select(nodes, token, filter, args) {
    return (parseSelector.selectors[token]) ? parseSelector.selectors[token](nodes, filter, args) : [];
  }
  
  var util = {
    toArray: function(enumerable) {
      var a = [];
      for(var i = 0; i < enumerable.length; i++) a.push(enumerable[i]);
      return a;
    }
  };
  
  var dom = {
    isTag: function(node, tag) {
      return (tag == '*') || (tag.toLowerCase() == node.nodeName.toLowerCase());
    },
  
    previousSiblingElement: function(node) {
      do node = node.previousSibling; while(node && node.nodeType != 1);
      return node;
    },
  
    nextSiblingElement: function(node) {
      do node = node.nextSibling; while(node && node.nodeType != 1);
      return node;
    },
  
    hasClass: function(name, node) {
      return (node.className || '').match('(^|\\s)'+name+'(\\s|$)');
    },
  
    getByTag: function(tag, node) {
      return node.getElementsByTagName(tag);
    }
  };

  var selectors = {
    '#': function(nodes, filter) {
      for(var i = 0; i < nodes.length; i++) {
        if(nodes[i].getAttribute('id') == filter) return [nodes[i]];
      }
      return [];
    },

    ' ': function(nodes, filter) {
      var result = [];
      for(var i = 0; i < nodes.length; i++) {
        result = result.concat(util.toArray(dom.getByTag(filter, nodes[i])));
      }
      return result;
    },
    
    '>': function(nodes, filter) {
      var result = [];
      for(var i = 0, node; i < nodes.length; i++) {
        node = nodes[i];
        for(var j = 0, child; j < node.childNodes.length; j++) {
          child = node.childNodes[j];
          if(child.nodeType == 1 && dom.isTag(child, filter)) result.push(child);
        }
      }
      return result;
    },

    '.': function(nodes, filter) {
      var result = [];
      for(var i = 0, node; i < nodes.length; i++) {
        node = nodes[i];
        if(dom.hasClass([filter], node)) result.push(node);
      }
      return result;
    }, 
        
    ':': function(nodes, filter, args) {
      return (parseSelector.pseudoClasses[filter]) ? parseSelector.pseudoClasses[filter](nodes, args) : [];
    }
    
  };

  parseSelector.selectors     = selectors;
  parseSelector.pseudoClasses = {};
  parseSelector.util          = util;
  parseSelector.dom           = dom;

  return parseSelector;
})();


/// <reference path="jquery-1.3.2-vsdoc.js" />

jQuery(function () {
	PulldownMenu.init();
	//--Fix RadioButton List (Achtung: Selected muss dann auss dem Request.Form gelesen werden!)
	jQuery("span.rbl input").attr("name", "rbl");
	project.init();
});


jQuery.fn.hoverClass = function(c) {
	return this.each(function() {
		$(this).hover(
			function() { $(this).addClass(c); },
			function() { $(this).removeClass(c); }
		);
	});
};


var project = new function() {
    this.init = function() {
        //override this function in /skin/<Project>/Scripts.js
    };
};

//============================================================================
//
//============================================================================
var PulldownMenu = new function() {
	this.visiblePulldown = null;
	this.hasPulldowns = false;
	this.timeout = null;

	this.init = function() {
		$("#headerdetail .hovermenu").each(function() {
            PulldownMenu.prepare(this, false);
		});
		$("div.filter .hovermenu").each(function(i) {
			this.id = "filternav" + i;
			PulldownMenu.prepare(this, false);
		});
		$("#mainnav .hovermenu").each(function(i) {
			this.id = "mainnav" + i;
			PulldownMenu.prepare(this, false);
		});
		if (this.hasPulldowns) {
		    $("body").append("<div style=\"position:fixed;left:-5000px;top:0;width:1px;height:1px;overflow:hidden;\"><input type=\"checkbox\" value=\"\" id=\"pulldownPin\" /></div>");
			$("#pulldownPin").blur(function() { PulldownMenu.timeout = setTimeout("PulldownMenu.hide();", 200); });
		}
	};

	this.addEvents = function(obj) {
		if (obj.id == "basket") {
			$(obj).mouseover(function() { PulldownMenu.show(this, "hover"); });
			$(obj).mouseout(function() { PulldownMenu.hide("hover", "hover"); });
		} else {
			$(obj).click(function() { return PulldownMenu.show(this, "click"); });
		}
		this.hasPulldowns = true;
	}
	this.prepare = function(obj, adaptWidth) {
		if ($("#" + obj.id + " div.menudata").length == 0) {
			var head = $("#" + obj.id + " a.label").clone(true);
			head.addClass("menuhead");
			$("#" + obj.id + " a.label").after($("<div class=\"menudata\"></div>"));
			$("#" + obj.id + " div.menudata").append(head);
			$("#" + obj.id + " div.menudata").append($("#" + obj.id + " div.menubody"));
			if (adaptWidth) {
				var hwidth = head.width();
				$(obj).css("width", (hwidth + 10) + "px");
			}
		}
		this.addEvents(obj);
	}
	this.hide = function(type) {
		if (type == "hover") {
			$("#pulldownPin").blur();
		}
		if (this.timeout) {
			clearTimeout(this.timeout);
		}
		if (this.visiblePulldown) {
			$(this.visiblePulldown).removeClass("showmenu");
			this.visiblePulldown = null;
		}
	};
	this.show = function(obj, type) {
		if (!$(obj).hasClass("showmenu")) {
			if (this.visiblePulldown) {
				this.hide(type);
			}
			this.visiblePulldown = obj;
			$(this.visiblePulldown).addClass("showmenu");
			if (type == "click") {
				$("#pulldownPin").focus();
			}
			return false;
		}
	};
};


//============================================================================
//
//============================================================================
var ProductDynamics = new function() {
	this.init = function() {
		this.activateBasketButton();
	};
	this.selectColor = function(obj) {
		if ($(obj).parent().hasClass("selected")) {
			return false;
		} else {/* 
            $("#colorchoice li").removeClass("selected");
            $(obj).parent().addClass("selected");
            this.activateBasketButton();*/
		}
	};
	this.isColorSelected = function() { return $("#colorchoice li.selected").length == 1; };

	this.selectSize = function(obj) {
		$("#sizechoice li").removeClass("selected");
		$(obj).parent().addClass("selected");
		this.activateBasketButton();
		return false;
	};
	this.isSizeSelected = function() { return $("#sizechoice li.selected").length == 1; };

	this.hasOnlyOneSize = function() {
		var inputs = $("input[name=sizeSelectorInput]");
		if (inputs.length == 1) {
			inputs.get(0).checked = true;
			this.sizeIsSelected(inputs.get(0));
		}
	};
	this.activateBasketButton = function() {
		if (this.isColorSelected() && this.isSizeSelected()) {
			$("input.addToBasketBtn").removeClass("disabledBtn");
		}
        if ($("#basket a.showBasketBtn").length > 0) {
            $("a#showBasketBtn").removeClass("disabledBtn");
        }
    };

	this.addToBasketButton = function() {
		var msg = "";
		if (!this.isColorSelected()) {msg += Translator.colormsg + "\n";}
		if (!this.isSizeSelected()) {msg += Translator.sizemsg + "\n";};

		if (msg == "") {
			addToBasket($("#sizechoice li.selected a").attr("id"));
		} else {
			alert(msg);
		}
	};

	this.addToWishlistButton = function() {
		var msg = "";
		if (!this.isColorSelected()) {msg += Translator.colormsg + "\n";}
		if (!this.isSizeSelected()) {msg += Translator.sizemsg + "\n";};
	
		if (msg == "") {
			addToWishlist($("#sizechoice li.selected a").attr("id"));
		} else {
			alert(msg);
		}
	};
};


var Popup = new function() {
    this.defaultWidth = 750;
    this.defaultHeight = 600;
    this.defaultName = "popup";

    this.init = function() {
        $("a.wrpopup").each(function() { Popup.bind(this); });
    };
    this.bind = function(link) {
        $(link).bind("click", function() {
            var url = this.href;
            var lang = $("html").attr("lang");
            if (url.indexOf("/" + lang + "/") >= 0) {
                var split = url.split("/" + lang + "/");
                url = split[0] + "/popup/" + lang + "/" + split[1];
            }
            return Popup.open(url);
        });
    };
    this.open = function(link, name, width, height) {
        var n = (name ? name : this.defaultName);
        var w = (width ? width : this.defaultWidth);
        var h = (height ? height : this.defaultHeight);
        window.open(link, n, "width=" +w+ ",height=" +h+ ",location=no,menubar=no,toolbar=no,status=no,scrollbars=yes");
        return false;
    };
};
$(document).ready(function () { Popup.init(); });



//============================================================================
//
//============================================================================
var Zoomer = new function () {
	this.count = 0;
	this.identifier = "zoomer";
	this.mediumWidth = 320;
	this.mediumHeight = 400;
	this.bigWidth = 1280;
	this.bigHeight = 1600;
	this.currentZoom = "";

	this.options = {
		zoomWidth: 310,
		zoomHeight: 475,
		xOffset: 125,
		yOffset: -49
	}

	this.init = function () {
		$("#productdisplay .thumbnails a").each(function () {
			Zoomer.count++;
			$(this).attr("id", "zoompreview" + Zoomer.count).click(function (e) {
				var o = (e.srcElement ? e.srcElement : this)
				if (o.tagName.toLowerCase() == "span") {
					o = o.parentNode;
				}
				Zoomer.changePreview(o);
				return false;
			});
			if ($(this).parent().hasClass("selected")) {
				$(".productbigpicture a").attr("id", this.id + "medium");
			}
		});
		$(".productbigpicture a").jqzoom(Zoomer.options);
		this.projectInit();
	};
	this.projectInit = function () { /* override function in /Skin/[Project]/Scripts.js */ }

	this.changePreview = function (obj) {
		if (!$(obj).parent().hasClass("selected")) {
			$("#productdisplay .thumbnails li.selected").removeClass("selected");
			$(obj).parent().addClass("selected");

			var src = $("#" + obj.id + " img").attr("src").split("/");

			var bigsrc = "/t-pi-hw/" + this.bigWidth + "/" + this.bigHeight + "/" + src[3];
			var mediumsrc = "/t-pi-hw/" + this.mediumWidth + "/" + this.mediumHeight + "/" + src[3];
			
			var running = $("div.jqZoomWindow").length > 0;
			$(".productbigpicture a").get(0).stopZoom();

			$(".productbigpicture a").remove();
			$(".productbigpicture").append('<a href="' + bigsrc + '"><img src="' + mediumsrc + '" width="' + this.mediumWidth + '" height="' + this.mediumHeight + '" alt="" /></a>');
			$(".productbigpicture a").jqzoom(this.options);
			if (running) {
				$(".productbigpicture a").get(0).startZoom();
			}
		};
	};

	this.switchZoom = function () {
		var running = $("div.jqZoomWindow").length > 0;
		if (running) {
			$(".productbigpicture a").get(0).stopZoom();
		} else {
			$(".productbigpicture a").get(0).startZoom();
		}
	};
	this.positionZoomWindow = function () {
		/* override function in /Skin/[Project]/Scripts.js */
	};
};


//============================================================================
//
//============================================================================
var KarusselLogic = new function() {
    this.slots = new Array();
    this.hasInitialized = false;

    this.init = function() {
        if (!this.hasInitialized) {
            this.hasInitialized = true;
            $(".teaser_krussell").each(function() { KarusselLogic.prepare(this); });
            $(".teaser_imagekrussell").each(function() { KarusselLogic.prepare(this); });
        }
    };

    this.prepare = function(teaser) {
        if (!KarusselLogic.slots[teaser.id]) {
            var id = "";
            if (teaser.id && teaser.id != "") {
                id = teaser.id;
            } else {
                id = "karussel" + Math.round(Math.random()*10000);
                teaser.id = id;
            }
            this.slots[id] = new KarusselTeaser(id);
        }
    }

    this.back = function(id) {
        if (this.slots[id]) { this.slots[id].animateTeaser(1); }
    };

    this.next = function(id) {
        if (this.slots[id]) { this.slots[id].animateTeaser(-1); }
    };
};
var KarusselTeaser = function(id) {
    this.id = id;
    this.browser = $("#" + this.id + " .browser");
    this.list = $("#" + this.id + " .browser ul");
    this.entries = $("#" + this.id + " .browser li");
    this.entryWidth = this.entries.width();
    this.count = this.entries.length;
    this.delta = this.browser.width() - (this.count * this.entryWidth);
    this.step = this.entryWidth*5;

    if (this.delta < 0) {
        this.backlink = $("<div class=\"back\" style=\"display:none\">zurück</div>");
        this.backlink.click(function() { KarusselLogic.back(this.parentNode.id); });
        this.browser.parent().append(this.backlink);

        this.nextlink = $("<div class=\"next\">weiter</div>");
        this.nextlink.click(function(){ KarusselLogic.next(this.parentNode.id); });
        this.browser.parent().append(this.nextlink);
    }

    this.animateTeaser = function(direction) {
        var pos = this.list.position();

        var nextpos = pos.left + (this.step*direction);

        this.nextlink.show();
        this.backlink.show();
        if (nextpos > 0) {
            nextpos = 0;
            this.backlink.hide();
        } else if (nextpos < this.delta) {
            nextpos = this.delta;
            this.nextlink.hide();
        }
        this.list.animate({left: nextpos+"px"}, "fast");
    };
};


var ScrollTracker = new function () {
    this.sl = 0;
    this.st = 0;

    this.getLeft = function () {
        this.sl = (document.documentElement.scrollLeft || document.body.scrollLeft);
        return this.sl;
    };
    this.getTop = function () {
        this.st = (document.documentElement.scrollTop || document.body.scrollTop);
        if (this.st == null) {
            this.st = 0;
        }
        return this.st;
    };
};

var Helper = new function () {
    this.id = "helpsection";
    this.active = false;
    this.timeout = null;

    this.init = function (id) {
        this.id = id;
        $("#helpactivator").click(function (e) {
            if (!Helper.isActive()) {
                Helper.show();
            }
            return false;
        })
        $("#" + this.id).append("<div style=\"position:absolute;top:0;left:0;width:1px;height:1px;overflow:hidden;\" ><input type=\"checkbox\" value=\"\" id=\"helperPin\" /></div>");
        $("#helperPin").blur(function () { Helper.timeout = setTimeout("Helper.hide();", 200); });
        this.projectInit();
        $("#" + this.id).hide();
        $("#" + this.id).show();
    };
    this.projectInit = function () { };


    this.isActive = function () {
        return this.active;
    };

    this.hide = function () {
        $("#" + this.id).removeClass("activeHelp");
        this.active = false;
        this.timeout = null;
    };

    this.show = function () {
        if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
        }
        $("#" + this.id).addClass("activeHelp");
        $("#helperPin").focus();
        this.active = true;
    };
};



//============================================================================
//	Add to Basket or Wishlist
//============================================================================

function addToBasket(EAN) {
	Backend.AddToBasket(EAN, CurrentURL, addToBasketDone, HandleError);
}
function addToWishlist(EAN) {
	Backend.AddToWishlist(EAN, CurrentURL, addToWishlistDone, HandleError);
}



function HandleError(err) {
	alert(err._message + "\n" + err._stackTrace);
}

function addToBasketDone(erg) {
	if (erg.OK == false) {
		alert(erg.Message);
	} else {
		jQuery("#basket").html(erg.Message);
		jQuery("#basket").addClass("showmenu");
		jQuery("input.addToBasketBtn").addClass("addToBasketBtnSuccess");
		jQuery("a#showBasketBtn").removeClass("disabledBtn");
		setTimeout("jQuery('#basket').removeClass('showmenu');", 2000);
		setTimeout("jQuery('input.addToBasketBtn').removeClass('addToBasketBtnSuccess');", 1000);
	}
}

function addToWishlistDone(erg) {
	alert(erg.Message);
//    if (erg.OK == false) {
//        alert(erg.Message);
//    } else {
//        jQuery("#wishlistMessage").html(erg.Message);
//    }
}

ï»¿// Scripts for Lala

//============================================================================
// sIFR
// Config:	http://wiki.novemberborn.net/sifr3/JavaScript+Configuration
// JS Methods: http://wiki.novemberborn.net/sifr3/JavaScript+Methods
// Styling:	http://wiki.novemberborn.net/sifr3/Styling
//============================================================================
function LoadSIFR() {

//	sIFR.useStyleCheck = true;
//	sIFR.fitExactly = true;
//	sIFR.forceClear = true;
//	sIFR.fixWrap = true;
//	sIFR.preserveSingleWhitespace = true;
//	sIFR.forceWidth = true;
//	sIFR.forceSingleLine = true;
//	sIFR.transparent = true;
	//	

	var sackersgothic = { src: '/Skin/Lala/sackersgothic.swf' };

	sIFR.activate(sackersgothic);

	//	sIFR.debug.ratios({ src: '/Skin/Lala/sackersgothic.swf', selector: '#subnav li a.label'
	//		, css: ['.sIFR-root {color:#999; text-transform:uppercase;}']
	//		, offsetTop: 0
	//		, marginBottom: 0
	//		, verticalSpacing: 0
	//		, wmode: 'transparent'
	//		, selectable: false
	//	});


	//===================================
	//	Sub Nav
	//===================================
	sIFR.replace(sackersgothic, {
		selector: 'h1'
		, css: ['.sIFR-root {color:#999; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	//===================================
	//	Sub Nav
	//===================================
	sIFR.replace(sackersgothic, {
		selector: '#subnav li.llabel .sifrholder'
		, css: [
			'.sIFR-root{text-transform:uppercase;}', 
			'.sIFR-root a{color:#999999;text-decoration:none;}',
			'.sIFR-root a:hover { color: #FF3300;}'
		]
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});


	sIFR.replace(sackersgothic, {
		selector: '#subnav li.lon .sifrholder'
		, css: [
			'.sIFR-root{text-transform:uppercase;}', 
			'.sIFR-root a{color:#ffffff; text-decoration:none;}',
			'.sIFR-root a:hover { color: #FF3300;}'
		]
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});




	//===================================
	//	Main Nav
	//===================================
	sIFR.replace(sackersgothic, {
		selector: '#mainnav li.on'
		, css: [
			'.sIFR-root {color:#ffffff; text-transform:uppercase; font-size:11;}',
			'.sIFR-root a{color:#ffffff; text-decoration:none;font-size:11;}',
			'.sIFR-root a:hover { color: #FF3300;font-size:11}'
		]
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: '#mainnav li.off'
		, css: [
			'.sIFR-root {color:#999999; text-transform:uppercase; font-size:11;}',
			'.sIFR-root a{color:#999999; text-decoration:none;font-size:11;}',
			'.sIFR-root a:hover { color: #FF3300;font-size:11}'
		]
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});
	
	
	
	sIFR.replace(sackersgothic, {
		selector: '#productdetaildata div.detailtabdata h2'
		, css: ['.sIFR-root {color:#000000; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: '#productdetaildata div.detailtabdata b.pricesale'
		, css: [
			'.sIFR-root {color:#FF3300; text-transform:uppercase;}',
			'.sIFR-root .old{color:#999999; text-decoration: line-through;}'
		]
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: '#productdetaildata div.detailtabdata b.price'
		, css: ['.sIFR-root {color:#333333; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: 'p.intro strong'
		, css: ['.sIFR-root {color:#ffffff; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: '#relatedproducts h4'
		, css: ['.sIFR-root {color:#999999; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});

	sIFR.replace(sackersgothic, {
		selector: '#order_confirm div.column h3 span'
		, css: ['.sIFR-root {color:#ffffff; text-transform:uppercase;}']
		, wmode: 'transparent'
		, selectable: false
		, ratios: [9, 1.48, 10, 1.39, 13, 1.41, 16, 1.39, 20, 1.35, 23, 1.36, 24, 1.33, 33, 1.34, 34, 1.32, 38, 1.33, 52, 1.32, 54, 1.31, 55, 1.32, 83, 1.31, 85, 1.3, 87, 1.31, 89, 1.3, 91, 1.31, 92, 1.3, 93, 1.31, 102, 1.3, 103, 1.31, 1.3]
	});



}

if (sIFR) { LoadSIFR() }




//============================================================================
// ProductDetail: Zoom
//============================================================================

Zoomer.options = {
    zoomWidth: 379,
    zoomHeight: 436,
    xOffset: 19,
    yOffset: -1,
    activateEvent: "hover"
}
Zoomer.mediumWidth = 295;
Zoomer.mediumHeight = 426;
Zoomer.bigWidth = 1205;
Zoomer.bigHeight = 1747;



