$(document).ready(function(){ setTabs = function(sessObj, locID) { $('#' + sessObj + 'Tabs').find('.tabhere').removeClass('tabhere').addClass('tab'); $('#' + sessObj + locID).removeClass('tab').addClass('tabhere'); } var defaultSet = false; selectLocation = function(sessObj, locID, setDef) { if(window.rotator) { clearInterval(window.rotator); clearTimeout(window.rotator); } if (setDef==null) { setDef = true; } $('#' + sessObj + 'Content').html('Loading Featured Venues'); if (!defaultSet && setDef) { defaultSet = true; Ext.Msg.confirm('Set default location!', 'Would you like to make this your default location?', function(btn, text) { if (btn == 'yes'){ $.ajax({ url: 'scripts/ajah/featAttrLoc.php', data: 'featAttrLoc=' + locID + '&setDefaultLoc=true', success: function(data) { $('#featAttrLocContent').html(data); setTabs('featAttrLoc', locID); } }); $.ajax({ url: 'scripts/ajah/featVenueLoc.php', data: 'featVenueLoc=' + locID + '&setDefaultLoc=true', success: function(data) { $('#featVenueLocContent').html(data); setTabs('featVenueLoc', locID); } }); $.ajax({ url: 'scripts/ajah/highlightsLoc.php', data: 'highlightsLoc=' + locID + '&setDefaultLoc=true', success: function(data) { $('#highlightsLocContent').html(data); setTabs('highlightsLoc', locID); } }); } else { $.ajax({ url: 'scripts/ajah/' + sessObj + '.php', data: sessObj + '=' + locID + '&setDefaultLoc=false', success: function(data) { $('#' + sessObj + 'Content').html(data); setTabs(sessObj, locID); } }); } }); } else { $.ajax({ url: 'scripts/ajah/' + sessObj + '.php', data: sessObj + '=' + locID + '&setDefaultLoc=false', success: function(data) { $('#' + sessObj + 'Content').html(data); setTabs(sessObj, locID); } }); } } selectLocation('featAttrLoc', 20, false); selectLocation('featVenueLoc', 20, false); selectLocation('highlightsLoc', 20, false); });