/*
 * 	Night Mode Plugin - jQuery plugin
 *	written by Damian Logghe	
 *	http://blog.timersys.com/night-mode-plugin/
 *
 *	Copyright (c) 2010 Damian Logghe (http:///blog.timersys.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	Ussage 
 *	
 * 	<a id="nightmode">Turn nightmode On/off</a>
 *	
 * 	$(document).ready(function(){
 *							   
 * 	$('#nightmode').click(function(){
 *				 $('body').nightMode();
 *								   });
 *	});
 *	
 *		Just change body to any valid selector you wish
 */

(function($) {

	$.fn.nightMode = function(options){
	  
		// default configuration properties
		var defaults = {			
			color: 		'#0F0',
			background: '#000'
		}; 
		var options = $.extend(defaults, options);  
		
		
		
		
		var obj = $('*',this); 			
					if($('#nightstyle').length){
					$('#nightstyle').remove();
					obj.removeClass("nm");
					$(this).removeClass("nm");
						
					}else{
					$('body').prepend('<style id="nightstyle"> .nm ,.nm:visited  { color:'+options.color+';background:'+options.background +';}.nm img{opacity:0.6;}</style>');
							obj.addClass("nm");	
							$(this).addClass("nm");	
					}
		
				
			
		
	  
	};

})(jQuery);




