var chatWindow;
function openChatWindow(url)
{
	chatWindow=window.open(url,'chatWindow','height=600,width=700,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,left=200,top=100');
	if (window.focus) {chatWindow.focus()}
}

function closeChat() {
	try {
		//window.opener.location.href = 'http://www.colehamels.com/chat/default/index/finishchat';
		window.opener.focus();
		self.close();
	} catch(e) {
		
	}
}


function convertSecondsToString(seconds) {
	try {
		function format(x) {
			//return ((x>9)?"":"0")+x;
			return x;
		}
		var str;
		if (seconds > 0) {
			var minutes = Math.floor(seconds/60);
			seconds = seconds % 60;
			str = format(seconds) + "secs";
			
			var hr = Math.floor(minutes/60);
			minutes = minutes % 60;
			str = format(minutes) + "mins " + str;
			
			var day = Math.floor(hr/60);
			hr = hr % 60;
			str = format(hr) + "Hrs " + str;
			if (day > 0) str = day + "days " + str;
		} else {
			str = "0hrs 0mins 0secs";
		}
		return str;
	} catch(e) {
		
	}
}

function stripWhiteSpace(val) {
    return (val.replace(/^\s+/,'')).replace(/\s+$/,'');
}

