<!--
//===========================================================
// ***USE OF THIS OBJECT ALSO REQUIRES THE jQuery LIBRARY***
//
// The floatISI object attempts to "intelligently" copy the
// existing IS on a page and then float the content at the 
// bottom of the page so a portion of the ISI is always seen. 
//
// For IE6 this requires a Javascript hack. In all other 
// browsers the standardized and widely accepted CSS 
// style "fixed" is used.
//
// To implement simply call the float ISI method. 
// The following parameters are required:
// footerSel - jQuery selector for the ISI element. This uses
//		stanadard jquery selectors (eg. # for id, . for class)
//		and should be a selector that will classify the ISI
//		HTML element.
// leftMargin - This can be used to "push" the floated ISI
//		element to the left and is commonly needed when the
//		originating element has a margin. It can also be used 
//		to "pull" the lement right by using a negative value.
// fixedOffset - used to offset the fixed ISI element in the
//		case of non-IE6 browsers. This is the number of pixels 
//		of the ISI content to appear on the page, usually 
//		the same or similar to the heightOffset value
// heightOffest - used to offset the floating element in IE6
//		browser this value determines how much off the element
//		appears on the page in pixels. A common value is 200.
//============================================================

var glbFloatISI;

function floatISI(footerSel, leftMargin, fixedOffset, heightOffset)
{
	//Preserve our object
	glbFloatISI = this;
	
	this.HEIGHT_OFFSET = heightOffset; //Adjust this to show more or less of the floated ISI
	this.FOOTER_SEL = footerSel;//'#safety'; //This is the jQuery footer selector
	this.NEW_FOOTER = 'scrollFooter'; //id name of our new footer scroll div
	this.LEFT_MARGIN = leftMargin; //the offset().left returns a slightly incorrect value from margins
	this.FIXED_OFFSET = fixedOffset - $(this.FOOTER_SEL).outerHeight(); //Use existing content before cloning

	//The scrolling and resizing functions
	this.doISIScroll;
	this.doISIResize;

	//Set up our "new" ISI that copies the original ISI for scrolling purposes
	this.glbClone = $('<div id="' + this.NEW_FOOTER + '"></div>');
	this.glbClone.insertAfter(this.FOOTER_SEL);

	//Make the background opaque
	this.glbClone.css('opacity', '1.0');
	this.glbClone.css('background-color', '#FFFFFF');
	this.glbClone.css('filter', '100');
	//this.glbClone.css('z-index', 1000000);
	this.glbClone.css('width', $(this.FOOTER_SEL).width() - this.LEFT_MARGIN);

	this.NEW_FOOTER = '#' + this.NEW_FOOTER;
	$(this.FOOTER_SEL).clone().appendTo(this.glbClone);
	
	//Now that we have cloned the content use it to calculate offset height
	this.FIXED_OFFSET = fixedOffset - this.glbClone.outerHeight();
	
	this.scrollISI;
	this.resizeISI;
	
	//I know this is less than ideal but use browser detection
	// to determine how to style/render the floating ISI
	if ($.browser.msie && ($.browser.version < 7.0))
	{

		$(this.NEW_FOOTER).css('position', 'absolute');
		this.scrollISI = function(){
			var top = $(glbFloatISI.FOOTER_SEL).offset().top;
			var pos = $(window).scrollTop() + $(window).height() - glbFloatISI.HEIGHT_OFFSET;
			$(glbFloatISI.NEW_FOOTER).css('top', pos > top ? top : pos);
		};
		
		this.resizeISI = function(){
			$(glbFloatISI.NEW_FOOTER).css('left', 
				$(glbFloatISI.FOOTER_SEL).offset().left + glbFloatISI.LEFT_MARGIN);
			glbFloatISI.scrollISI();
		};
	}
	else
	{
		$(this.NEW_FOOTER).css('position', 'fixed');
		$(this.NEW_FOOTER).css('bottom', this.FIXED_OFFSET);
		
		this.scrollISI = function(){
			var objFooter = $(glbFloatISI.NEW_FOOTER);
			
			if (objFooter.offset().top > $(glbFloatISI.FOOTER_SEL).offset().top)
			{
				if (objFooter.css('visibility') != 'hidden')
					objFooter.css('visibility', 'hidden');
			}
			else if (objFooter.css('visibility') == 'hidden')
			{
				objFooter.css('visibility', 'visible');
			}
		};
		
		//Do the same thing for scrolling and resizing
		this.resizeISI = this.scrollISI;
		
	}
	
	//Set the window resizing and scrolling functions
	$(window).scroll(function(){
		glbFloatISI.scrollISI();
	});
	$(window).resize(function(){
		glbFloatISI.resizeISI();
	});
	
	
	//Reposition when the window is ready, resize will call the scroll
	$(document).ready(function(){
		glbFloatISI.resizeISI();
	});

}
//-->
