<!--
// Live Help Server Version: 3.90 Rev. 8
// Database Version: 3.90
// stardevelop.com Live Help International Copyright 2003

var LiveHelp = function() {

var server = 'http://sharpercards.com';
var domain = '.sharpercards.com';
var pages = '0';

var LiveHelpXMLHTTP = null;
var statusImagesLiveHelp = new Array();
var currentStatus = '';

var posLeft = (screen.width - 625) / 2;
var posTop = (screen.height - 435) / 2;
var size = 'height=435,width=625,top=' + posTop + ',left=' + posLeft + ',resizable=1,toolbar=0,menubar=0';


function strTrim(str) {
	if (!str || str == '') { return ''; }
	return str.replace(/^\s+|\s+$/g, '');
}

var LiveHelpWindow = '';
var OfflineEmail = -1;
currentStatus = 'Online';


return {

	LiveHelpWindow: LiveHelpWindow,
	OfflineEmail: OfflineEmail,
	currentStatus: currentStatus,
	size: size,
	statusImagesLiveHelp: statusImagesLiveHelp,
	acceptInitiateChat: function () {
		acceptInitiateChat();
	},
	declineInitiateChat: function () {
		declineInitiateChat();
	},
	currentTime: function () {
		currentTime();
	},
	resetLayerLocation: function() {
		resetLayerLocation();
	},
	floatRefresh: function() {
		floatRefresh();
	},
	toggleInitiateChat: function() {
		toggleInitiateChat('floatLayer');
	},
	swapImage: function(a, b, c, d) {
		swapImage(a, b, c, d);
	}

};

}();


function openLiveHelp(department, location, template) {

	if (LiveHelp.OfflineEmail == 0 && LiveHelp.currentStatus != 'Online') {
		return false;
	} else {
	
		if (typeof location == 'undefined' || location == '') { var location = 'index.php'; }
		if (typeof department == 'undefined' || department == '') { var department = ''; } else { department = '&DEPARTMENT=' + department; }
		if (typeof template == 'undefined' || template == '') { var template = ''; } else { template = '&TEMPLATE=' + template; }
	
		// TODO: Remove All # invalid characters
		LiveHelp.LiveHelpWindow = window.open('http://sharpercards.com/livehelp/' + location + '?LANGUAGE=en' + department + template, 'LiveHelpsharpercardscom', LiveHelp.size);
		
	}
	if (LiveHelp.LiveHelpWindow) { LiveHelp.LiveHelpWindow.opener = self; }
}

function displayInitiateChat() {

	if (LiveHelp.initiateOpen == 0 || LiveHelp.initiateLoaded == 1) {
	
		LiveHelp.resetLayerLocation();
		
		var obj;
		if (document.getElementById) {
			obj = document.getElementById('floatLayer');
			if (obj != null) { obj.style.top = LiveHelp.topMargin + 'px'; obj.style.left = LiveHelp.leftMargin + 'px'; }
		} else if (document.all) {
			obj = document.all['floatLayer'];
			if (obj != null) { obj.style.pixelTop = LiveHelp.topMargin + 'px'; obj.style.pixelLeft = LiveHelp.leftMargin + 'px'; }
		} else if (document.layers) {
			obj = document.layers['floatLayer'];
			if (obj != null) { obj.top = LiveHelp.topMargin + 'px'; obj.left = LiveHelp.leftMargin + 'px'; }
		}
		
		if (obj != null) {

			var openingTrackerStatus = new Image;
			openingTrackerStatus.src = 'http://sharpercards.com/livehelp/include/tracker.php?INITIATE=Opened';
		
			if (document.getElementById) { document.getElementById('floatLayer').location = 'http://sharpercards.com/livehelp/include/tracker.php?INITIATE=Opened'; }
			else if (document.layers) { document.layers['floatLayer'].location = 'http://sharpercards.com/livehelp/include/tracker.php?INITIATE=Opened'; }
			else if (document.all) { document.all['floatLayer'].location = 'http://sharpercards.com/livehelp/include/tracker.php?INITIATE=Opened'; }

			LiveHelp.floatRefresh();
	
			LiveHelp.toggleInitiateChat();
			LiveHelp.initiateOpen = 1; LiveHelp.initiateLoaded = 0; LiveHelp.initiateAuto = 0;
		}
	}
}

function acceptInitiateChat() {
	LiveHelp.acceptInitiateChat();
}

function declineInitiateChat() {
	LiveHelp.declineInitiateChat();
}

function changeStatus(status) {

	var statusImage = new Image;
	var statusImageFile;
	switch (status) {
		case 'Online':
			statusImageFile = '/livehelp/locale/en/images/Online.png';
			break;
		case 'BRB':
			statusImageFile = '/livehelp/locale/en/images/Offline.png';
			break;
		case 'Away':
			statusImageFile = '/livehelp/locale/en/images/Offline.png';
			break;
		default:
			statusImageFile = '/livehelp/locale/en/images/Offline.png';
			break;
	}
	
	var time = LiveHelp.currentTime();
	if (LiveHelp.currentStatus != '' && LiveHelp.currentStatus != status) {
	
		for (i = 0; i < LiveHelp.statusImagesLiveHelp.length; i++) {
			if (LiveHelp.statusImagesLiveHelp[i] != null) {
				// Determine if there is an alternate image path find IMAGES= variable within statusImagesLiveHelp[i].src
				var getImageLocation = LiveHelp.statusImagesLiveHelp[i].src.indexOf('IMAGES=');
				var getDepartment = LiveHelp.statusImagesLiveHelp[i].src.indexOf('DEPARTMENT=');
				var getCallback = LiveHelp.statusImagesLiveHelp[i].src.indexOf('CALLBACK=');
				
				statusImage.src = statusImageFile;
				if (getImageLocation != -1) {
					// Load the IMAGES path into a variable
					var statusImageDirectory = LiveHelp.statusImagesLiveHelp[i].src.substring(getImageLocation + 7);
					if (getDepartment == -1) {
						var filenamePos = statusImageFile.lastIndexOf('/');
						if (filenamePos != -1) {
							statusImage.src = statusImageDirectory + statusImageFile.substring(filenamePos + 1) + '?IMAGES=' + statusImageDirectory + '&TIME=' + time;
						}
					}
				}
			
				if (getDepartment != -1) {
					// Load the DEPARTMENT path into a variable
					var department = LiveHelp.statusImagesLiveHelp[i].src.substring(getDepartment + 11);
					var endRequestPos = department.lastIndexOf('&');
					if (endRequestPos != -1) {
						statusImage.src = 'http://sharpercards.com/livehelp/include/status.php?DEPARTMENT=' + department.substring(0, endRequestPos) + '&IMAGES=' + statusImageDirectory + '&TIME=' + time;
					}
				}
			
				if (getCallback != -1) {
					// Load the CALLBACK path into a variable
					statusImage.src = 'http://sharpercards.com/livehelp/include/status.php?CALLBACK=1&TIME=' + time;
				}
			
				LiveHelp.statusImagesLiveHelp[i].onload = null;
				LiveHelp.swapImage(LiveHelp.statusImagesLiveHelp[i].id, '', statusImage.src, 1);
			}
		}
	}

	LiveHelp.currentStatus = status;
	
	if (status == 'Offline' && LiveHelp.trackingInitalized == 0) {
			window.clearTimeout(LiveHelp.TrackingTimer);
	}
}

//-->

