/* ZWSP Compatibility Hack for HTML Version 1.1
 * By: Wason Liwlompaisan
 * Contact: lewcpe at gmail dot com
 * Description: This javascript is hacking to make Thai webpage correctly
 * 				rendered when the content has unicode "ZWSP" inside. ZWSP 
 * 				is word-seperator for Thai language which is suppose to 
 * 				invisible to user.
 * Related:	This file implemented with following tools:
 * 			-Browser Detection Code form http://www.quirksmode.org/js/detect.html
 * 			-Aptana Javascript IDE http://www.aptana.com/
 */
function checkIt(string,d)
{
	place = d.indexOf(string) + 1;
	thestring = string;
	return place;
}

function rmZWSP(){
	//alert("rm");
	document.body.innerHTML = document.body.innerHTML.replace(/\u200b/g,"");
}

function rpZWSP(){
	//alert("rp");
	document.body.innerHTML = document.body.innerHTML.replace(/\u200b/g,"<span style=\"width:0px;font-size:0pt;\">&#x200b;</span>");
}

function displayZWSP(){
	var d = navigator.userAgent.toLowerCase();
	if(checkIt('konqueror',d))		rpZWSP();
	else if (checkIt('safari',d)) 	rmZWSP();
	else if (checkIt('omniweb',d))	rpZWSP();
	else if (checkIt('opera',d))	rpZWSP();
	else if (checkIt('webtv',d))	rpZWSP();
	else if (checkIt('icab',d))		rpZWSP();
	else if (checkIt('msie',d))		rmZWSP();
	else if (!checkIt('compatible',d))rpZWSP();
}

