function Magnifier() {
	
	var publ= this;
	var priv= {};
	
	priv.origButtonText= false; // is to be initiated
	priv.sizeToReach= 500;
	priv.origSize= false; // is to be initiated
	priv.isMagnified= false; // indicates magnification state
	
	publ.initialize= function() {
		
		if ( !$J( "#magnifier" ).get(0) )
			return;
		
		priv.origButtonText= $J( "#magnifier span" ).text();
		priv.origSize= parseInt( $J( ".product-view img" ).css( "width" ) );
		//console.log( "Original-Größe des Bildes", priv.origSize );
		var testtext= "Hier steht ein Testtext";
		//$J( ".product-images img" ).css( "height", "auto" );
		
		$J( "#magnifier" ).click( priv.changeSize );
		//$J( ".product-images img" ).click( priv.changeSize );
		
	}
	
	priv.changeSize= function() {
		
		if ( !priv.isMagnified ) {
			
			$J( ".product-images img" ).css( "height", "auto" );
			$J( ".product-images img" ).animate( { width : priv.sizeToReach }, "slow", priv.insertHighResImg );
			$J( "#magnifier" ).animate( { bottom : -40 }, "slow", priv.changeText );
			//$J( ".product-images img" ).animate( { width : priv.sizeToReach }, "slow", priv.insertHighResImg );
			//$J( "#magnifier" ).animate( { bottom : -40 }, 150, priv.changeText );
			
			/*
			$J( "#magnifier" ).animate( { bottom : -40 }, 200, function() {
				priv.changeText();
				$J( ".product-images img" ).animate( { width : priv.sizeToReach }, "slow", priv.insertHighResImg );
			} );
			*/
			
			priv.isMagnified= true;
			
		} else {
			
			$J( ".product-images img" ).animate( { width : priv.origSize }, "slow" );
			$J( "#magnifier" ).animate( { bottom : 0 }, "slow", priv.changeText );
			//$J( ".product-images img" ).animate( { width : priv.origSize }, "slow" );
			//$J( "#magnifier" ).animate( { bottom : 0 }, 1000, priv.changeText );
			
			/*
			$J( ".product-images img" ).animate( { width : priv.origSize }, "slow", function() {
				$J( "#magnifier" ).animate( { bottom : 0 }, 200, priv.changeText );
			} );
			*/
			
			priv.isMagnified= false;
			
		}
		
		return false;
		
	}
	
	priv.insertHighResImg= function() {
		$J( ".product-images img" ).get(0).src= $J( "#big-img-src" ).val();
	}
	
	priv.changeText= function() {
		if ( priv.isMagnified ) {
			$J( "#magnifier span" ).html( "Ansicht verkleinern" );
			$J( "#magnifier" ).css( "background-image", $J( "#magnifier" ).css( "background-image" ).replace( /plus/, "minus" ) );
		}
		else {
			$J( "#magnifier span" ).html( priv.origButtonText );
			$J( "#magnifier" ).css( "background-image", $J( "#magnifier" ).css( "background-image" ).replace( /minus/, "plus" ) );
		}
	}
	
	// Initialize
	publ.initialize();
	
}
