﻿// JScript File
Event.observe(window, 'load', init, false);
function init(){}

Event.observe(window, "resize", function(){
    //adjustContentHeight();
});



$('foo').observe('click', respondToClick);
function respondToClick(event) {
  Modalbox.show($('longTextContent'), {title: this.title, aspnet: true}); 
}


function toggleBrands() {
    $('AllBrands').toggle();
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter(fid) {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('MainBox').offsetHeight;  
			var footerElement = document.getElementById(fid);
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'absolute';
				footerElement.style.top = (windowHeight - footerHeight) - 50 + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}

function adjustContentHeight(){
    if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
            var contentElement = $('MainBox');
	        var contentHeight = contentElement.getHeight();  
						
	        var footerElement = $('Footer');
	        var footerHeight  = footerElement.getHeight();
			
	        contentElement.style.height = (windowHeight - footerHeight) + 'px';
	    }
	}
}

