/**
 *
 *	HOPE/GLORY: WORK COUNTER
 *
 **/ 
(function($) { 
	                               
	$.fn.counter = function(selector, options) {             
		
		// 
		//	init counter
		//
	    var init = function()
		{ 			                                               

			// set counter
			//this.set(1, _project_count);

			// save project count                  
		},      
		
		//
		//	set
		//   
		set = function(current, of) {
		                            
			if(!of) of = _project_count;
		
			_current_string = current.toString();
			_of_string = of.toString();
		
			_output = (current < 10) ? ('<span class="n0">0</span><span class="n'+current+'">'+current+'</span>') : ('<span class="n'+_current_string.substring(0,1)+'">'+_current_string.substring(0,1)+'</span><span class="n'+_current_string.substring(1,2)+'">'+_current_string.substring(1,2)+'</span>');
			
			_output += '<span class="slash">/</span>';
			
			_output += (of < 10) ? ('<span class="n0">0</span><span class="n'+of+'">'+of+'</span>') : ('<span class="n'+_of_string.substring(0,1)+'">'+_of_string.substring(0,1)+'</span><span class="n'+_of_string.substring(1,2)+'">'+_of_string.substring(1,2)+'</span>');
			
			$('#work-counter').html(_output);
		
		},
		    
		//
		//	reset
		//
		reset = function() {
			_project_count = $('div.portfolio-project').length;  
			set(1, _project_count);   
		};    
		     
		
		// count projects
		var _project_count = $('div.portfolio-project').length;    
		 
		set(1, _project_count);
		//init();
	
		return {
			set: function(current, of)
			{
				set(current, of);
			},   
			reset: function()
			{
				reset();
			}
		};
	};

})(jQuery); 
