// JavaScript Document: set footer

		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 goHome(){
			document.location.href='http://www.presentsquared.com/index.htm'
		}
		function setFooter() {
			var footerElement = document.getElementById('footer');
			footerElement.style.cursor = 'pointer';
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var contentHeight = document.getElementById('content').offsetHeight;
					var contentBoxElement = document.getElementById('contentBox');
					
					var footerHeight  = footerElement.offsetHeight;
					if (windowHeight - (contentHeight + footerHeight) >= 0) {
						footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
						contentBoxElement.style.height = '100%';
						
					}
					else {
						contentBoxElement.style.height = 'auto';
						footerElement.style.top = '0px';
					}
				}
			}
			if(footerElement.attachEvent) footerElement.attachEvent('onclick',goHome);
			else footerElement.addEventListener('click',goHome, false);
			return true;
		}
		window.onload = function() {
			if(setFooter())	scrollDivRight('scroll');
		}
		window.onresize = function() {
			setFooter();
		}


//scroll window
var timerRight = 0;

function toLeft(id){ 
document.getElementById(id).scrollLeft=0 
} 

defaultStep=1;
step=defaultStep; 

function scrollDivRight(id){ 
	document.getElementById(id).scrollLeft+=step ;
	timerRight=setTimeout("scrollDivRight('"+id+"')",20) ;
} 

function scrollDivLeft(id){ 
document.getElementById(id).scrollLeft-=step ;
timerLeft=setTimeout("scrollDivLeft('"+id+"')",20) ;
} 

function toRight(id){ 
document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth  ;
} 

function toPoint(id){ 
document.getElementById(id).scrollLeft=100 ;
} 

//cart
function doCart(){
	document.getElementById('shoppingCartForm').submit();
}
//load profile form
function loadProfileForm(b){
	if(b) {
		window.setTimeout('gotoForm()',2000);
	}
}
function gotoForm(){
	document.location.href='Present2_ClientProfileSheet.pdf';
	//window.open('Present2_ClientProfileSheet.pdf');
}