var Elastic=function Elastic(context,includeContext){var helper,columnsElements,i,l,columnsIterator,$context,columnsElementsArr;context=context||document;$context=$(context);columnsElements=Elastic.querySelectorAll(".columns",context);if(includeContext!==false&&Elastic.configuration.includeContext===true){columnsElementsArr=[];if($context.hasClass("columns")){columnsElementsArr.push(context)}for(i=0,l=columnsElements.length;i .container",columnsElement)[0]||columnsElement;columnElements=Elastic.querySelectorAll("> .column",container);if(columnElements.length===0){return}lastColumn=columnElements[columnElements.length-1];columnsPerRow=Elastic.getColumnsPerRow(columnsElement,columnElements);containerWidth=Elastic.getInnerWidth(container);columnWidths=Elastic.round(containerWidth,columnsPerRow);if(Elastic.ADAPTIVE_COLUMNS_EXPRESSION.test(columnsElement.className)){minWidth=Number(RegExp.$2);maxWidth=Number(RegExp.$3);if(columnWidths[0].width>maxWidth){while(columnWidths[0].width>maxWidth){columnsPerRow=columnsPerRow+1;columnWidths=Elastic.round(containerWidth,columnsPerRow);if(columnWidths[0].widthmaxWidth){break}}}}elasticColumns=[];rowColumns=[];columnsOnRow=0;nextColumnsOnRow=0;fixedColumnsWidth=0;for(i=0,l=columnElements.length;i=columnsPerRow||currentColumn===lastColumn||currentColumn.isFinal){if(nextColumnsOnRow<=columnsPerRow){rowColumns.push(currentColumn)}Elastic.processRow(rowColumns,containerWidth,fixedColumnsWidth,elasticColumns,columnWidths);if(nextColumnsOnRow>columnsPerRow){if(currentColumn.isFixed){fixedColumnsWidth=fixedColumnWidth}columnsOnRow=currentColumn.spanWidth;nextColumnsOnRow=currentColumn.spanWidth;if(currentColumn.isElastic){elasticColumns=[currentColumn]}rowColumns=[currentColumn];if(currentColumn===lastColumn){Elastic.processRow(rowColumns,containerWidth,fixedColumnsWidth,elasticColumns,columnWidths)}}else{fixedColumnsWidth=0;columnsOnRow=0;nextColumnsOnRow=0;elasticColumns=[];rowColumns=[]}continue}rowColumns.push(currentColumn);columnsOnRow+=currentColumn.spanWidth}return this};Elastic.getColumnsPerRow=function getColumnsPerRow(columnsElement,columnElements){var i,l,columnsPerRow,fixedColumnsPerRow;columnsPerRow=columnElements.length;fixedColumnsPerRow=false;if(Elastic.COLUMNS_PER_ROW_EXPRESSION.test(columnsElement.className)){columnsPerRow=Number(RegExp.$2);fixedColumnsPerRow=true}for(i=0,l=columnElements.length;i=containerWidth){return}computedWidth=0;columnPosition=0;columnsWidth=fixedColumnsWidth;lastColumn=columns[columns.length-1];if(lastColumn.className.indexOf("elastic-row-last")==-1){lastColumn.className=lastColumn.className+" elastic-row-last"}for(i=0,l=columns.length;i=columnWidths.length){currentColumn.style.width=containerWidth+"px";continue}for(j=columnPosition;j<(columnPosition+currentColumn.spanWidth);j++){computedWidth+=columnWidths[j].width}columnsWidth+=computedWidth;columnPosition+=currentColumn.spanWidth;currentColumn.style.width=computedWidth+"px";computedWidth=0}}if(elasticColumns.length>0){elasticColumnsWidth=0;elasticColumnWidths=Elastic.round(containerWidth-columnsWidth,elasticColumns.length);for(i=0,l=elasticColumns.length;i0);direction=-1;if(difference!==0){for(i=1;i<=(Math.abs(difference));i++){if(direction==-1){column=columnWidths[columnWidths.length-Math.floor(positionDivision*Math.round(i/2))]}else{column=columnWidths[Math.floor(positionDivision*Math.round(i/2))-1]}if(increment){column.width=columnWidth+1}else{column.width=columnWidth-1}direction=direction*-1}}if(!cache[containerWidth]){cache[containerWidth]={}}cache[containerWidth][columns]=columnWidths;return columnWidths};Elastic.round.cache={};Elastic.helpers={"full-width":function fullWidthHelper($context,includeContext){var i,$element,$elements,elementsLength,elementsArr;$elements=$context.find(".full-width");if(includeContext!==false&&Elastic.configuration.includeContext===true){elementsArr=[];if($context.hasClass("full-width")){elementsArr.push($context[0])}for(i=0,l=$elements.length;i *");elementColumnsLength=$elementColumns.length;maxHeight=0;for(j=0;jcurrentHeight)?maxHeight:currentHeight}for(j=0;j *");elementColumnsLength=$elementColumns.length;maxHeight=0;var rowColumns=[];for(j=0;jcurrentHeight)?maxHeight:currentHeight;rowColumns.push($elementColumns[j]);if($($elementColumns[j]).hasClass("elastic-row-last")){for(k=0;k *");elementColumnsLength=$elementColumns.length;maxHeight=0;for(j=0;jcurrentHeight)?maxHeight:currentHeight}for(j=0;j *:not(.elastic-height)");siblingsLength=$siblings.length;siblingsHeight=0;for(var j=0;j *, same-row-height > *, .full-height, .elastic-height");n=$context.find(".same-min-height > *, .full-min-height");p=$context.find(".vertical-center, .center, .bottom");w=$context.find(".column:not(.fixed), .full-width");m=$context.find(".column.final");$context.find(".same-row-height > .elastic-row-last").removeClass("elastic-row-last");if(includeContext!==false&&Elastic.configuration.includeContext===true){if($context.hasClass("same-height")||$context.hasClass("same-row-height")){$context.find("> *").each(function(){this.style.height=""})}if($context.hasClass("full-height")||$context.hasClass("elastic-height")){$context.css("height","")}}for(i=0,hl=h.length;i *").each(function(){this.style.minHeight=""})}if($context.hasClass("full-min-height")){$context.css("minHeight","")}}for(i=0,nl=n.length;i"){if(context.id){result=document.querySelectorAll("#"+context.id+selector)}else{context.id="___elastic_temporal_id___";result=document.querySelectorAll("#"+context.id+selector);context.id=""}}else{result=context.querySelectorAll(selector)}}else{result=document.querySelectorAll(selector)}}else{if(context){result=$(context).find(selector)}else{result=$(selector)}}return result};Elastic.$documentElement.bind("elastic:beforeInitialize",function(){var r=Elastic.DISPLAY_LAYOUT_EXPRESSION;$(".display").each(function Elastic_layout(){var c;if(r.test(this.className)){c=".position-"+RegExp.$2;$(c).removeClass(c).appendTo(this)}});return null});jQuery.fn.ready(function Loader(){var doc=Elastic.$documentElement;var iw=document.body.clientWidth;doc.trigger("elastic:beforeInitialize");Elastic();if(iw!=document.body.clientWidth){document.body.style.overflow="hidden";Elastic.refresh();document.body.style.overflow=""}jQuery(window).bind("resize",function ElasticResizeHandler(){if(Elastic.configuration.refreshOnResize){Elastic.refresh()}});doc.bind("elastic",Elastic.refresh);doc.trigger("elastic:initialize");return null});