var homeTabBox = new Object();

homeTabBox.onClick = function(a)
{
var ind, m, i, c, jqc, src, img;
m = a.className.match(/(^|\s)tab_([0-9]+)(\s|$)/);
ind = new Number(m[2]);
if (ind)
{
jqc = jQuery(a).parent();
for (i = 1, c = this.tabCount + 1; i < c; i++)
{
src = (img = jQuery("a.tab_"+i+" img", jqc)).attr("src").match(/^(.+\.)(selected|off|over)(\.[^\.\/]+)$/);
if (i == ind)
{
img.attr("src", src[1]+"selected"+src[3]);
jQuery("div.tab_contents div.tab_"+i, jqc.parent().parent()).css("display", "block");
this.selectedInd = i;
}
else
{
img.attr("src", src[1]+"off"+src[3]); 
jQuery("div.tab_contents div.tab_"+i, jqc.parent().parent()).css("display", "none");
}
}
}
}

homeTabBox.init = function(selector)
{
this.tabCount = 3;
this.selectedInd = 1;
jQuery(selector+" div.tabs_inner a").click
(
function()
{
homeTabBox.onClick(this);
return false;
}
).mouseover
(
function()
{
var img;
this.srcOriginal = (img = jQuery("img", this)).attr("src");
img.attr("src", this.srcOriginal.replace(/^(.+\.)(selected|off|over)(\.[^\.\/]+)$/, "$1over$3"));
}
).mouseout
(
function()
{
var ind;
ind = new Number(this.className.match(/(^|\s)tab_([0-9]+)(\s|$)/)[2]);
if (ind == homeTabBox.selectedInd)
{
jQuery("img", this).attr("src", this.srcOriginal.replace(/^(.+\.)(selected|off|over)(\.[^\.\/]+)$/, "$1selected$3"));
}
else
{
jQuery("img", this).attr("src", this.srcOriginal);
}
}
);
}