var tabURL = new Array();
// ***************************
// Tab Bar Settings
// ***************************
// if below is true, the tab bar will be horizontal... vertical if false
var tabHorizontal = true;

// set the amount of space you want between each tab (horizontal or vertical)
var tabSpacing = 2;

// Add custom background CSS below: color or image
// e.g. "background: #000000 url(myImage.jpg); height:40px; width:650px;";
var tabBarWrapper = "background: #000000 url(http://ni.guildscentral.net/data/global/buttons/tabbar.png) repeat-x; height:35px;";

// Change the overall tab bar alignment below, use: left, center or right.
var tabBarAlign = "center";

// Change the tab bar alignment more precisely within the tab bar wrapper
var tabBarAlign2 = "top:0px; left:0px;";

/* *************************************************************
Enter the tab & image URLs (in order) for your site below:
You can include any GuildPortal site or any other website.

tabURL.push ([
 "Tab URL"
,"_self"
,"Selected Tab Image URL"
,"UnSelected Tab Image URL"
,"MouseOver Tab Image URL"
]);
 ************************************************************** */
// Home
tabURL.push ([
 "http://cont.guildportal.com/Guild.aspx?GuildID=51848&TabID=453954"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/homepressed.png"
,"http://ni.guildscentral.net/data/global/buttons/homenormal.png"
,"http://ni.guildscentral.net/data/global/buttons/homehover.png"
]);

// Forum
tabURL.push ([
 "http://cont.guildportal.com/Guild.aspx?GuildID=51848&TabID=453955"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/forumspressed.png"
,"http://ni.guildscentral.net/data/global/buttons/forumsnormal.png"
,"http://ni.guildscentral.net/data/global/buttons/forumshover.png"
]);

// Rules
tabURL.push ([
 "http://cont.guildportal.com/Guild.aspx?GuildID=51848&TabID=2195064"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/rulespressed.png"
,"http://ni.guildscentral.net/data/global/buttons/rulesnormal.png"
,"http://ni.guildscentral.net/data/global/buttons/ruleshover.png"
]);

// Attendance
tabURL.push ([
"http://ni.guildscentral.net/phpraider/index.php?option=com_attendance"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/attendancepressed.png"
,"http://ni.guildscentral.net/data/global/buttons/attendancenormal.png"
,"http://ni.guildscentral.net/data/global/buttons/attendancehover.png"
]);

// Calendar
tabURL.push ([
"http://ni.guildscentral.net/phpraider"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/calendarpressed.png"
,"http://ni.guildscentral.net/data/global/buttons/calendarnormal.png"
,"http://ni.guildscentral.net/data/global/buttons/calendarhover.png"
]);

// DKP
tabURL.push ([
"http://cont.guildportal.com/Guild.aspx?GuildID=51848&TabID=2450677"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/DKPpressed.png"
,"http://ni.guildscentral.net/data/global/buttons/DKPnormal.png"
,"http://ni.guildscentral.net/data/global/buttons/DKPhover.png"
]);

// Mail
tabURL.push ([
"http://cont.guildportal.com/Guild.aspx?GuildID=51848&TabID=453961"
,"_self"
,"http://ni.guildscentral.net/data/global/buttons/mailpressed.png"
,"http://ni.guildscentral.net/data/global/buttons/mailnormal.png"
,"http://ni.guildscentral.net/data/global/buttons/mailhover.png"
]);

// ***************************
// Don't change anything below
// ***************************
makeTabs();
function makeTabs () {
if (String(top.name).substring(0,4) == "Edit") {return;}
var currentTyp = '';
var currentURL = window.location.href;
var currentTab = gup('TabID',currentURL);
var currentGID = gup('GuildID',currentURL);

var tabHTML = '<style>.TabBkgd {' + tabBarWrapper + '}.TabBar2 {position: relative;';
 tabHTML += tabBarAlign2 +'}.TabBar2 td {';
 if (tabHorizontal) {
  tabHTML += 'padding: 0px '+ tabSpacing + 'px;';
 } else {
  tabHTML += 'padding: '+ tabSpacing + 'px 0px;';
 }
 tabHTML += 'margin:0px;border:0px;}.TabBar2 img {border:0px;}</style>';
 tabHTML += '<div class="TabBkgd"><table class="TabBar2" cellpadding="0"';
 tabHTML += ' cellspacing="0" border="0" align="'+ tabBarAlign +'" valign="middle">';
 if (tabHorizontal) tabHTML += '<tr>';

for (j = 0; j < tabURL.length; j++) {
 if (currentURL == tabURL[j][0] || currentTab == gup('TabID',tabURL[j][0]) && currentGID == gup('GuildID',tabURL[j][0]) ) {
  currentTyp = tabURL[j][2];
 } else {
  currentTyp = tabURL[j][3];
 }
 if (!tabHorizontal) tabHTML += '<tr>';
 tabHTML += '<td><a class="tabStyle" href="' + tabURL[j][0] + '" ';
 tabHTML += 'target="' + tabURL[j][1] + '" ';
 tabHTML += 'onmouseover="tab' + j + '.src=\'' + tabURL[j][4] + '\'" ';
 tabHTML += 'onmouseout="tab' + j + '.src=\'' + currentTyp + '\'">';
 tabHTML += '<img id="tab' + j + '" src="' + currentTyp;
 tabHTML += '"></a></td>';
 if (!tabHorizontal) tabHTML += '</tr>';
}
if (tabHorizontal) tabHTML += '</tr>';
tabHTML += '</table></div>';
document.write (tabHTML);
}
// Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
function gup(name, myString) {
 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
 var regexS = "[\\?&]"+name+"=([^&#]*)";
 var regex = new RegExp( regexS );
 var results = regex.exec( myString );
 if( results == null )
  return "";
 else
  return results[1];
}