$(document).ready(function(){ /* This code is executed after the DOM has been completely loaded */ /* Defining an array with the tab text and AJAX pages: */ var Tabs = { 'technology' : 'sp.php?catid=9', 'gadgets' : 'sp.php?catid=1', 'blogs' : 'sp.php?catid=2', 'news' : 'sp.php?catid=3', 'ent' : 'sp.php?catid=4', 'games' : 'sp.php?catid=5', 'sports' : 'sp.php?catid=6', 'misc' : 'sp.php?catid=7', } /* The available colors for the tabs: */ var colors = ['blue','green','red','purple','cyan','pink','gray','orange']; /* The colors of the line above the tab when it is active: */ var topLineColor = { blue:'blue', green:'green', red:'red', purple:'purple', cyan:'cyan', pink:'pink', gray:'gray', orange:'orange' } /* Looping through the Tabs object: */ var z=0; $.each(Tabs,function(i,j){ /* Sequentially creating the tabs and assigning a color from the array: */ var tmp = $('
');
$.get(element.data('page'),function(msg){
$('#contentHolder').html(msg);
/* After page was received, add it to the cache for the current hyperlink: */
element.data('cache',msg);
});
}
else $('#contentHolder').html(element.data('cache'));
e.preventDefault();
})
/* Emulating a click on the first tab so that the content area is not empty: */
the_tabs.eq(0).click();
});