//Compatibility Javascript, for cross-browser coding.var domain = ""; // |domain=www.bostontech.com; |function HTMLGetElementById(hDoc, hID){	//Function: HTMLGetElementByID	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.9 [to test]	//Purpose: Grab a pointer reference to an object regardless of platform.	//		var hElem;		try	{		//IE		hElem = hDoc.all(hID);	}	catch(e)	{		//NS, Mozilla codebase		try		{			hElem = hDoc.getElementById(hID);		}		catch(e)		{			//Neither browser, some other error. Object not found? Fault. Non-terminal.			errorHandle(false, e.message, e.lineNumber, "", e.number & 0xFFFF, "", "HTMLCompat.js", "Other", "In HTMLGetElementById(hDoc, hID): hDoc=" + sstr(hDoc) + " hID=" + sstr(hID));			e = new Error();			e.message = "Exception: Couldn't grab HTML Element in HTMLGetElementByID(): hDoc=" + sstr(hDoc) + " hID=" + sstr(hID);			e.name = "HTMLException";			throw e;		}	}		return hElem;}function HTMLGEBI(hDoc, hID){	//Function: HTMLGEBI - wrapper for HTMLGetElementByID	//Programmer: Daniel J. Boston	//Date: June 4, 2004 - one for all the lazy fellers out there.		return HTMLGetElementById(hDoc, hID);}function HTMLElementAppendText(hElem, hStr){	//Function: HTMLElementAppendText	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.9 [to test]	//Purpose: Append text to the inside tag of an HTML element regardless of platform.	//	// Note: This is an append function, not a replace, remove, or get function. It adds	// 		text to the end of an object without changing the previous contents.		var success = false;		try	{		//IE		hElem.insertAdjacentText("BeforeEnd", sstr(hStr));		success = true;	}	catch(e)	{		try		{			//NS, Mozilla Codebase			hElem.appendChild(hElem.ownerDocument.createTextNode(sstr(hStr)));			success = true;		}		catch(e)		{			//Neither browser, some other error. Object doesn't exit? Fault. Non-terminal.			errorHandle(false, e.message, e.lineNumber, "", e.number & 0xFFFF, "", "HTMLCompat.js", "Other", "In HTMLElementAppendText(hElem, hStr): hElem=" + sstr(hElem) + " hID=" + sstr(hStr));			e = new Error();			e.message = "Exception: Couldn't append text to HTML Element in HTMLElementAppendText(): hElem=" + sstr(hElem) + " hStr=" + sstr(hStr);			e.name = "HTMLException";			throw e;		}	}		return success;}function HTMLEAT(hElem, hStr){	//Function: HTMLEAT - wrapper for HTMLElementAppendText	//Programmer: Daniel J. Boston	//Date: June 4, 2004 - one for all the lazy fellers out there.		return HTMLElementAppendText(hElem, hStr);}function HTMLElementReplaceText(hElem, hStr){	//Function: HTMLElementReplaceText	//Programmer: Daniel J. Boston	//Date: June 7, 2004	//Revision: 0.9 [to test]	//Purpose: Replaces text of an HTML element regardless of platform.	//		var success = false;		try	{		//IE		if (hElem.innerText != undefined)		{			hElem.innerText = sstr(hStr);			success = true;		}		else		{			throw new Error();		}	}	catch(e)	{		try		{			//NS, Mozilla Codebase			hElem.normalize();			var textChild;			if (hElem.hasChildNodes())			{				for (var fText = 0; fText < hElem.childNodes.length; fText ++)				{					if (hElem.childNodes.item(fText).nodeType == 3)					{						hElem.replaceChild(hElem.ownerDocument.createTextNode(sstr(hStr)),hElem.childNodes.item(fText));						success = true;						break;					}				}			}else{				hElem.appendChild(hElem.ownerDocument.createTextNode(sstr(hStr)));				success = true;			}		}		catch(e)		{		//	alert(String(e.message) + "|" + String(e.lineNumber) + "|" + String(e.number & 0xFFFF));			//Neither browser, some other error. Object doesn't exit? Fault. Non-terminal.			errorHandle(false, e.message, e.lineNumber, "", e.number & 0xFFFF, "", "HTMLCompat.js", "Other", "In HTMLElementAppendText(hElem, hStr): hElem=" + sstr(hElem) + " hID=" + sstr(hStr));			e = new Error();			e.message = "Exception: Couldn't append text to HTML Element in HTMLElementReplaceText(): hElem=" + sstr(hElem) + " hStr=" + sstr(hStr);			e.name = "HTMLException";			success = false;			throw e;		}	}	//alert(success);	return success;}function HTMLERT(hElem, hStr){	//Function: HTMLERT - wrapper for HTMLElementReplaceText	//Programmer: Daniel J. Boston	//Date: June 4, 2004 - one for all the lazy fellers out there.		return HTMLElementReplaceText(hElem, hStr);}function HTMLHasCookie(hDoc, hCookieName){	//Function: HTMLHasCookie	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.5 [Beta]	//Purpose: Checks to see if a particular cookie exists.	//	toReturn = false;	tCookies = hDoc.cookie;	hCookieName = hCookieName + "="; //Adds "=" to put into form [name=], which is how cookies are stored.		tCookieStart = tCookies.indexOf(hCookieName);		if (tCookieStart > -1)	{		// Check to make sure this is a whole cookie name.				if (tCookieStart == 0)		{			// It's the first cookie			toReturn = true;		}		else		{			if (tCookies.substr(tCookieStart - 1, 1) == " ")			{				// Is a full cookie				toReturn = true;			}			else			{				//Look at other cookies, then.				while (tCookies.substr(tCookieStart - 1, 1) != " ")				{					//Look for another one if it isn't right off the bat.					tCookieStart = tCookies.indexOf(hCookieName, tCookieStart+1);					if (tCookieStart == -1)					{						break;					}				}								if (tCookies.substr(tCookieStart - 1, 1) != " ")				{					// Is a full cookie					toReturn = true;				}			}		}	}		return toReturn;}function HTMLGetCookie(hDoc, hCookieName){	//Function: HTMLGetCookie	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.5 [Beta]	//Purpose: Returns a particular cookie. Returns null if it doesn't exist.	//	toReturn = "";	tCookies = hDoc.cookie;	hCookieName = hCookieName + "="; //Adds "=" to put into form [name=], which is how cookies are stored.		tCookieStart = tCookies.indexOf(hCookieName);		if (tCookieStart > -1)	{		// Check to make sure this is a whole cookie name.				if (tCookieStart == 0)		{			// It's the first cookie			tCookieEnd = tCookies.indexOf(";"); // Cookies are separated by ";"						if (tCookieEnd > -1)			{				//Multiple cookies				toReturn = tCookies.substring(tCookieStart, tCookieEnd);			}			else			{				//Only cookie				toReturn = tCookies;			}		}		else		{			if (tCookies.substr(tCookieStart - 1, 1) == " ")			{				// Is a full cookie				tCookieEnd = tCookies.indexOf(";", tCookieStart);								if (tCookieEnd == -1) {tCookieEnd = tCookies.length;} // Last Cookie												toReturn = tCookies.substring(tCookieStart, tCookieEnd);			}			else			{				//Look at other cookies, then.				while (tCookies.substr(tCookieStart - 1, 1) != " ")				{					//Look for another one if it isn't right off the bat.					tCookieStart = tCookies.indexOf(hCookieName, tCookieStart+1);					if (tCookieStart == -1)					{						break;					}				}								if (tCookies.substr(tCookieStart - 1, 1) != " ")				{					// Is a full cookie					tCookieEnd = tCookies.indexOf(";", tCookieStart);										if (tCookieEnd == -1) {tCookieEnd = tCookies.length;} // Last Cookie									toReturn = tCookies.substring(tCookieStart, tCookieEnd);				}			}		}	}	return toReturn;}function HTMLCreateCookie(hDoc, hCookieName, hCookieVal){	//Function: HTMLSetCookie	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.5 [Beta]	//Purpose: Creates a particular cookie.	//	toReturn = false;		tCookie = hCookieName + "=" + hCookieVal;		//Gives a default lifetime of 3 months (90 days)	tCookie = tCookie + "; expires=" + (new Date((new Date()).getTime() + 90 * 24 * 60 * 60 * 1000)).toGMTString();	tCookie = tCookie + "; " + domain + "path=/"		try	{		hDoc.cookie = tCookie;		toReturn = true;	}	catch(e)	{		toReturn = false;	}		return toReturn;}function HTMLUpdateCookie(hDoc, hCookieName, hCookieVal){	//Function: HTMLUpdateCookie	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.5 [Beta]	//Purpose: This is a tricksy devil. Just basically calls HTMLCreateCookie, b/c they would do the same.	//		toReturn = HTMLCreateCookie(hDoc, hCookieName, hCookieVal);		// Verify that expires and other fields aren't retrieved with HTMLGetCookie....	//    That would be icksy.		return toReturn;}	function HTMLClearCookie(hDoc, hCookieName){	//Function: HTMLClearCookie	//Programmer: Daniel J. Boston	//Date: June 4, 2004	//Revision: 0.5 [Beta]	//Purpose: Mostly the same as HTMLCreateCookie, except sets the expire date as now and clears all data.	//	toReturn = false;		tCookie = hCookieName + "=";		//Gives a default lifetime of 3 months (90 days)	tCookie = tCookie + "; expires=" + (new Date()).toGMTString();	tCookie = tCookie + "; " + domain + "path=/"		try	{		hDoc.cookie = tCookie;		toReturn = true;	}	catch(e)	{		toReturn = false;	}		return toReturn;}
