var preview = function ()
{
	var pub = {};
	var self = {};
	
	pub.init = function ()
	{
		$('#theme-options').fadeIn ('medium');
		
		$('.swatch').live ('click' , function () 
		{	
			var href = $(this).attr ('href');
			var $styleswitch = $('#styleswitch');
			$styleswitch.attr ('href' , href);
			return false;
		});
	
		$(document).bind('click', function(e) 
	    {
			var $clicked=$(e.target); // get the element clicked
	        if( !$clicked.is('#theme-options') && !$clicked.parents ('#theme-options').is ('#theme-options') )
	        {
	        	$('#options-display').hide ( 1000 , function () { 
	        		
	        		$('#theme-options').animate ({ bottom: 0 });
	        	})
	        	
	        }
	    });
	    
	    $('#theme-options').live ('click' , function () {
	
			var $this = $(this);
			var $od = $('#options-display');
			
			if ( !$od.is (':visible') )
			{
				$od.show ( 1000 , function () { 
					$this.animate ({ bottom: 0 }).end ();
				})
				
					
			}
			else
			{
							
				$od.hide ( 1000 , function () { 
					$this.animate ({ bottom: 0 }).end ();
					
				})	
	
			}
		});
	}

	
	return pub;	
}();
