	var oInterval;

	var result;
	var AlertType = 0;

	function Chat() {
		this.ClientID = 0;
		this.Chatting = 0;
		this.ChatDeny = 0;
		this.ChatRequest = 0;
		this.HostName = '';
		this.ClientName = '';
		this.ClientMail = '';
		this.History = '';
		this.Absence = 0;
		this.Browsing = 0;
		this.Timeout = 0;
		this.LastMessageID = 0;
		this.Waiting = false;
		this.Details = '';
		this.OldHistory = '';
		this.Navigation = '';
		this.SelectedTab = 1;
		this.SynchKey = '';
		this.Typing = false;
		this.WantsToChat = false;
	}
	
	function GetInnerSize () {
		var x;
		var y;
		if (self.innerHeight) {	// all except Explorer
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight) {	// Explorer 6 Strict Mode
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) {	// other Explorers
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		return [x,y];
	}


	function ResizeToInner(w, h) {
		window.resizeTo(screen.availWidth, screen.availHeight);
		var inner = GetInnerSize();
		var x = screen.availWidth - inner[0];
		var y = screen.availHeight - inner[1];
		window.resizeTo(w + x, h + y);
	}

	function getClientID(SiteID) {
		var CookieValue = getCookieLiveHelp("AshopLiveHelp_" + SiteID);
		if (isNaN(CookieValue)) {
			putClientID(0, SiteID);
			return 0;
		}
		if (CookieValue != null) {
			return CookieValue;
		}
		else {
			return 0;
		}
	}

	function putClientID(ClientID, SiteID) {
		setCookieLiveHelp(2, "AshopLiveHelp_" + SiteID, ClientID, 2400);
	}

	function getMonitorID() {
		return LiveHelpMonitorID;
	}

	function getTemplate(TemplateName) {
		var Template = document.getElementById(TemplateName).innerHTML.replace(/}/g, '>').replace(/{/g, '<');
		return Trim(Template);
	}

	function Trim(str) {
		return str.replace(/^\s+|\s+$/g,'');
	}

  function LoopStart(FunctionName, IntervalMs) {
	  eval("oInterval = window.setInterval(\"" + FunctionName + "()\"," + IntervalMs + ")");
  }

  function LoopStop() {
		window.clearInterval(oInterval);
	}

	function FormatText(str) {
		var FormattedStr = '';
		var SearchString = "http:";
		var StringStart = str.indexOf(SearchString);
		var StringEnd = str.indexOf(' ', StringStart);
		if (StringEnd <= 0)
			StringEnd = str.length;
		var NewStr = str.substring(StringStart, StringEnd);
		
		if (StringStart >= 0) {
			FormattedStr = "<a href=\"" + NewStr + "\" style=\"font-size: 11px;\">" + NewStr + "</a>";
			if (StringEnd < str.length) {
				FormattedStr += str.substring(StringEnd, str.length);
			}
			return FormattedStr;
		}
		else {
			return str;
		}
	}

	function IsIE(mb) {
		var rc = false;
		if(navigator.userAgent.indexOf("MSIE") > -1) {
			if(navigator.userAgent.indexOf("Opera") == -1) {
				if(null != mb) {
					if(navigator.userAgent.indexOf(mb)>-1)
						rc = true;
			}
			else
				rc = true;
			}
		}
		return rc;
	}

	function onComposeKeyPressed(obj, e){
		e = (e)? e : ((event)? event : null);
		var rc = true;
		try {
			if(IsIE()) {
				if(13 == event.keyCode) {
					if(event.shiftKey) {
					}
					else {
						SendMessage();
						rc = false;
					}
				}
			}
			else {
				if(null != e && null != e.which) {
					if(13 == e.which) {
						if(e.shiftKey) {
						}
						else {
							SendMessage();
							rc = false;
						}
					}
				}
			}
		}
		catch(gm) {
		}
		return rc;
	}

	function cancelKey(evt) {
		if (evt.preventDefault) {
			evt.preventDefault();
			return false;
		}
		else {
			evt.keyCode = 0;
			evt.returnValue = false; 
		}
	}

	function EvalSound(soundobj) {
		var thissound = eval("document." + soundobj);
		try {
			thissound.Play();
		}
		catch (e) {
			thissound.DoPlay();
		}
	}

	function Left(str, n){
		if (n <= 0)
			return "";
		else if (n > String(str).length)
			return str;
		else
			return String(str).substring(0,n);
	}

	function Right(str, n){
		if (n <= 0)
			return "";
		else if (n > String(str).length)
			return str;
		else {
			var iLen = String(str).length;
			return String(str).substring(iLen, iLen - n);
		}
	}
	