INIT = { init : function() { for ( var f in this.handlers) { this.handlers[f](); } }, handlers : {}, orientationChange : function(orientation) { var index = 0; for(var f in this.orientationHandlers) { this.orientationHandlers[f](orientation, this.orientationData[f]); index++; } }, orientationHandlers : {}, orientationData : {} } $(document).ready(function(){ INIT.init(); $(window).bind("orientationchange",function(){ var orientation = $(this).attr("orientation"); INIT.orientationChange(orientation); }); });