/**
* box-sizing Polyfill
*
* A polyfill for box-sizing: border-box for IE6 & IE7.
*
* JScript
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* See <http://www.gnu.org/licenses/lgpl-3.0.txt>
*
* @category  JScript
* @package   box-sizing-polyfill
* @author    Christian Schepp Schaefer <schaepp@gmx.de> <http://twitter.com/derSchepp>
* @copyright 2012 Christian Schepp Schaefer
* @license   http://www.gnu.org/copyleft/lesser.html The GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0
* @link      http://github.com/Schepp/box-sizing-polyfill
*
* PREFACE:
*
* This box-sizing polyfill is based on previous work done by Erik Arvidsson,
* which he published in 2002 on http://webfx.eae.net/dhtml/boxsizing/boxsizing.html.
*
* USAGE:
*
* Add the behavior/HTC after every `box-sizing: border-box;` that you assign:
*
* box-sizing: border-box;
* *behavior: url(/scripts/boxsizing.htc);`
*
* Prefix the `behavior` property with a star, like seen above, so it will only be seen by
* IE6 & IE7, not by IE8+ who already implement box-sizing.
*
* The URL to the HTC file must be relative to your HTML(!) document, not relative to your CSS.
* That's why I'd advise you to use absolute paths like in the example.
*
*/
<component lightWeight="true">
<attach event="onpropertychange" onevent="checkPropertyChange()" />
<attach event="ondetach" onevent="restore()" />
<attach event="onresize" for="window" onevent="update()" />
<script type="text/javascript">
//<![CDATA[
var viewportwidth="undefined"!=typeof window.innerWidth?window.innerWidth:element.document.documentElement.clientWidth,doc=element.document,resizetimeout=null,apply=!1;switch(element.nodeName){case "#comment":case "HTML":case "HEAD":case "TITLE":case "SCRIPT":case "STYLE":case "LINK":case "META":break;default:apply=!0}function update(){null!==resizetimeout&&window.clearTimeout(resizetimeout);resizetimeout=window.setTimeout(function(){restore();init();resizetimeout=null},100)}
function restore(){apply&&(element.runtimeStyle.removeAttribute("width"),element.runtimeStyle.removeAttribute("height"))}function init(){apply&&(updateBorderBoxWidth(),updateBorderBoxHeight())}
function checkPropertyChange(){if(apply){var a=event.propertyName;"style.boxSizing"===a&&""===element.style.boxSizing&&(element.style.removeAttribute("boxSizing"),element.runtimeStyle.removeAttribute("boxSizing"),element.runtimeStyle.removeAttribute("width"),element.runtimeStyle.removeAttribute("height"));switch(a){case "style.width":case "style.borderLeftWidth":case "style.borderLeftStyle":case "style.borderRightWidth":case "style.borderRightStyle":case "style.paddingLeft":case "style.paddingRight":updateBorderBoxWidth();break;
case "style.height":case "style.borderTopWidth":case "style.borderTopStyle":case "style.borderBottomWidth":case "style.borderBottomStyle":case "style.paddingTop":case "style.paddingBottom":updateBorderBoxHeight();break;case "className":case "style.boxSizing":updateBorderBoxWidth(),updateBorderBoxHeight()}}}
function getPixelValue(a){if(/^\d+(px)?$/i.test(a))return parseInt(a);var b=element.style.left,c=element.runtimeStyle.left;element.runtimeStyle.left=element.currentStyle.left;element.style.left=a||0;a=parseInt(element.style.pixelLeft);element.style.left=b;element.runtimeStyle.left=c;return a}
function getPixelWidth(a,b){if(/^\d+(px)?$/i.test(b))return parseInt(b);if(/^[\d\.]+%$/i.test(b)){try{parentWidth=getPixelWidth(a.parentElement,"auto"!=a.parentElement.currentStyle.width?a.parentElement.currentStyle.width:"100%"),b=parseFloat(b)/100*parentWidth}catch(c){b=parseFloat(b)/100*element.document.documentElement.clientWidth}return parseInt(b)}var d=a.style.left,e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;b=parseInt(a.style.pixelLeft);a.style.left=d;a.runtimeStyle.left=
e;return b}
function getPixelHeight(a,b){if(/^\d+(px)?$/i.test(b))return parseInt(b);if(/^[\d\.]+%$/i.test(b)){try{if("auto"!=a.parentElement.currentStyle.height){switch(a.parentElement.nodeName){default:parentHeight=getPixelHeight(a.parentElement,a.parentElement.currentStyle.height);b="auto"!==parentHeight?parseFloat(b)/100*parentHeight:"auto";break;case "HTML":parentHeight=element.document.documentElement.clientHeight,b="auto"!==parentHeight?parseFloat(b)/100*parentHeight:"auto"}"auto"!==b&&(b=parseInt(b))}else b="auto"}catch(c){b=
"auto"}return b}var d=a.style.left,e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;b=parseInt(a.style.pixelLeft);a.style.left=d;a.runtimeStyle.left=e;return b}function getBorderWidth(a){return"none"==element.currentStyle["border"+a+"Style"]?0:getPixelValue(element.currentStyle["border"+a+"Width"])||0}function getBorderLeftWidth(){return getBorderWidth("Left")}function getBorderRightWidth(){return getBorderWidth("Right")}
function getBorderTopWidth(){return getBorderWidth("Top")}function getBorderBottomWidth(){return getBorderWidth("Bottom")}function getPadding(a){return getPixelValue(element.currentStyle["padding"+a])||0}function getPaddingLeft(){return getPadding("Left")}function getPaddingRight(){return getPadding("Right")}function getPaddingTop(){return getPadding("Top")}function getPaddingBottom(){return getPadding("Bottom")}
function getBoxSizing(){var a=element.style,b=element.currentStyle;return"undefined"!=typeof a.boxSizing&&""!=a.boxSizing?a.boxSizing:"undefined"!=typeof a["box-sizing"]&&""!=a["box-sizing"]?a["box-sizing"]:"undefined"!=typeof b.boxSizing&&""!=b.boxSizing?b.boxSizing:"undefined"!=typeof b["box-sizing"]&&""!=b["box-sizing"]?b["box-sizing"]:getDocumentBoxSizing()}function getDocumentBoxSizing(){return null===doc.compatMode||"BackCompat"===doc.compatMode?"border-box":"content-box"}
function setBorderBoxWidth(a){element.runtimeStyle.width=Math.max(0,a-getBorderLeftWidth()-getPaddingLeft()-getPaddingRight()-getBorderRightWidth())+"px"}function setBorderBoxHeight(a){element.runtimeStyle.height=Math.max(0,a-getBorderTopWidth()-getPaddingTop()-getPaddingBottom()-getBorderBottomWidth())+"px"}function setContentBoxWidth(a){element.runtimeStyle.width=Math.max(0,a+getBorderLeftWidth()+getPaddingLeft()+getPaddingRight()+getBorderRightWidth())+"px"}
function setContentBoxHeight(a){element.runtimeStyle.height=Math.max(0,a+getBorderTopWidth()+getPaddingTop()+getPaddingBottom()+getBorderBottomWidth())+"px"}function updateBorderBoxWidth(){if(getDocumentBoxSizing()!=getBoxSizing()){var a=element.currentStyle.width;"auto"!=a&&(a=getPixelWidth(element,a),"border-box"==getBoxSizing()?setBorderBoxWidth(parseInt(a)):setContentBoxWidth(parseInt(a)))}}
function updateBorderBoxHeight(){if(getDocumentBoxSizing()!=getBoxSizing()){var a=element.currentStyle.height;"auto"!=a&&(a=getPixelHeight(element,a),"auto"!==a&&("border-box"==getBoxSizing()?setBorderBoxHeight(parseInt(a)):setContentBoxHeight(parseInt(a))))}}init();
//]]>
</script>
</component>