
function lTrim(s){return s.replace(/^\s+/g,'');}
function rTrim(s){return s.replace(/\s+$/g,'');}
function trim(s){return rTrim(lTrim(s));}
function FormValidate(lst,lstnames)
{var lstarray1=lst.split(",");var lstarray2=lstnames.split(",");for(i=0;i<=lstarray1.length-1;i++)
{if(trim(document.getElementById(lstarray1[i]).value)=="")
{alert("Please enter a valid address in"+" "+lstarray2[i]+" "+"field.");return(false);}}
return(true);}
function PassValidate(pwd1,pwd2)
{var pass1=trim(document.getElementById(pwd1).value);var pass2=trim(document.getElementById(pwd2).value);if(pass1!=pass2)
{alert("Confirm Password field doesn't match.");return(false);}
else
{return(true);}}
function DropValidate(dd,ddisplay)
{var lstarray1=dd.split(",");var lstarray2=ddisplay.split(",");var flag=0;for(i=0;i<=lstarray1.length-1;i++)
{if(document.getElementById(lstarray1[i]).selectedIndex=='')
{alert("Please select "+" "+lstarray2[i]);flag=1;return(false);}}
if(!flag)return(true);}
function char_count(msg_sms)
{msgobj=document.getElementById(msg_sms);var count=msgobj.value.length;if(count>160)
{alert('Message can not be longer than 160 characters for sending SMS.');return(false);}
else
{return(true);}}
function RadioValidate(rb,msg)
{var lstarray=rb.split(",");for(j=0;j<lstarray.length;j++)
{var obj1=document.getElementsByName(lstarray[j]);for(var i=0;i<obj1.length;i++)
{if(obj1[i].checked)
{break;}}
if(i>=obj1.length)
{alert(msg);return(false);}}
return(true);}
function ShowForm(hideid,showid)
{var hidearr=hideid.split(",");var showarr=showid.split(",");if(document.getElementById(hidearr[0]).style.display=='')
{for(i=0;i<=hidearr.length-1;i++)
{document.getElementById(hidearr[i]).style.display='none';document.getElementById(showarr[i]).style.display='';}
return(true);}
if(document.getElementById(hidearr[0]).style.display=='none')
{for(i=0;i<=hidearr.length-1;i++)
{document.getElementById(hidearr[i]).style.display='';document.getElementById(showarr[i]).style.display='none';}
return(true);}}
function CheckTotal(lst,tot)
{var lstarray1=lst.split(",");var total=0;for(i=0;i<=lstarray1.length-1;i++)
{var chk=document.getElementById(lstarray1[i]).value;total=parseInt(total)+parseInt(chk);}
if(total!=parseInt(tot))
{alert("Check total does not match with the total amount.");return false;}
else return(true);}