
function floatBottom(bottomFloat,floatDirection,containFloatFlag,secondPushDownFlag)
{function computedDimension(element,property){if(window.getComputedStyle)
{return parseInt(document.defaultView.getComputedStyle(element,null).getPropertyValue(property));}
else if(element.currentStyle)
{var IE_cascadedStyle,hyphen,tempDiv,dimension;while((hyphen=property.indexOf('-'))!=-1)
{property=property.substr(0,hyphen).concat(property.charAt(hyphen+1).toUpperCase()).concat(property.substr(hyphen+2));}
IE_cascadedStyle=element.currentStyle[property];if(IE_cascadedStyle.match(/^\d+px$/))
{return parseInt(IE_cascadedStyle);}
else if(IE_cascadedStyle.match(/\d+(%|em|ex|pt|pc|in|mm|cm)$/))
{tempDiv=document.createElement("div");tempDiv.style.visibility='hidden';tempDiv.style.position='absolute';tempDiv.style.lineHeight=0;if(property.match(/(left|right|width)/))
{tempDiv.style.width=IE_cascadedStyle;element.parentNode.appendChild(tempDiv);dimension=tempDiv.offsetWidth;}
else
{tempDiv.style.height=IE_cascadedStyle;element.parentNode.appendChild(tempDiv);dimension=tempDiv.offsetHeight;}
element.parentNode.removeChild(tempDiv);return dimension;}
else if(property.match(/^border/))
{if(property.match(/Width$/)&&element.currentStyle[property.substr(0,property.indexOf('Width')).concat('Style')]!='none')
{tempDiv=document.createElement("div");tempDiv.style.width='0px';tempDiv.style.borderLeftStyle='solid';tempDiv.style.borderLeftWidth=IE_cascadedStyle;document.body.appendChild(tempDiv);dimension=tempDiv.offsetWidth;document.body.removeChild(tempDiv);return dimension;}
else
{return 0;}}
else
return IE_cascadedStyle;}}
function computedStyle(element,property){if(window.getComputedStyle)
return document.defaultView.getComputedStyle(element,null).getPropertyValue(property);else if(element.currentStyle)
return element.currentStyle[property];}
function posY(element){var y=0;if(element.offsetParent)
{do
{y+=element.offsetTop;}while(element=element.offsetParent);return y;}
else
return 0;}
function getPushDown(){return parentToWrap.offsetHeight-parentToWrapVerticalPaddingAndBorder-preExistingPushDown-bottomFloatTotalHeight;}
var newFloat,newFloat2,pushDownHeight,current_pushDownHeight=0;var iterations=5;var parentToWrap=bottomFloat.parentNode;while(computedStyle(parentToWrap,'display')!='block')parentToWrap=parentToWrap.parentNode;var preExistingPushDown=posY(bottomFloat)-posY(parentToWrap)-computedDimension(parentToWrap,'padding-top')-computedDimension(parentToWrap,'border-top-width')-computedDimension(bottomFloat,'margin-top');var bottomFloatTotalHeight=bottomFloat.offsetHeight+computedDimension(bottomFloat,'margin-top')+computedDimension(bottomFloat,'margin-bottom');var parentToWrapVerticalPaddingAndBorder=computedDimension(parentToWrap,'padding-bottom')+computedDimension(parentToWrap,'border-bottom-width')+computedDimension(parentToWrap,'padding-top')+computedDimension(parentToWrap,'border-top-width');;if(bottomFloat)
{newFloat=document.createElement('div');bottomFloat.parentNode.insertBefore(newFloat,bottomFloat);newFloat.className='push-down';newFloat.style.width='1px';floatDirection=floatDirection.substr(0,1).toLowerCase()=='r'?'right':'left';newFloat.style.cssFloat=floatDirection;newFloat.style.styleFloat=floatDirection;newFloat.style.clear=floatDirection;bottomFloat.style.cssFloat=floatDirection;bottomFloat.style.styleFloat=floatDirection;bottomFloat.style.clear=floatDirection;do
{pushDownHeight=getPushDown();if(pushDownHeight>current_pushDownHeight)
{newFloat.style.height=pushDownHeight.toString().concat('px');}
else if(pushDownHeight<0)
{newFloat.style.height='0px';pushDownHeight=getPushDown();if(pushDownHeight>0)
{newFloat.style.width=bottomFloat.offsetWidth.toString().concat('px');newFloat.style.marginLeft=computedStyle(bottomFloat,'margin-left');newFloat.style.marginRight=computedStyle(bottomFloat,'margin-right');newFloat.style.height=pushDownHeight.toString().concat('px');}
else if(containFloatFlag)
{if(navigator.appName=='Microsoft Internet Explorer'&&navigator.appVersion.indexOf('MSIE 6.0')!=-1)
{if(parentToWrap.currentStyle['height']=='auto')parentToWrap.style.height='1%';}
else
parentToWrap.style.minHeight=(bottomFloat.offsetHeight+posY(bottomFloat)-posY(parentToWrap)-computedDimension(parentToWrap,'padding-top')).toString().concat('px');}
break;}
else
{pushDownHeight=parseInt(newFloat.style.height);do
{newFloat.style.height=(--pushDownHeight).toString().concat('px');}while(pushDownHeight>getPushDown());if(pushDownHeight<getPushDown()&&secondPushDownFlag)
{bottomFloat.style.marginTop=(computedDimension(bottomFloat,'margin-top')+getPushDown()-pushDownHeight).toString().concat('px');}
break;}
current_pushDownHeight=pushDownHeight;}while(iterations--);}};