﻿
function RequiredTextValidate(id)
{var control=document.getElementById(id);if(Trim(control.value).length!=0)
{if(control.parentElement!=null)
{if(control.parentElement.id=='req_field'+control.id)
{var parent_control=document.getElementById('req_field'+control.id);parent_control.outerHTML=control.outerHTML;}}return true;}
else
{if(control.parentElement!=null)
{if(control.parentElement.id!='req_field'+control.id)
{control.outerHTML='<SPAN id=req_field'+control.id+' style="color:Red" >'+control.outerHTML+'&#8226</span>';}}return false;}}
function RequiredValidate()
{var result=true;for(var i=0;i<arguments.length;i++)
{if(RequiredTextValidate(arguments[i])!=true)
{result=false;}}
return result;}
function Trim(sString)
{while(sString.substring(0,1)==' ')
{sString=sString.substring(1,sString.length);}
while(sString.substring(sString.length-1,sString.length)==' ')
{sString=sString.substring(0,sString.length-1);}
return sString;}
function ItemCountValidator(ID,maxRecords)
{var control=document.getElementById(ID);var new_line_words=control.value.split("\n");var cNewLine=0
var cComma=0;var item="";var comma="";for(var i=0;i<new_line_words.length;i++)
{item=new_line_words[i];comma=item.split(",");cNewLine=cNewLine+1;cComma=0;for(var j=0;j<comma.length;j++)
{cComma=cComma+1;}
if(cComma>1)
{cNewLine=cNewLine+cComma-1}}
if(cNewLine>maxRecords)
{if(control.value.charAt([control.value.length-1])==',')
{control.value=control.value.substring(0,control.value.length-1);}
else
{control.value=control.value.substring(0,control.value.length-2);}}}
