
wmtt = null;
document.onmousemove = updateWMTT;
function updateWMTT(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
		wmtt.style.left = (x + 10) + "px";
		wmtt.style.top 	= (y + 10) + "px";
	}
	
}


var thisURL = unescape (window.location.href);

function showWMTT(id) {
	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}




function encodeValue(in_value) 
{
	// escape() will not encode: @*/+
	// encodeURI() will not encode: !@#$&*()=:/;?+'
	// encodeURIComponent() will not encode: !*()'
	encodedHtml = encodeURIComponent(in_value);
	
	// encodeURIComponent:
	encodedHtml = encodedHtml.replace(/!/g,"%21");	
	encodedHtml = encodedHtml.replace(/\*/g,"%2A");
	encodedHtml = encodedHtml.replace(/\(/g,"%28");
	encodedHtml = encodedHtml.replace(/\)/g,"%29");
	encodedHtml = encodedHtml.replace(/\'/g,"WeBPing");
	encodedHtml = encodedHtml.replace(/%2B/g  ,"WeBPlus")
	//alert (encodedHtml);
	
	return encodedHtml;
}

function openWindow (in_href, in_target, in_fetures)
{

	// PDA
	if (navigator.userAgent.indexOf('xxWindows CE') == -1) // Not in Windows CE
	{	
		window.open (in_href,in_target,in_fetures);
	}
	else
	{   
	
		// eval("top."+returnValue2+".location.href='"+returnValue+"'");
		try
		{
			// alert (in_target);
			if (in_target == '_parent') 
				eval("parent.location.href='"+in_href+"'");
			else
				eval("parent."+in_target+".location.href='"+in_href+"'");
		}
		catch (e)
		{
			try
			{
				eval("parent.parent."+in_target+".location.href='"+in_href+"'");
			}
			catch (e)
			{
				alert ('Windows CE only allow windows in frameset and one sub frameset. Windows CE can not open new browser.');
			}
		}
	}
	// PDA
}

function updateField (linkValue, linkTarget)
{
	try 
	{
	
		var theform2;
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			theform2 = 'document.forms["Form2"].';
		}
		else {
			theform2 = 'document.Form2.';
		}
		// alert (theform2 + linkTarget+".value = '"+linkValue+"';");
		eval(theform2 + linkTarget+".value = '"+linkValue+"';");
	}
	catch (e) 
	{
	
	}
	
}
function focusField (fieldID)
{
	try 
	{
		var theform2;
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			theform2 = 'document.forms["Form2"].';
		}
		else {
			theform2 = 'document.Form2.';
		}
		eval(theform2 + fieldID+ ".focus();");
	}
	catch (e) 
	{
	
	}
	
}
function refreshWindow ()
{
	if (! xmlhttp)
	{
	
	}
	else
	{
		
		try 
		{
			var toElementId = document.activeElement.id;
		} 
		catch (e) 
		{
			var toElementId = '';
		}
		var pos = thisURL.indexOf("&focusID");
		if (pos>=0)
		{
			thisURL = thisURL.substr(0, pos);
		}
		
		// alert (thisURL + '&focusID=' + toElementId);
		window.location.replace (thisURL + '&focusID=' + toElementId);
	}
}

function textMaxLen(field, maxlimit) 
{
	if (field.value.length > maxlimit)
	{
	    field.value = field.value.substring(0, maxlimit);
	}	
}			
