// -----------------------------------------------------------------------------------
//
//	LiftHimHigh.js
//	by LiftHimHigh.com Rockstar Developers!!!
//
//	STOP LOOKING...THIS CODE IS ENCRYPTED!! Just kidding! Hey, we'll make you a deal.
//  Look but don't touch, ok? Deal!! ;-)
//
//	Well, we did BORROW some code from Spry. :-)
//
// -----------------------------------------------------------------------------------

function LiftHimHigh(){
	this.sessionTimeout = 29; //set it to 29 to ensure the session exists so we can properly clear from the log
	this.sessionStart = new Date();
	this.timout = -1;
}

LiftHimHigh.prototype.startSessionTimer = function(){
	if(this.timout != -1){
		clearTimeout(this.timout);
	}
	this.timout = setTimeout(this.handleSessionTimeout, this.sessionTimeout*(60*1000)); //timeout * (60 seconds/min * 1000 milliseconds/second));
}

LiftHimHigh.prototype.handleSessionTimeout = function(){
	alert("Your session has ended. You need to log in again to continue.\n\nFor your convenience, your shopping cart has been saved to your wishlist.");
	
	lhh.redirect("/products.cfm?logout");
}

LiftHimHigh.prototype.redirect = function(location){
	window.location = location;
}

LiftHimHigh.prototype.confirmAndRedirect = function(message, location){
	if(confirm(message)){
		lhh.redirect(location);
	}
}

/**
	Returns a(the) dom element(s) passed in
	
	param element A string value of the element you are looking for
	param ... A rest parameter
	
	returns string
**/
LiftHimHigh.prototype.$ = function(element){
	if (arguments.length > 1){
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			elements.push(lhh.$(arguments[i]));
		return elements;
	}
	if (typeof element == "string") element = document.getElementById(element);

	return element;
}

var lhh = new LiftHimHigh();