(function($) {
	
	$.fn.tabInterface = function(target) {
		$(target).find('.active').siblings().hide();
		return this.each(function() {
			$this = $(this);
			var targetID = '#'+$this.find('a').attr('rel');
			$this.click(function() {
				if(!$(this).hasClass('active')) {
					$(this).addClass('active').siblings().removeClass('active');
					$(target).find('.active').hide();
					$(target).find(targetID).show().addClass('active');
				}
				
				var hash = $(this).find('a').attr('href');
				hash = hash.replace(/^.*#/, '');
				$.historyLoad(hash);
				
				$.ajax({
		            type: 'GET',
		            url: '/global/js/omniture/s_code.js',
		            dataType: 'html',
		            success: function(html) {
					var section = $(target).attr('class');
					var subSection = $('#mainContent').attr('class');
			        		s.pageName="models:"+section+":"+subSection+":"+hash
							s.server=vwServerName;
							s.domain=vwDomain;
							s.channel="models"
							s.nameplate=s.nameplate
							s.modelyear=vwModelYear;
							s.extcolor=""
							s.intcolor=""
							s.vehicletrim=""
							s.engine=""
							s.language="en"
							s.searchtype=""
							s.searchzip=""
							s.searchstate=""
							s.searchdealer=""
							s.searchterm=""
							s.leadtype=""
							s.microsite="www.vw.com"
							s.testdrive=""
							s.campaign=""
							s.events=""
							s.products=""
                            var s_code=s.t();
                            if(s_code)document.write(s_code);
                    },
					error:  {
					}
				});
						
				return false;
			});
		});
	};
	
})(jQuery);