/** Tile Utility Functions **/ var WS_TILE_MIN_WIDTH = 225; var WS_TILE_WIZARD_MIN_WIDTH = 250; var WS_TILE_LAYOUT_SWITCH_THRESHOLD = 475; var WS_TILE_H_DEFAULT_WIDTH = 400; var WS_TILE_H_DEFAULT_HEIGHT = 500; var WS_TILE_H_MIN_HEIGHT = 200; var WS_TILE_H_MAX_HEIGHT = 3000; var WS_TILE_V_MIN_HEIGHT = 300; var WS_TILE_V_MAX_HEIGHT = 3000; var WS_TILE_V_DEFAULT_LIST_LIMIT = 5; var WS_TILE_V_MIN_LIST_LIMIT = 5; var WS_TILE_MAX_LIST_LENGTH = 10; var WS_TILE_H_LINE_HEIGHT = 38; var WS_TILE_V_LINE_HEIGHT = 34; var WS_TILE_FOOTER_LINE_HEIGHT = 18; var WS_TILE_FOOTER_2_LINE_THRESHOLD = 350; var WS_TILE_FOOTER_HIDDEN = 100; var WS_TILE_FOOTER_ADDRESS = 101; function ws_tileOptions(defaultHeight, minHeight, maxHeight, numFooterLines) { this.defaultHeight = defaultHeight; this.minHeight = minHeight; this.maxHeight = maxHeight; this.footerLines = numFooterLines; } function ws_footerInfo(footerX, footerY, footerX2, inputX, inputY, inputW, numFooterLines) { this.footerX = footerX; this.footerY = footerY; this.footerX2 = footerX2; this.inputX = inputX; this.inputY = inputY; this.inputW = inputW; this.footerLines = numFooterLines; } function ws_rangeObj(minVal, maxVal) { this.minVal = minVal; this.maxVal = maxVal; } function ws_getTileOptions( width, layout, footerType, showCommute ){ if (layout==null || layout=="auto") layout = ws_getDefaultLayout(width); //default to horizontal var defaultHeight = WS_TILE_H_DEFAULT_HEIGHT; var minHeight = WS_TILE_H_MIN_HEIGHT; var maxHeight = WS_TILE_H_MAX_HEIGHT; if ( layout == "vertical") { defaultHeight = WS_TILE_V_MIN_HEIGHT; minHeight = WS_TILE_V_MIN_HEIGHT; maxHeight = WS_TILE_V_MAX_HEIGHT; } //how much vertical space will the footer require? var numFooterLines = 1; if ( footerType == WS_TILE_FOOTER_HIDDEN ) numFooterLines = 0; else if (width < WS_TILE_FOOTER_2_LINE_THRESHOLD) numFooterLines = 2; //if footer not on one line, need to correct height for that: if (layout == "horizontal" && numFooterLines == 1) { minHeight += 10; } return new ws_tileOptions(defaultHeight, minHeight, maxHeight, numFooterLines); } function ws_getFooterInfo(width, layout, height, footerType, actualTextWidth){ //default to horizontal var footerX = 8; var footerX2 = width-4; if ( layout == "vertical") { footerX = 3; footerX2 = width-3; } //default to single line footer var footerY = height - WS_TILE_FOOTER_LINE_HEIGHT; var inputX = (actualTextWidth) ? actualTextWidth + 6 : 170; var inputY = 0; var numFooterLines = 1; if (width < WS_TILE_FOOTER_2_LINE_THRESHOLD) { footerY -= WS_TILE_FOOTER_LINE_HEIGHT; inputX = 0; inputY += WS_TILE_FOOTER_LINE_HEIGHT; numFooterLines = 2; } var inputW = footerX2 - footerX - 32 - inputX; //avail width - button - text-space return new ws_footerInfo(footerX, footerY, footerX2, inputX, inputY, inputW, numFooterLines); } function ws_getDefaultTileHeight( width, layout, footerType, showCommute ){ var options = ws_getTileOptions( width, layout, footerType, showCommute ); return options.defaultHeight; } function ws_getDefaultLayout(width, height){ return ( Number(width) < WS_TILE_LAYOUT_SWITCH_THRESHOLD || (Number(width)<=500 && Number(width)