/* <![CDATA[ */
$(function(){
	$(".tabs").each(function(i){ 
//		alert ($("div[title]", this).size());
		$(this).hide().css({position:"relative", borderTop:"1px solid #ccc", overflow:"visible", height:"100px", margin:"0 5px 12px 0"}).attr({"id":"tabs"+i}).before("<ul id='tabnav"+i+"' class='tabnav'><\/ul>");
		$("div[title]", this).each(function(ii){
			if($(this).parent().hasClass("tabs")){
				if ($(this).parent().height()<$(this).height()+50){$(this).parent().height($(this).height()+50);}
				$("#tabnav"+i).append("<li id='tabnav_item"+ii+"'>"+$(this).attr("title")+"<\/li>");
				$(this).css({ position:"absolute", top:0, zIndex:ii, border:"1px solid #ccc", borderTop:"none", background:"#fff"}).attr({"id":"tab"+ii});
				if (ii==$("#tabs"+i+" div[title]").length-1 && ii>0){styleTabs(i);}
			}
		});
	$("#tabnav"+i+" li:eq(0)").click();
	});
});

function styleTabs(a){
	$("#tabs"+a).show();
	$("#tabs"+a+" h3").hide();
	$("#tabnav"+a+" li").each(function(){$(this).css({ background:"url(/cgi-bin/images/tab_inactive.jpg) bottom repeat-x #fff", cursor:"pointer", color:"#03f", fontWeight:"bold", padding:"8px 10px", margin:"0 1px 0 0", display:"inline", border:"1px solid #ccc",borderBottom:"none"}).click(function(){showTabs(a, this)});});
}

function showTabs(i,e){
	ii = $(e).parent().children().index(e);
	$("#tabnav"+i+" li").css({ background:"url(/cgi-bin/images/tab_inactive.jpg) bottom repeat-x #fff", padding:"8px 10px 8px 10px", color:"#03f"});
	$("#tabnav"+i+" li:eq("+ii+")").css({ background:"url(/cgi-bin/images/tab_active.jpg) top repeat-x #fff", padding:"12px 10px 9px 10px", color:"#444"});
	$("#tabs"+i).animate({height:$("#tab"+ii).height()+18},600);
	$("#tabs"+i+">div[id!=tab"+ii+"]").fadeOut(400, function(){$("#tabs"+i+" #tab"+ii).fadeIn(500);});
}
/*]]>*/
