/**
 * Generates css controlled tab view switching 
 * 
 * @author James Baker, Tom Bermel (24/09/08)
 */

if (!console) var console = {};
if (!console.log) console.log = {};

// set up Argos callout namespace
if (!argos) var argos = {};
if (!argos.tabviewer) argos.tabviewer = {};

argos.tabviewer.tabswitchview = {	

	init : function() {
		// shorten namespace
		var tabviewer = argos.tabviewer.tabswitchview;
		
		// display all tabs in default state
		$(".tabbedarea .tab").show();
	
		$(".tabbedarea .tab a").click(
			function(){
				
		//locate/establish specific ID value of the parent tab and corresponding view
			
				var activeParent = $(this).parent();
				var activeView = $(this).attr("href");
				
				//deselect tabs and hide all panels
				$(activeParent).siblings().removeClass("selected");
				//$(".tabbedarea .view").hide();
				
				$(activeView).siblings(".view").hide();
				
				//select tab and show selected panel
				$(activeParent).addClass("selected");
				$(activeView).show();
				
				return false;
		   }	
		);
		
	}
	
}