var oAJAXResponsive= { aAJAXGroup : null, aAJAXGroupActiveWidth : null, aParameter :null, aWindowWidths :null, aValuesPerWidths :null, nEventWindowOnResizeLateExecute : 200, bEventWindowSizeChanged : false, hEventWindowOnResizeHandler:null, construct:function(nEventWindowOnResizeLateExecute) { this.aAJAXGroup= new Array(); this.aAJAXGroupActiveWidth= new Array(); this.aParameter= new Array(); this.aWindowWidths=new Array(); this.aValuesPerWidths=new Array(); if (nEventWindowOnResizeLateExecute) { this.nEventWindowOnResizeLateExecute=nEventWindowOnResizeLateExecute; } this.addWindowOnResizeEvent(function() {oAJAXResponsive.eventWindowOnResize()}); }, setAJAXGroupResponsiveParameters:function(cAJAXGroup, cParameter, cWindowWidths , cValuesPerWidths , bLoadImmediately) { if (bLoadImmediately==null) { bLoadImmediately=true; } if (cWindowWidths.substring(0,2)!='0,') { cWindowWidths='0,' + cWindowWidths; } cWindowWidths=cWindowWidths + ',99999'; this.aAJAXGroup.push(cAJAXGroup); this.aAJAXGroupActiveWidth.push(null); this.aParameter.push(cParameter); this.aWindowWidths.push(cWindowWidths); this.aValuesPerWidths.push(cValuesPerWidths); if (bLoadImmediately) { this.actualEventWindowOnResize(); } }, eventWindowOnResize:function() { try { if (this.hOnResizeHandler) { clearTimeout(this.hOnResizeHandler); this.hOnResizeHandler=null; } } catch (e) {} this.bEventWindowSizeChanged=true; this.hOnResizeHandler=setTimeout( function() { oAJAXResponsive.actualEventWindowOnResize(); }, this.nEventWindowOnResizeLateExecute ); }, actualEventWindowOnResize:function() { // console.log('actualEvent'); this.bEventWindowSizeChanged=false; try { this.hOnResizeHandler.clearTimeout(); this.hOnResizeHandler=null; } catch (e) { } var nWindowWidth=parseInt(window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth); var q=0; while (q=parseInt(aWindowWidths[i-1]) && nWindowWidth ' + aWindowWidths[i]); this.aAJAXGroupActiveWidth[q]=parseInt(aWindowWidths[i]); if (nAJAXGroupPreviousWidth) { if (nAJAXGroupPreviousWidth!=parseInt(aWindowWidths[i])) { bReloadGroup=true; } } else { bReloadGroup=true; } cUrlParams=cParameter + '=' + aValuesPerWidths[i-1]; break; } i=i+1; } if (bReloadGroup) { // console.log(cAJAXGROUP + ' -> ' + cUrlParams); reloadPrototypeElementGroups(cAJAXGROUP, cUrlParams); } q=q+1; } }, addWindowOnResizeEvent:function (fOnResize) { var fOldOnResize = window.onresize; if (typeof window.onresize != 'function') { window.onresize = fOnResize; } else { window.onresize = function() { if (fOldOnResize) { fOldOnResize(); } fOnResize(); } } } }