///////////////////////////////////////////////////////////////////////////////
// COPYRIGHT 2008 www.FloatingActionButton.com //
// A WebCodeTechnology.com product //
// //
// All Rights Reserved //
///////////////////////////////////////////////////////////////////////////////
image1 = new Image();
image1.src = "/fab/images/closeX.png";
image1b = new Image();
image1b.src = "/fab/images/closeX2.png";
image2 = new Image();
image2.src = "/fab/images/FabYR.png";
image3 = new Image();
image3.src = "/fab/images/FabMIM.png";
image4 = new Image();
image4.src = "/fab/images/FabHIM.png";
image9 = new Image();
image9.src = "/fab/images/fabad.png";
image9b = new Image();
image9b.src = "/fab/images/fabad2.png";
// Position Constants
var LEFT = 1;
var MIDDLE = 2;
var RIGHT = 3;
var TOP = 1;
var BOTTOM =3;
// Selected Position of Button
var hAlign = RIGHT;
var vAlign = TOP;
// Padding/Margin Left/Right Margin Top/Bottom Margin
var fabHMargin = 1;
var fabVMargin = 3;
var fabStartDelay = 0;
var fabSlideTime = 0;
var fabOpacity = 0.97;
xAddEventListener(window, 'load',
function () {
var e = xCreateElement('DIV');
e.id = "divActionButton";
e.style.backgroundColor = "";
e.style.padding = "1";
xInnerHtml(e, "
");
document.body.appendChild(e);
xOpacity("divActionButton",fabOpacity);
setTimeout("winOnResize()",fabStartDelay);
xAddEventListener(window, 'resize', winOnResize, false);
xAddEventListener(window, 'scroll', winOnScroll, false);
}, false
);
function closeFab() {
xVisibility('divActionButton', false);
}
function winOnResize() {
xMoveTo('divActionButton', calculateXpos(), calculateYpos());
xVisibility('divActionButton', true);
winOnScroll(); // initial slide
}
function winOnScroll() {
xSlideTo('divActionButton', calculateXpos(), calculateYpos(), fabSlideTime);
}
function calculateXpos() {
switch(hAlign) {
case LEFT: return fabHMargin;
case MIDDLE: return (xClientWidth()/2) - (xWidth('divActionButton')/2);
case RIGHT: return xClientWidth()-xWidth('divActionButton') - fabHMargin;
}
}
function calculateYpos() {
switch(vAlign) {
case TOP: return xScrollTop() + fabVMargin;
case MIDDLE: return xScrollTop() + ((xClientHeight()/2) - (xHeight('divActionButton')/2));
case BOTTOM: return xScrollTop() + xClientHeight()-xHeight('divActionButton') - fabVMargin;
}
}
// XBrowser Functions below
/* Compiled from X 4.17 by XC 1.06 on 17Nov07 */
xLibrary={version:'4.17',license:'GNU LGPL',url:'http://cross-browser.com/'};
// xAddEventListener r8, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xAddEventListener(e,eT,eL,cap)
{
if(!(e=xGetElementById(e)))return;
eT=eT.toLowerCase();
if(e.addEventListener)e.addEventListener(eT,eL,cap||false);
else if(e.attachEvent)e.attachEvent('on'+eT,eL);
else {
var o=e['on'+eT];
e['on'+eT]=typeof o=='function' ? function(v){o(v);eL(v);} : eL;
}
}
// xCamelize r1, Copyright 2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xCamelize(cssPropStr)
{
var i, c, a = cssPropStr.split('-');
var s = a[0];
for (i=1; iw.innerWidth) v-=16;
}
return v;
}
// xClientWidth r5, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xClientWidth()
{
var v=0,d=document,w=window;
if((!d.compatMode || d.compatMode == 'CSS1Compat') && !w.opera && d.documentElement && d.documentElement.clientWidth)
{v=d.documentElement.clientWidth;}
else if(d.body && d.body.clientWidth)
{v=d.body.clientWidth;}
else if(xDef(w.innerWidth,w.innerHeight,d.height)) {
v=w.innerWidth;
if(d.height>w.innerHeight) v-=16;
}
return v;
}
// xDef r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xDef()
{
for(var i=0; i=0) {
var pt=0,pb=0,bt=0,bb=0;
if (document.compatMode=='CSS1Compat') {
var gcs = xGetComputedStyle;
pt=gcs(e,'padding-top',1);
if (pt !== null) {
pb=gcs(e,'padding-bottom',1);
bt=gcs(e,'border-top-width',1);
bb=gcs(e,'border-bottom-width',1);
}
// Should we try this as a last resort?
// At this point getComputedStyle and currentStyle do not exist.
else if(xDef(e.offsetHeight,e.style.height)){
e.style.height=h+'px';
pt=e.offsetHeight-h;
}
}
h-=(pt+pb+bt+bb);
if(isNaN(h)||h<0) return;
else e.style.height=h+'px';
}
h=e.offsetHeight;
}
else if(css && xDef(e.style.pixelHeight)) {
if(h>=0) e.style.pixelHeight=h;
h=e.style.pixelHeight;
}
return h;
}
// xLeft r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xLeft(e, iX)
{
if(!(e=xGetElementById(e))) return 0;
var css=xDef(e.style);
if (css && xStr(e.style.left)) {
if(xNum(iX)) e.style.left=iX+'px';
else {
iX=parseInt(e.style.left);
if(isNaN(iX)) iX=xGetComputedStyle(e,'left',1);
if(isNaN(iX)) iX=0;
}
}
else if(css && xDef(e.style.pixelLeft)) {
if(xNum(iX)) e.style.pixelLeft=iX;
else iX=e.style.pixelLeft;
}
return iX;
}
// xMoveTo r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xMoveTo(e,x,y)
{
xLeft(e,x);
xTop(e,y);
}
// xNum r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xNum()
{
for(var i=0; i=0) {
var pl=0,pr=0,bl=0,br=0;
if (document.compatMode=='CSS1Compat') {
var gcs = xGetComputedStyle;
pl=gcs(e,'padding-left',1);
if (pl !== null) {
pr=gcs(e,'padding-right',1);
bl=gcs(e,'border-left-width',1);
br=gcs(e,'border-right-width',1);
}
// Should we try this as a last resort?
// At this point getComputedStyle and currentStyle do not exist.
else if(xDef(e.offsetWidth,e.style.width)){
e.style.width=w+'px';
pl=e.offsetWidth-w;
}
}
w-=(pl+pr+bl+br);
if(isNaN(w)||w<0) return;
else e.style.width=w+'px';
}
w=e.offsetWidth;
}
else if(css && xDef(e.style.pixelWidth)) {
if(w>=0) e.style.pixelWidth=w;
w=e.style.pixelWidth;
}
return w;
}
// xCreateElement r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xCreateElement(sTag)
{
if (document.createElement) return document.createElement(sTag);
else return null;
}
// xInnerHtml r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xInnerHtml(e,h)
{
if(!(e=xGetElementById(e)) || !xStr(e.innerHTML)) return null;
var s = e.innerHTML;
if (xStr(h)) {e.innerHTML = h;}
return s;
}