
var tab1TID;
var currentAttorneyID = 0;
var defaultTimeout = 5000;
$(document).ready(function(){
	if(document.images){
		myTabs = new Array();
		myTabs[0] = getImage("/library/media/gui/tab1.jpg");
		myTabs[1] = getImage("/library/media/gui/tab1_on.jpg");
		myTabs[2] = getImage("/library/media/gui/tab2.jpg");
		myTabs[3] = getImage("/library/media/gui/tab2_on.jpg");
	}
	$(".tab2Cont").hide(1);
	$(".attorneyTab").hide(1);
	$(".attorneySelector").hide(1);
	
	tab1TID = setTimeout("loadTab1()",1500);
	
	$(".tab1").click(function(){
		$(".tab1").addClass("tab1Hover");
		$(".tab2").removeClass("tab2Hover");	
		$(".tab2Cont").hide("def",function(){
			
			$(".tab1Cont").show("def");
			$(".tab1Loading").hide(1);
			$(".attorneySelector").show();
			tab1TID = setTimeout("showAttorney(" + (currentAttorneyID+1) + ")",defaultTimeout);
		});
		
	});
	$(".tab2").click(function(){
		clearTimeout(tab1TID);
		$(".tab2").addClass("tab2Hover");
		$(".tab1").removeClass("tab1Hover");
		$(".tab1Cont").hide("def",function(){
			$(".tab2Cont").show("def");
		});
	});
});

function loadTab1(){
	clearTimeout(tab1TID);
	if(currentAttorneyID > 10){
		currentAttorneyID = 0;
	}
	$("#tab1Loading").hide("def",function(){
		$("#at" + currentAttorneyID).show("def");
		$(".attorneySelector").show();
		$("#as" + currentAttorneyID).addClass("current");
		tab1TID = setTimeout("showAttorney(" + (currentAttorneyID+1) + ")",defaultTimeout);
	});
}

function showAttorney(id){
	clearTimeout(tab1TID);
	if(id > 10){
		id = 0;
	}
	$("#at" + currentAttorneyID).hide("def",function(){
		$("#as" + currentAttorneyID).removeClass("current");
		
		$("#as" + id).addClass("current");
		$("#at" + id).show("def");
		currentAttorneyID=id;
		tab1TID = setTimeout("showAttorney(" + (currentAttorneyID+1) + ")",defaultTimeout);
	});
	return false;
}


