function jm_numericmask(t)
{
	var patt = /(\d*)\)/;
	var donepatt = /^(\d*)\$/;
	var str = t.value;
	var result;
	if (!str.match(donepatt))
	{
		result = str.match(patt);
		if (result!= null)
		{
			t.value = t.value.replace(/[^\d]/gi,'');
			str = result[1] + '.' + result[2] ;
			t.value = str;
		}
		else
		{
			if (t.value.match(/[^\d]/gi))
			t.value = t.value.replace(/[^\d]/gi,'');
		}
	}
}
function jm_currencymask(t)
{
	var patt = /(\d*)\.{1}(\d{0,2})/;
	var donepatt = /^(\d*)\.{1}(\d{2})$/;
	var str = t.value;
	var result;
	if (!str.match(donepatt))
	{
		result = str.match(patt);
		if (result!= null)
		{
			t.value = t.value.replace(/[^\d]/gi,'');
			str = result[1] + '.' + result[2] ;
			t.value = str;
		}
		else
		{
			if (t.value.match(/[^\d]/gi))
			t.value = t.value.replace(/[^\d]/gi,'');
		}
	}
}

function jm_datemask(t)
{
	var donepatt = /^(\d{2})\/(\d{2})\/(\d{4})$/;
	var patt = /(\d{2}).*(\d{2}).*(\d{4})/;
	var str = t.value;
	if (!str.match(donepatt))
	{
		result = str.match(patt);
		if (result!= null)
		{
			t.value = t.value.replace(/[^\d]/gi,'');
			str = result[1] + '/' + result[2] + '/' + result[3];
			t.value = str;
		}
		else
		{
			if (t.value.match(/[^\d]/gi))
			t.value = t.value.replace(/[^\d]/gi,'');
		}
	}
}

function jm_phonemask(t)
{
	var patt1 = /(\d{3}).*(\d{3}).*(\d{4})/;
	var patt2 = /^\((\d{3})\).(\d{3})-(\d{4})$/;
	var str = t.value;
	var result;
	if (!str.match(patt2))
	{
		result = str.match(patt1);
		if (result!= null)
		{
			t.value = t.value.replace(/[^\d]/gi,'');
			str = '(' + result[1] + ') ' + result[2] + '-' + result[3];
			t.value = str;
		}
		else
		{
			if (t.value.match(/[^\d]/gi))
			t.value = t.value.replace(/[^\d]/gi,'');
		}
	}
}

function jm_ssnmask(t)
{
	var patt = /(\d{3}).*(\d{2}).*(\d{4})/;
	var donepatt = /^(\d{3})-(\d{2})-(\d{4})$/;
	var str = t.value;
	var result;
	if (!str.match(donepatt))
	{
		result = str.match(patt);
		if (result!= null)
		{
			t.value = t.value.replace(/[^\d]/gi,'');
			str = result[1] + '-' + result[2] + '-' + result[3];
			t.value = str;
		}
		else
		{
			if (t.value.match(/[^\d]/gi))
			t.value = t.value.replace(/[^\d]/gi,'');
		}
	}
}
function ShowOrHide(ID,ImgID)
{
	if (document.getElementById(ID).style.display=='none')
	{
		document.getElementById(ID).style.display = 'block';
		document.getElementById(ImgID).src='../SMSImages/icon_minus.gif';
	}
	else
	{
		document.getElementById(ID).style.display = 'none';
		document.getElementById(ImgID).src='../SMSImages/icon_plus.gif';
	}
}

function checkEmail(email) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
	{
		return (true);
	}
	else
	{
		return (false);
	}
}

var offsetxpoint=0 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var mstatus;
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
//var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext,status ,thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") document.getElementById("dhtmltooltip").style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") document.getElementById("dhtmltooltip").style.backgroundColor=thecolor
document.getElementById("dhtmltooltip").innerHTML=thetext
enabletip=true
mstatus = status;
document.onmousemove=positiontip;
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<document.getElementById("dhtmltooltip").offsetWidth)
//move the horizontal position of the menu to the left by it's width
document.getElementById("dhtmltooltip").style.left=ie? ietruebody().scrollLeft+event.clientX-document.getElementById("dhtmltooltip").offsetWidth+"px" : window.pageXOffset+e.clientX-document.getElementById("dhtmltooltip").offsetWidth+"px"
else if (curX<leftedge)
document.getElementById("dhtmltooltip").style.left="5px"
else
{
//position the horizontal position of the menu where the mouse is positioned
	/*if (mstatus == '2')*/
		//document.getElementById("dhtmltooltip").style.left=curX+offsetxpoint-200+"px"*/
	//else if (mstatus == '1')
		document.getElementById("dhtmltooltip").style.left=curX+offsetxpoint+"px"
}
//same concept with the vertical position
//if (bottomedge<document.getElementById("dhtmltooltip").offsetHeight)
document.getElementById("dhtmltooltip").style.top=ie? ietruebody().scrollTop+event.clientY-document.getElementById("dhtmltooltip").offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-document.getElementById("dhtmltooltip").offsetHeight-offsetypoint+"px"
/*else
{
	document.getElementById("dhtmltooltip").style.top=curY+offsetypoint-100+"px"
}*/
document.getElementById("dhtmltooltip").style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
document.getElementById("dhtmltooltip").style.visibility="hidden"
document.getElementById("dhtmltooltip").style.left="-1000px"
document.getElementById("dhtmltooltip").style.backgroundColor=''
document.getElementById("dhtmltooltip").style.width=''
}
}

//document.onmousemove=positiontip