/*
 * jQuery styleSwitcher Plugin
 * Examples and documentation at: http:///www.immortalwolf.com
 * Copyright (c) 2010 immortal wolf
 * Version: 1.01 (01-DEC-2010)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.2.6 or later
 */
 
(function($) {
	$.fn.styleSwitcher = function(options){		
		var defaults = {	
			slidein: true, preview: false, container: this.selector, directory: "css/"	
		};
		var opts = $.extend(defaults, options);
		
		if(opts.slidein){
			$(opts.container).slideDown("slow");
		}
		else{
			$(opts.container).show();
		}
		var baseStyle = $("link[id=theme]").attr("href");
		if(opts.preview){
			$(opts.container + " a").hover(
				function () {
					var newStyle = opts.directory + this.id + ".css";
					$("link[id=theme]").attr("href",newStyle);
				}, 
				function () {
					$("link[id=theme]").attr("href",baseStyle);
				}
			);
		}
		
		$(opts.container + " a").click(
			function () {
				var newStyle = opts.directory + this.id + ".css";
				$("link[id=theme]").attr("href",newStyle);
				baseStyle = newStyle;
			}
		);
		
	};
})(jQuery);
