/* * jQuery lk_switching plugin * * Copyright (c) 2011 lk.programming@gmail.com * * The code is inspired from Autocomplete plugin (http://lkweb.wordpress.com) * * Version: 1.0 *  * Changelog : *  Version 1.0 *  - Test run *//*===== How to use ======$.lk_switching([	{		autoActive 	: false,		button 		: '.news_bar a.news_events',		container 	: '.index_news.news_events_block'	},	{		autoActive 	: true,		button 		: '.news_bar a.news_special',		container 	: '.index_news.news_special_block'	}]);========================*/jQuery.lk_switching = function(opt){	var options = jQuery.extend({},jQuery.lk_switching.options, opt);	$(document).ready(function(){		for(var i in options)		{			var selector_button 	= options[i]['button'];			var selector_container 	= options[i]['container'];			var autoActive 			= options[i]['autoActive'];						$(selector_container).hide();			$(selector_button).attr('rel', selector_container);			$(selector_button).click(function(e){				e.preventDefault();				setActive(this);			});						if(autoActive == true)			{				setActive($(selector_button));			}		}	});		function setActive(obj)	{		for(var x in options)		{			var _selector_button = options[x]['button'];			var _selector_container = options[x]['container'];						//--- Deactivate			$(_selector_button).removeClass('activated');			$(_selector_container).hide();			//--- End Deactivate		}		//--- Activate		$(obj).addClass('activated');		$($(obj).attr('rel')).show();		//--- End Activate	}}jQuery.lk_switching.options = [	{		autoActive 	: false,		button 		: '',		container 	: ''	},	{		autoActive 	: false,		button 		: '',		container 	: ''	}];
