var ZoomifyViewer = new Class({
	
	Implements: Options,
	
	options: {
		id: 'ZoomifyViewer',
		debug:false		
    },
	
	initialize: function(options){
		//	setup options
		this.setOptions(options);
		
		// get base elements
		this.viewer = this.get_flash_object(this.options.id);
		
		window.fireEvent('zmfinit');
	
	},

	zoom_in: function(time){
		try{
			this.viewer.zoomIn();
			if(time){
				(function(){ this.zoom_stop(); }).delay(time, this);	
			}
		} catch(e){
			//	void
		}
	},

	zoom_out: function(time){
		try{
			this.viewer.zoomOut();
			if(time){
				(function(){ this.zoom_stop(); }).delay(time, this);	
			}
		} catch(e){
			//	void
		}
	},

	zoom_stop: function(){
		try{
			this.viewer.zoomStop();
		} catch(e){
			//	void
		}
	},
	
	zoom_to: function(x, y, zoom){
		try{
			this.viewer.zoomTo(x, y, zoom, 500, 10);
		} catch(e){
			//	void
		}
	},

	get_flash_object: function(in_id){
		if (window.document[in_id]){
			return window.document[in_id];
		}
		if (navigator.appName.indexOf("Microsoft Internet")==-1){
		    if (document.embeds && document.embeds[in_id]){
      			return document.embeds[in_id]; 
		  	} else {
		    	return document.getElementById(in_id);
		  	}
		}
	}

});
