function fixReasons() { $('.reason').each(function() { var e = this; var bg = "url(/pages/ryu/images/reasons/" + e.id + ".png)"; if ( window.console ) window.console.log("setting background ot : " + bg ); $(e).css({ 'background-image' : bg, 'background-size' : 'auto auto', }); }); } function callCallBacks(holder, callBackList) { if (! $(holder).data("loaded") ) { return false; } for (var idx in callBackList) { var callBack = callBackList[idx]; if ( !callBack.called ) { callBack.retval = callBack.func(holder); callBack.called = true; } } } function loadReasons(holderId, callBack) { var holder = null; if ( typeof(holderId) == 'string' ) { holder = $('#'+ holderId); } if ( typeof(holderId) == 'array') { holder = holderId; } var callBackList = $(holder).data("afterLoad"); if ( !callBackList ) callBackList = []; if ( callBack ) { callBackList[callBackList.length] = { called: false, func: callBack, retval: null }; $(holder).data("afterLoad", callBackList); } if ( $(holder).html().length == 0 ) { $(holder).html("
Please wait...
"); $(holder).load("/pages/ryu/reasons-for-web.php", { limit: 25 }, function(response, status, xhr) { if ( status == "error" ) { problem = true; return false; } $(holder).data("loaded", true); fixReasons(); callCallBacks(holder, callBackList); }); } callCallBacks(holder, callBackList); return true; } function registerTabAnimationControls(containedChild, ctrl ) { var idx; var container = $(containedChild).parent(); var controls = $(container).data('tabTriggers'); if ( !controls ) controls = []; idx = controls.length; controls[idx] = { start: ctrl[0], stop: ctrl[1] }; container.data('tabTriggers', controls); } function animateControls(allPanes, tabIdx) { var controls; for(var k = 0 ; k < allPanes.length; k++) { pane = allPanes[k]; controls = $(pane).data('tabTriggers'); if (!controls) continue; var start = (k == tabIdx ); for(idx in controls) { var c = controls[idx]; if ( start ) { if ( typeof c.start == 'function' ) { c.start(); } } else { if ( typeof c.stop == 'function' ) { c.stop(); } } } } } /* activate the top tab */