$(function(){
if ($('.nonPhpMode').length <= 0)
{
setUpTopicLoad('default.php?catid=10');
setUpTopicLoad('default.php?catid=11');
setUpTopicLoad('default.php?catid=12');
setUpTopicLoad('default.php?catid=13');
setUpTopicLoad('default.php?catid=14');

 var defaultTab = $.cookie('defaultTab');
 if (defaultTab
 && (/default.php$/.test(location.href) || /[\/]$/.test(location.href))
 && (defaultTab != "default.php?catid=10" && defaultTab != "default.php"))
 {
 loadTopic(defaultTab);
 }
 else
 {
 topicLoaded();
 }
 }
 else
 {
 topicLoaded();
 }
});

function setUpTopicLoad(name)
{
 $('#zoneNav a[href=' + name + ']')
 .click(function(){
 $('#zoneNav a').removeClass('selected');
 $(this).addClass('selected');
 $('#zoneNav .throbber')
 .fadeIn("fast",function(){
 $('#topicSections').load(name + '&ajsection=topic',{},topicLoaded)
 })
 ;
 $.cookie('defaultTab', name)
 return false;
 });
}
function topicLoaded()
{
 $('#topicSections .topicResourceViewer').accordion({
 autoheight:true,
 animated: 'slide',
 fillSpace: false,
 header:'h4'
 });
 $('#topicSections #ursaLoginUser').textBoxInstructions('Enter Username');
 $('#topicSections #ursaLoginPass').textBoxInstructions('Enter Password');
 $('#topicSections #ursaLoginUser').keypress(function(e){
 if (e.which == 13
 && $('#topicSections #ursaLoginPass')[0].value == 'Enter Password')
 {
 $('#topicSections #ursaLoginPass').focus();
 return false;
 }
 });
 $('#zoneNav .throbber').fadeOut();
}
function loadTopic(name)
{
 $('#zoneNav a[href=' + name + ']').click();
}
