
var zazaTrack='';
if (typeof ZaZaInstalled !='undefined'){zazaTrack='f'}
var ZaZaInstalled=1;
var InviteRepeats;
var zbrepeat=1;
var bInvited=0;
InviteRepeats=0;

	var zCustomInvitation='';
	
	if (zCustomInvitation=='')	{
	    var zazadiv = document.createElement('div');
		zazadiv.id = 'Zsmenu';
		zazadiv.style.cssText="background:#2468a7 !important;text-align:center; border:1px solid #330099; z-Index:100; display:none; position:absolute; top:100px; left:-235px;";
		zazadiv.innerHTML='<div id="Zsleft" style="float:left;"></div>';
		if (document.body)
			{
				if (document.body.firstChild)
				document.body.insertBefore(zazadiv, document.body.firstChild)
				else
				document.body.appendChild(zazadiv)
			}
		else 
			{
				document.write('<style>#Zsmenu {background:#2468a7 !important;text-align:center; border:1px solid #330099; z-Index:99; display:none; position:absolute; top:100px; left:-235px;} #Zsleft {float:left;}</style>');
				document.write('<div id="Zsmenu"><div id="Zsleft"></div></div>');
			}
		}
	
	var Zxxx = 0; var Zyyy = 0; var Zdist = ZdistX = ZdistY = 0; var Zstepx = 2; var Zstepy = 0; var Zmn = 'Zsmenu';
	var Zspeed = 2;
	var Zmutechime = '';

	var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
	if (stdDOM) {aDOM = 1;} else {ieDOM = document.all; if (ieDOM) {aDOM = 1;} else {
	var nsDOM = ((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) ==4)); if (nsDOM) {aDOM = 1;}}}
	function xDOM(objectId, wS) {
	if (stdDOM) {return wS?document.getElementById(objectId).style:document.getElementById(objectId);}
	if (ieDOM) {return wS?document.all[objectId].style:document.all[objectId];}
	if (nsDOM) {return document.layers[objectId];}
	}
	function objZWidth(objectID) {var obj = xDOM(objectID,0); if(obj.offsetWidth) return obj.offsetWidth; if (obj.clip) return obj.clip.width; return 0;}
	function objZHeight(objectID) {var obj = xDOM(objectID,0); if(obj.offsetHeight) return obj.offsetHeight; if (obj.clip) return obj.clip.height; return 0;}
	function setZObjVis(objectID,vis) {var objs = xDOM(objectID,1); objs.display = vis;}
	function moveZObjTo(objectID,x,y) {var objs = xDOM(objectID,1); objs.left = x; objs.top = y;}
	function pageZWidth() {return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;}
	function pageZHeight() {return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;}
	function posZLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset: document.documentElement.scrollLeft? document.documentElement.scrollLeft: document.body.scrollLeft? document.body.scrollLeft:0;}
	function posZTop() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset: document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop? document.body.scrollTop:0;}
	function Zdistance(s,e) {return Math.abs(s-e);}
	function Zdirection(s,e) {return s>e?-1:1;}
	function Zrate(a,b) {return a<b?a/b:1;}
	function Zstart() {Zxxx = -315; Zyyy = 200; var ZeX = 45; var ZeY = 100; Zdist = ZdistX = Zdistance(Zxxx,ZeX); ZdistY = Zdistance(Zyyy,ZeY); Zstepx *= -Zdirection(Zxxx,ZeX) * Zrate(ZdistX,ZdistY); Zstepy *= Zdirection(Zyyy,ZeY) * Zrate(ZdistY,ZdistX); Zmoveit();setZObjVis(Zmn,'none');}
	function Zmoveit() {var Zx = (posZLeft()+Zxxx) + 'px'; var Zy = (posZTop()+Zyyy) + 'px'; moveZObjTo(Zmn,Zx,Zy);}
	function Zmover() {if (Zdist > 0) {Zxxx += Zstepx; Zyyy += Zstepy; Zdist -= Math.abs(Zstepx);} Zmoveit(); setTimeout('Zmover()',Zspeed);}
	function Zslide() {if (Zstepx==-2){setZObjVis(Zmn,'inline');} else {setZObjVis(Zmn,'none');}Zdist = ZdistX; Zstepx = -Zstepx; Zmoveit(); setTimeout('Zmover()',Zspeed);return false;}
	//onload = Zstart;
	setTimeout('Zstart()',1000);
	window.onscroll = Zmoveit;
	//window.setTimeout('Zslide();',200);	
		

	XMLHTTP = function() {
	// The following two options are configurable
	// you don't need to change the rest. Plug & play!
	var _maximumRequestLength = 1500
	//https://
	
			var _apiURL = 'http://www1.zazachat.com/jsutil/getinvitationmessage.aspx?ip=38.107.191.83&zazac=3911'
		
	this.status = null
	this.statusText = null
	this.responseText = null
	this.responseXML = null
	this.synchronous = false
	this.readyState = 0
	this.onreadystatechange =  function() { }
	this.onerror = function() { }
	this.onload = function() { }
	this.abort = function() {
		_stop = true
		_destroyScripts()
	}
	this.getAllResponseHeaders = function() {
		// Returns all response headers as a string
		var result = ''
		for (property in _responseHeaders)
		result += property + ': ' + _responseHeaders[property] + '\r\n'
		return result
	}
	this.getResponseHeader = function(name) {
		// Returns a response header value
		// Note, that the search is case-insensitive
		for(property in _requestHeaders) {
		if(property.toLowerCase() == name.toLowerCase())
			return _responseHeaders[property]
		}
		return null
	}
	this.overrideMimeType = function(type) {
		_overrideMime = type
	}
	this.open = function(method, sync, userName, password) {
		// Setting the internal values
		if (!_checkParameters(method)) return
		_method = (method) ? method : ''
		_userName = (userName) ? userName : ''
		_password = (password) ? password : ''
		_setReadyState(1)
	}
	this.openRequest = function(method, sync, userName, password) {
		// This method is inserted for compatibility purposes only
		return this.open(method, sync, userName, password)
	}
	this.send = function(data) {
		if (_stop) return
		var src = _createQuery(data)
		_createScript(src)
	//    _setReadyState(2)
	}
	this.setRequestHeader = function(name, value) {
		// Set the request header. If the defined header
		// already exists (search is case-insensitive), rewrite it
		if (_stop) return
		for(property in _requestHeaders) {
		if(property.toLowerCase() == name.toLowerCase()) {
			_requestHeaders[property] = value; return
		}
		}
		_requestHeaders[name] = value
	}
	var zsLoc=escape(document.location)+'';
	var zzsLoc=zsLoc.replace(/#/g,'');
	var _method = ''
	var _url = ''
	var _userName = ''
	var _password = ''
	var _requestHeaders = {
		"HTTP-Referer": zzsLoc,
		"Content-Type": "application/x-www-form-urlencoded"
	}
	var _responseHeaders = { }
	var _overrideMime = ""
	var self = this
	var _id = ''
	var _scripts = []
	var _stop = false
	var _throwError = function(description) {
		// Stop script execution and run
		// the user-defined error handler
		//self.onerror(description)
		self.abort()
		return false
	}
	var _createQuery = function(data) {
		if(!data) data = ''
		var headers = ''
		for (property in _requestHeaders)
		headers += property + '=' + _requestHeaders[property] + '&'
		var originalsrc = '&za_id=' + _id
		var src = originalsrc
		var max =  _maximumRequestLength, request = []
		var total = Math.floor(src.length / max), current = 0
		while(src.length > 0) {
		var query = _apiURL + '&'
		+ 'za_id=' 
		+ '' + _id
		request.push(query)
		src = src.substr(max)
		}
		if(request.length == 1)
		src = _apiURL + '' + originalsrc
		else
		src = request
		return src
	}
	var _checkParameters = function(method) {
		// Check the method value (GET, POST, HEAD)
		// and the prefix of the url (http://)
		if(!method)
		return _throwError('Please, specify the query method (GET, POST or HEAD)')
		if(method.toLowerCase() != 'get' &&
		method.toLowerCase() != 'post' &&
		method.toLowerCase() != 'head')
		return _throwError('Please, specify either a GET, POST or a HEAD method')
		return true
	}
	var _createScript = function(src) {
		if ('object' == typeof src) {
		for(var i = 0; i < src.length; i++)
			_createScript(src[i])
		return
		}
		// Create the SCRIPT tag
		var script = document.createElement('script')
		script.src = src
		script.type = 'text/javascript'
		if (navigator.userAgent.indexOf('Safari'))
		script.charset = 'utf-8' // Safari bug
		if (document.getElementsByTagName('head')[0])
			script = document.getElementsByTagName('head')[0].appendChild(script)
		else
		  	script = document.appendChild(script)
		_scripts.push(script)
		return script
	}
	var _escape = function(string) {
		// Native escape() function doesn't quote the plus sign +
		string = escape(string)
		string = string.replace('+', '%2B')
		return string
	}
	var _destroyScripts = function() {
		// Removes the SCRIPT nodes used by the class
		for(var i = 0; i < _scripts.length; i++)
		_scripts[i].parentNode.removeChild(_scripts[i])
	}
	var _registerCallback = function() {
		// Register a callback variable (in global scope)
		// that points to current instance of the class
		_id = 'v' + Math.random().toString().substr(2)
		window[_id] = self
	}
	var _setReadyState = function(number) {
		// Set the ready state property of the class
		self.readyState = number
		self.onreadystatechange()
		if(number == 4) self.onload()
	}
	var _parseXML = function() {
		var type = self.getResponseHeader('Content-type') + _overrideMime
		if(!(type.indexOf('html') > -1 || type.indexOf('xml') > -1)) return
		if(document.implementation && document.implementation.createDocument) {
			var objDOMParser = new DOMParser()
			var xml = objDOMParser.parseFromString(self.responseText, "text/xml")
			self.responseXML = xml
		} else if (window.ActiveXObject) {
			var xml = new ActiveXObject('MSXML2.DOMDocument.3.0');
			xml.async = false;
			self.responseXML = xml.loadXML(self.responseText)
		} else {
			var xml = document.body.appendChild(document.createElement('div'))
			xml.style.display = 'none'
			xml.innerHTML = self.responseText
			_cleanWhitespace(xml, true)
			self.responseXML = xml.childNodes[0]
			document.body.removeChild(xml)
		}
	}
	var _cleanWhitespace = function(element, deep) {
		var i = element.childNodes.length; if(i == 0) return
		do {
		var node = element.childNodes[--i]
		if (node.nodeType == 3 && !_cleanEmptySymbols(node.nodeValue))
			element.removeChild(node)
		if (node.nodeType == 1 && deep)
			_cleanWhitespace(node, true)
		} while(i > 0)
	}
	var _cleanEmptySymbols = function(string) {
		string = string.replace('\r', '')
		string = string.replace('\n', '')
		string = string.replace(' ', '')
  		return (string.length == 0) ? false : true 
	}
	this._parse = function(object) {
		// Parse the received data and set all
		// the appropriate properties of the class
		if(_stop) return
		if(object.multipart) return
		if(!object.success)
		return _throwError(object.description)
		_responseHeaders = object.responseHeaders
		this.status = object.status
		this.statusText = object.statusText
		this.responseText = object.responseText
		_parseXML()
		_destroyScripts()
		_setReadyState(4)
	}
	_registerCallback()
	}



	window.setTimeout('ZaZaInvite()', 3000);

	function ZaZaInvite() {
		
		InviteRepeats=InviteRepeats+1;
		if (InviteRepeats>10)
		{
		zbrepeat=0;
		}
		if (zbrepeat==1) {
			
				var url = 'http://zazachat.zazasoftware.com/livechatclient/jsutil/getinvitationmessage.aspx?ip=38.107.191.83&zazac=3911'
			
			
			var transport = new XMLHTTP()

			transport.onerror = function(description) {
				//alert('Error: ' + description)
				return;
			}
			transport.onreadystatechange = function() {
				if(transport.readyState == 4)
					{
					//alert(transport.responseText);
					//alert('Total length of data received: ' + transport.responseText.length + '\r\nThese are the response headers:\r\n\r\n' + transport.getAllResponseHeaders())
					if (transport.responseText!='' && transport.responseText!=null  && transport.responseText!="0" && transport.responseText.indexOf('Server Error')==-1)
						{
						WriteZaZaMessage(transport.responseText,0);
						bInvited=1;
						zbrepeat=0;
						}
					}
			}
			
			transport.open('GET')
			
			pausecomp(200)
			transport.send()
			pausecomp(200)
			//setTimeout('ZaZaInvite()', 3000);

			if ((navigator.userAgent.indexOf('Opera') > -1) && (transport.responseText.length > 0) && (transport.responseText.indexOf('Server Error')==-1)) {

				WriteZaZaMessage(transport.responseText,0);
				zbrepeat=0;
			}

			window.setTimeout('ZaZaInvite()', 6000);
			return false
			}
	}
	
function CloseZaZaInvite() {
	Zslide();
	
		var url = 'http://zazachat.zazasoftware.com/livechatclient/jsutil/closeinvitationmessage.aspx?ipzazac=38.107.191.83|3911|11/20/2009 4:46:41 PM'
	

	var oImage = new Image;
	pausecomp(200);
    oImage.src = url;
    pausecomp(300);
    return false;
}

var zazaInvitation='';

if (typeof zInvitationMessage !='undefined'){
	zazaInvitation=zInvitationMessage;
	}
else
	{
	zazaInvitation='';
	}

function displayAutoInvite()
{
WriteZaZaMessage(zazaInvitation,1);
}


if (zazaInvitation!='' && bInvited==0) {
    if (0==0)
	{
		window.setTimeout('displayAutoInvite()',5000);
	}
	else
	{
	    window.setTimeout('displayAutoInvite()',0);
	}
}	

function pausecomp(millis) 
{
zadate = new Date();
var zcurDate = null;

do { var zcurDate = new Date(); } 
while(zcurDate-zadate < millis);
} 

var zazajava;
var zazareg = new RegExp('/');
var zazareferrer = escape(document.referrer);
var zazawindow='1763';

var zazapagetitle=escape(document.title);
var srnd;
var zazasShortPath = escape(window.location.pathname);

var zazasPath=escape(this.location);

if (zazasShortPath=='/')
{
	var zazasPage = escape(window.location.href);
}
else
{
	var zazasPage = escape(zazasShortPath.substring(zazasShortPath.lastIndexOf('/') + 1));
}
if ( !(navigator.javaEnabled()) ) {
  zazajava="No" ;
} else {
  zazajava="Yes" ;
}
var zazarand_no = Math.random();


var zazasRes;
var zazasDepth;
if (window.screen) {
zazasRes=screen.width + 'x' + screen.height;
zazasDepth=screen.colorDepth;
}

var zazaflashversion = 0;
var zazadetect = navigator.userAgent.toLowerCase();
var zazaOS,zazabrowser,zazaversion,zazathestring;

if (zazacheckIt('konqueror'))
{
	zazabrowser = "Konqueror";
	zazaOS = "Linux";
}
else if (zazacheckIt('msie')) zazabrowser = "Internet Explorer"
else if (zazacheckIt('firefox')) zazabrowser = "Firefox"
else if (zazacheckIt('chrome')) zazabrowser = "Google Chrome"
else if (zazacheckIt('safari')) zazabrowser = "Safari"
else if (zazacheckIt('omniweb')) zazabrowser = "OmniWeb"
else if (zazacheckIt('opera')) zazabrowser = "Opera"
else if (zazacheckIt('webtv')) zazabrowser = "WebTV";
else if (zazacheckIt('icab')) zazabrowser = "iCab"
else if (!zazacheckIt('compatible'))
{
	zazabrowser = "Netscape Navigator"
	zazaversion = zazadetect.charAt(8);
}
else zazabrowser = "Unknown";

if (!zazaversion) zazaversion = zazadetect.charAt(zazaplace + zazathestring.length);

function zazacheckIt(string)
{
	zazaplace = zazadetect.indexOf(string) + 1;
	zazathestring = string;
	return zazaplace;
}

function WriteZaZaMessage(zazames,AutoInvite)
{
	
		var url = "<img style='position:absolute;top:-5000px;left:-5000px;' width='1' height='1' src='http://zazachat.zazasoftware.com/livechatclient/jsutil/showninvitationmessage.aspx?ipzazac=38.107.191.83|3911|11/20/2009 4:46:41 PM' />"
	

	if (AutoInvite==1)
		{
		if (zCustomInvitation==''){
			document.getElementById("Zsleft").innerHTML = "<table bgcolor=#2468a7 border=0 cellpadding=2 width=300 cellspacing=2><tr><td align=center width=100% height=20 style='FONT-WEIGHT: bold;font-face:Tahoma ! important;font-size:15px ! important;color:#FF9900 ! important;'> Healing Water Online Live Help</td></tr><tr><td align=center style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FFFFFF ! important;'>" + zazames + "</td></tr><tr><td nowrap align=center height=30 style='white-space: pre;'><a style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FF9900 ! important;' href='javascript:void(0);' onclick='javascript:CloseZaZaInvite()'>No Thanks</a>&nbsp;&nbsp;&nbsp;<a style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FF9900 ! important;' href='javascript:void(0);' onclick=OpenZaZaChat()>Start Chat</a></td></tr></table>"+url;
			}
		else
			{
			document.getElementById("Zsleft").innerHTML = zazames+url;
			}
		}
	else
		{
		if (zCustomInvitation==''){
			document.getElementById("Zsleft").innerHTML = "<table bgcolor=#2468a7 border=0 cellpadding=2 width=300 cellspacing=2><tr><td align=center width=100% height=20 style='FONT-WEIGHT: bold;font-face:Tahoma ! important;font-size:15px ! important;color:#FF9900 ! important;'> Healing Water Online Live Help</td></tr><tr><td align=center style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FFFFFF ! important;'>" + zazames + "</td></tr><tr><td nowrap align=center height=30 style='white-space: pre;'><a style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FF9900 ! important;' href='javascript:void(0);' onclick='javascript:CloseZaZaInvite()'>No Thanks</a>&nbsp;&nbsp;&nbsp;<a style='font-face:Tahoma ! important;font-size:13px ! important;FONT-WEIGHT: bold ! important;color:#FF9900 ! important;' href='javascript:void(0);' onclick=Invitation()>Start Chat</a></td></tr></table>"+url;
			}
		else
			{
			document.getElementById("Zsleft").innerHTML = zazames+url;
			}
		}

	if (Zstepx==-2)
		{
		Zslide();
		if (Zmutechime != '1')
		{
			if (zazacheckIt('msie'))
			{
			var body = document.getElementsByTagName("body");
			var divE = document.createElement('bgsound');
			divE.id = "ZaZaSound";
			divE.style.position = "absolute";
			divE.style.left = "0px";
			divE.style.top = "0px";
			divE.hidden = "true";
			
				divE.src="http://zazachat.zazasoftware.com/livechatclient/sounds/bell.wav";
			
			divE.autostart="true";
			divE.loop="0"
			body[0].appendChild(divE);
			setTimeout("document.getElementsByTagName('body')[0].removeChild(document.getElementById('ZaZaSound'))", 3000);
			}
			else
			{
			var body = document.getElementsByTagName("body");
			var divE = document.createElement('embed');
			divE.id = "zaBellSound";
			divE.style.position = "absolute";
			divE.style.left = "-100px";
			divE.style.top = "-100px";
			divE.style.width = "0";
			divE.style.height = "0";
			divE.visible = "false";
			//divE.autostart="true";
			
				divE.src="http://zazachat.zazasoftware.com/livechatclient/sounds/bell.wav";
			
			body[0].appendChild(divE);
			setTimeout("document.getElementsByTagName('body')[0].removeChild(document.getElementById('zaBellSound'))", 3000);
			}
		}
		}
   

}

function OpenZaZaChat()
{
var wleft = (screen.width - 580-32) / 2;
var wtop = (screen.height - 420-96) / 2;
<!--HTTPS OR NOT: RELEASENOTE-->
	
		window.open('http://zazachat.zazasoftware.com/livechatclient/livechatvisitor.aspx?zzwindow=' + zazawindow + '&zazac=' + 3911,'zazachat','left=' + wleft + ',top=' + wtop + ',width=580,height=435,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');
	

    if (typeof Zstepx != 'undefined')
	{
    if (Zstepx==2) 
    {
    Zslide();
    }
    }
}
function Invitation()
{
var wleft = (screen.width - 580-32) / 2;
var wtop = (screen.height - 420-96) / 2;
	
	    window.open('http://zazachat.zazasoftware.com/livechatclient/livechat.aspx?fullname=Visitor&email=unknown_email@zazachat.com&zazames=zaza&zzwindow=' + zazawindow + '&zazac=' + 3911,'zazachat','left=' + wleft + ',top=' + wtop + ',width=580,height=435,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');
	
   
    Zslide();
}

if (('0'!='') && ('0'!=''))
{

		document.write("<a href=\"#\" onclick=\"OpenZaZaChat(); return false;\"><img width=0 height=0 alt='Live Chat Support' id=zazachatimg border=0 nocache src='http://zazachat.zazasoftware.com/livechatclient/functions/imageserver.ashx?zazac=" + 3911 + "&navname=" + zazabrowser + "&java=" + zazajava + "&referrer=" + zazareferrer + "&pagetitle=" + zazapagetitle + "&pageurl=" + zazasPath + "&page=" + zazasPage + "&zimg=" + -1 + "&sres=" + zazasRes + "&sdepth=" + zazasDepth + "&flash=" + zazaflashversion + "&custom1=&custom2=&custom3=&t=" +zazaTrack + "&d=0&rndstr=" + zazarand_no + "'></a>");
	

}
else
{

		document.write("<a href=\"#\" onclick=\"OpenZaZaChat(); return false;\"><img alt='Live Chat Support' id=zazachatimg border=0 nocache src='http://zazachat.zazasoftware.com/livechatclient/functions/imageserver.ashx?zazac=" + 3911 + "&navname=" + zazabrowser + "&java=" + zazajava + "&referrer=" + zazareferrer + "&pagetitle=" + zazapagetitle + "&pageurl=" + zazasPath + "&page=" + zazasPage + "&zimg=" + -1 + "&sres=" + zazasRes + "&sdepth=" + zazasDepth + "&flash=" + zazaflashversion + "&custom1=&custom2=&custom3=&t=" +zazaTrack + "&d=0&rndstr=" + zazarand_no + "'></a>");
	
}

var zazaContainer=document.getElementById('zazacontainer');
if (zazaContainer)
	{
	zazaContainer.style.display='inline';
	}
