var current_anchor = $.url.attr("anchor");
$.fn.vtabs = function() {

		// If there is an #anchor on the present link that matches one of our items, get rid of the default 'selected' link and 'active' panel, change it to the one that was requested in the URL

		if($('.vtabs-content-item#'+current_anchor).length) { // if there is a vtab with the #id == the current URL #anchor... 
			$('.vtabs-content-item').removeClass('active'); // get rid of the currently 'active' panel
			$('.vtabs-content-item#'+current_anchor).addClass('active'); // activate the panel that matches the #anchor
			$('.vtabs-controller a').removeClass('selected'); // get rid of the currently 'selected' controller link
			$('.vtabs-controller a[href=#'+current_anchor+']').addClass('selected'); // select the controller link that matches the anchor
		}
		
		$('.vtabs-content-item').not('.active').hide(); // hide the content that isn't 'active'
		
		$(this).each(function() {
			var vtabswrapper = $(this);
			
			vtabswrapper.find('.vtabs-controller a, .vtabs-content a.vtabs-nav').bind('click', function(){
							
				vtabswrapper.find('.vtabs-controller a').removeClass('selected'); // remove 'selected' from all nav links
				vtabswrapper.find('.vtabs-controller a[href='+$(this).attr('href')+']').addClass('selected'); // add 'selected' to the link inside vtabs-controller whose ID equals the #href of the link that we're applying this event to
				
				
				var targetpanel = vtabswrapper.find('#'+$(this).attr('href').substr(1)); // the target panel is the one with the #id of the #href of the link that was clicked
				targetpanel.fadeIn();
				vtabswrapper.find('.vtabs-content-item').not(targetpanel).hide(); // hide all content
				
			});
		
		});
	};
