<!-- ================================= -->
			<!-- Trim Function -->
<!-- ================================= -->			
function Trim(TRIM_VALUE)
{
	if(TRIM_VALUE.length < 1)
	{
	return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE=="")
	{
		return "";
	}
	else
	{
	return TRIM_VALUE;
	}
} //End Function

<!-- ================================= -->
		<!-- RTrim Function -->
<!-- ================================= -->
function RTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0)
	{
		return"";
	}
	var iTemp = v_length -1;
	while(iTemp > -1)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{}
		else
		{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} //End While
	return strTemp;
} //End Function

<!-- ================================= -->
		<!-- LTrim Function -->
<!-- ================================= -->
function LTrim(VALUE)
{
	var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space)
		{}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
return strTemp;
} //End Function

<!-- ================================= -->
		<!-- Left Function -->
<!-- ================================= -->

function Left(str, n)
   
    {
            if (n <= 0)     // Invalid bound, return blank string
                    return "";
            else if (n > String(str).length)   // Invalid bound, return
                    return str;                // entire string
            else // Valid bound, return appropriate substring
                    return String(str).substring(0,n);
    }

<!-- ================================= -->
		<!-- End Left Function -->
<!-- ================================= -->

<!-- ================================= -->
		<!-- Right  Function -->
<!-- ================================= -->

 function Right(str, n)
   
    {
            if (n <= 0)     // Invalid bound, return blank string
               return "";
            else if (n > String(str).length)   // Invalid bound, return
               return str;                     // entire string
            else { // Valid bound, return appropriate substring
               var iLen = String(str).length;
               return String(str).substring(iLen, iLen - n);
            }
    }
<!-- ================================= -->
		<!-- End Right Function -->
<!-- ================================= -->

<!-- ================================= -->
		<!-- Mid Function -->
<!-- ================================= -->

 function Mid(str, start, len)
    
    {
            
            if (start < 0 || len < 0) return "";

            var iEnd, iLen = String(str).length;
            if (start + len > iLen)
                    iEnd = iLen;
            else
                    iEnd = start + len;

            return String(str).substring(start,iEnd);
    }
<!-- ================================= -->
		<!-- End Mid Function -->
<!-- ================================= -->

<!-- ================================= -->
		<!-- Instr  Function -->
<!-- ================================= -->


function InStr(strSearch, charSearchFor)

{
	for (i=0; i < String(strSearch).length; i++)
	{
	    if (charSearchFor == Mid(strSearch, i, charSearchFor.length))
	    {
			return i;
	    }
	}
	return -1;
}
<!-- ================================= -->
		<!-- End inStr Function -->
<!-- ================================= -->


<!-- ================================= -->
		<!-- Instr  Function -->
<!-- ================================= -->


function InStrRev(strSearch, charSearchFor)

{
	for (i=String(strSearch).length-1;i>=0;i--)
	{
	    if (charSearchFor == Mid(strSearch, i, charSearchFor.length))
	    {
			return i;
	    }
	}
	return -1;
}
<!-- ================================= -->
		<!-- End inStr Function -->
<!-- ================================= -->


<!-- ================================= -->
		<!-- IsDate Function -->
<!-- ================================= -->

function isDate(DateToCheck)
{
	if(DateToCheck=="")
	{
		return true;
	}
	var m_strDate = DateToCheck;
	if(m_strDate=="")
	{
	return false;
	}
	var m_arrDate = m_strDate.split("/");
	var m_DAY = m_arrDate[0];
	var m_MONTH = m_arrDate[1];
	var m_YEAR = m_arrDate[2];
	if(m_YEAR.length > 4){return false;}
	m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR;
	var testDate=new Date(m_strDate);
	if(testDate.getMonth()+1==m_MONTH){
	return true;
	} 
	else{
	return false;
	}
}//end function

var ControlToSet;
var theForm = document.forms[0];
var CalWidth=180;
var StartYear = "";
var EndYear = "";
var FormatAs;
var NN4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var NN6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var TOP;
var LEFT;

if(NN4)document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = LogPosition;

function LogPosition(evt){

    if (NN4||NN6){
    LEFT=evt.screenX;
    TOP=evt.screenY-10;
    }
    else{
    LEFT=event.screenX;
    TOP=event.screenY-10;
    }

}


function ShowCalendar(CONTROL,START_YEAR,END_YEAR,FORMAT){

ControlToSet = eval(CONTROL);
StartYear = START_YEAR;
EndYear = END_YEAR;
FormatAs = FORMAT;

var strFeatures = "width=" + CalWidth + ",height=140" + ",left=" + LEFT + ",top=" + TOP;
var CalWindow = window.open("HTMLCalendar.htm","Calendar", strFeatures)
CalWindow.focus();
} //End Function

function SetDate(DATE){
if(ControlToSet){
ControlToSet.value = DATE; 
}
ControlToSet = null;
StartYear = null;
EndYear = null;
FormatAs = null;
}

<!-- ================================= -->
		<!-- CheckImage Function -->
<!-- ================================= -->


function CheckImage(ImageField)
{
	var BigImageFile="";
	var SmallImageFile="";
	ImagePath1=ImageField;
	if (ImagePath1.length>0)
	{
		SmallImageArray=ImagePath1.split("\\");
		SmallImageFile=SmallImageArray[SmallImageArray.length-1];
	}
	if(SmallImageFile.length>0)	
	{
		if (SmallImageFile.toUpperCase().lastIndexOf(".JPG")==-1 && SmallImageFile.toUpperCase().lastIndexOf(".JPEG")==-1 && SmallImageFile.toUpperCase().lastIndexOf(".GIF")==-1 && SmallImageFile.toUpperCase().lastIndexOf(".PNG")==-1)
		{
			alert("Please Select Image With jpg|jpeg|gif\png extensions");
			return false;		
		}
	}
return true;
}


<!-- ================================= -->
		<!-- emailCheck Function -->
<!-- ================================= -->

function emailCheck (emailStr) 
{
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) 
{
//alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) 
{
if (user.charCodeAt(i)>127) 
{
//alert("Ths username contains invalid characters.");
return false;
}
}
for (i=0; i<domain.length; i++) 
{
if (domain.charCodeAt(i)>127) 
{
//alert("Ths domain name contains invalid characters.");
return false;
}
}

if (user.match(userPat)==null) 
{
//alert("The username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) 
{

for (var i=1;i<=4;i++) 
{
if (IPArray[i]>255) 
{
//alert("Destination IP address is invalid!");
return false;
}
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) 
{
if (domArr[i].search(atomPat)==-1) 
{
//alert("The domain name does not seem to be valid.");
return false;
}
}
if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) 
{
//alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
if (len<2) 
{
//alert("This address is missing a hostname!");
return false;
}
return true;
}



function checkKeys()
{
	if(event.keyCode < 48  || event.keyCode > 58 )
	{
		event.keyCode = 0;
		return false;
	}
return true;
}

function checkKeysWithDecimal()
{
	if(event.keyCode < 48  || event.keyCode > 58 )
	{
		if(event.keyCode ==46) 
		{}
		else
		{
		event.keyCode = 0;
		return false;
		}
	}
return true;
}

<!-- ============================================================================== -->
		<!-- Check whether minimum fields are selected from checkbox or radio buttonm -->
<!-- ============================================================================== -->

//function takes three parameter 1. FormName,ControlName,Minimum selection Required
function checkMinSelection(frmName,ctrName,minSelection)
{
	var i;
	var cnt;
	cnt=0;
	if(eval("document."+frmName+"."+ctrName).checked==true)
	{
			return true;
	}
	else
	{
	for(i=0;i<eval("document."+frmName+"."+ctrName).length;i++)
	{
		if(eval("document."+frmName+"."+ctrName)[i].checked==true)
		{
			cnt=parseInt(cnt)+1;
		}
	}
	if(parseInt(cnt)>=parseInt(minSelection))
	{
		return true;
	}
	else
	{
		return false;
	}
	}
}

function CheckAll(frmName,ctrName,MyVal )
{
	if(MyVal==true)
	{
		for(i=0;i<eval("document."+frmName+"."+ctrName).length;i++)
		{
			eval("document."+frmName+"."+ctrName)[i].checked=true;
		}
	}
	else
	{
		for(i=0;i<eval("document."+frmName+"."+ctrName).length;i++)
		{
		eval("document."+frmName+"."+ctrName)[i].checked=false;
		}
	}
}



function CheckUKPostalCode(PCODE){ //check postcode format is valid
 test = PCODE; 
 size = test.length;
 test = test.toUpperCase(); //Change to uppercase
 while (test.slice(0,1) == " ") //Strip leading spaces
  {test = test.substr(1,size-1);size = test.length
  }
 while(test.slice(size-1,size)== " ") //Strip trailing spaces
  {test = test.substr(0,size-1);size = test.length
  }
 if (size < 6 || size > 8){ //Code length rule
  return false;
  }
 if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
   return false;
  }
 if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
   return false;
  }
 if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
   return false;
  }
 if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
   return false;
  }
 if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
   return false;
   }
 count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
 if (count1 != count2){//only one space rule
   return false;
  }
return true;
}
//  End -->
<!-- =================================================================================== -->
/*							<!-- FocusState Function -->
	Required Parameters:
		1.	fieldname 		: Name of the Control Whose Values are going to be checked
					  		(note: name of the label is same as control with prefix L			
		2. 	msginfo			: Information to be displayed on focus
*/	
<!-- =================================================================================== -->	
function FocusState(fieldname,msginfo)
{
	//alert(fieldname);
	eval("L"+fieldname).className="typingmsg";
	eval("L"+fieldname).innerHTML=msginfo;

}
<!-- =================================================================================== -->
//					<!-- End -->
<!-- =================================================================================== -->

<!-- =================================================================================== -->
/*							<!-- LostFocusState Function -->
	Required Parameters:
		1.	frmName 			: Name Of The Form Whose Controls has to be checked
		2.	fieldname 			: Name of the Control Whose Values are going to be checked
					  			(note: name of the label is same as control with prefix L			
		3.	checkblank			: 'Y' if check for Blank else 'N',or 'YS' if check a combo to be selected an option whose value >0
		4.	minimumlength		: '0' if not to be checked else minimum length to be checked
		5	maximumlength		: '0' if not to be checked else maximummum length to be checked
		6.	email				: 'Y' if check the email format else 'N'
		7.	checkconfirmation	: 'Y' if field is to be checked for some other field for same data. like in case of confirm passwrod
		8.	confirmfield		: Name of the field to which current field value is to be matched	
		9. 	msgheader			: Header To be Dispalyed in label
*/	
<!-- =================================================================================== -->			

function LostFocusState(frmname,fieldname,checkblank,minimumlength,maximumlength,checkemail,checkconfirmation,confirmfield,msgheader)
{
	var errinfo;
	errinfo="";
	if(checkblank=="Y")
	{
		if(eval("document.forms."+frmname+"."+fieldname).value=="")
		{
			errinfo=errinfo + " " + msgheader+ " Can't Be Left Blank.";
		}
	}
	else if(checkblank=="YS")
	{
		if(eval("document.forms."+frmname+"."+fieldname).value=="0")
		{
			errinfo=errinfo + " " + msgheader+ " Select an Option.";
		}
	}
	//alert(errinfo);
	
	if(parseInt(minimumlength)>0)
	{
		if(eval("document.forms."+frmname+"."+fieldname).value.length<minimumlength)
		{
			errinfo=errinfo+ " " + "Min" + minimumlength +" Characters.";
		}
	}
	if(parseInt(maximumlength)>0)
	{
		if(eval("document.forms."+frmname+"."+fieldname).value.length>maximumlength)
		{
			errinfo=errinfo+ " " + "Max" + maximumlength +" Characters.";
		}
	}
	if(checkemail=="Y")
	{
		if(!emailCheck(eval("document.forms."+frmname+"."+fieldname).value))
		{
			errinfo=errinfo+ " " +"Invalid Email Format.";
		}
	}
	if(checkconfirmation=="Y")
	{
		if(eval("document.forms."+frmname+"."+fieldname).value!=eval("document.forms."+frmname+"."+confirmfield).value)
		{
			errinfo=errinfo+ " " +msgheader + "Not Matched.";
		}
	}

	if(errinfo.length>0)
	{
		eval("L"+fieldname).className="errmsg";
		eval("L"+fieldname).innerHTML=errinfo;
	}
	else
	{
		eval("L"+fieldname).className="okmsg";
		eval("L"+fieldname).innerHTML="OK";
	}

}

<!-- =================================================================================== -->
//					<!-- End -->
<!-- =================================================================================== -->

<!-- =================================================================================== -->
							<!-- LostFocusState Function -->
//		Required Parameters: frmname
<!-- =================================================================================== -->
function MakeEmpty(frmname)
{
	var el;
	var chk;
	el=0;
	chk=0;
	for(el=0;el<eval("document.forms."+frmname).elements.length;el++)
	{
		if(Left(eval("document.forms."+frmname).elements[el].type,4)=="text")
		{
			eval("document.forms."+frmname).elements[el].value="";
		}
		else if(Left(eval("document.forms."+frmname).elements[el].type,4)=="pass")
		{
			eval("document.forms."+frmname).elements[el].value="";
		}
		else if(Left(eval("document.forms."+frmname).elements[el].type,4)=="sele")
		{
			if(parseInt(eval("document.forms."+frmname).elements[el].options.length)>0)
			{
				eval("document.forms."+frmname).elements[el].options[0].selected=true;
			}
		}
		else if(Left(eval("document.forms."+frmname).elements[el].type,4)=="chec")
		{
			for(chk=0;chk<parseInt(eval("document.forms."+frmname).elements[el].length);chk++)
			{
				eval("document.forms."+frmname).elements[el].checked=false;
			}
		}
		
	}
	var lblarray=document.all.tags("LABEL");
	for(el=0;el<lblarray.length;el++)
	{
		lblarray[el].innerHTML="";
		lblarray[el].className="normalmsg";	
	}
	
}
<!-- =================================================================================== -->
//					<!-- End -->
<!-- =================================================================================== -->

<!-- =================================================================================== -->
//					<!-- Function To Create Category Tree -->
<!-- =================================================================================== -->

	
function CreateCategoryTree(frmname,fieldname,totalelemnts)
	{
		var i,j,level;
		//document.forms.CModule.ParentCategory.innerHTML="";
		eval("document.forms."+frmname+"."+fieldname).innerHTML="";	

		eval("document.forms."+frmname+"."+fieldname).options[eval("document.forms."+frmname+"."+fieldname).length]=new Option("<-- Select Package Category -->","0",true,true);
		for (i=0;i<totalelemnts;i++)
		{
			eval("document.forms."+frmname+"."+fieldname).options[eval("document.forms."+frmname+"."+fieldname).options.length]=new Option(arr[1][i],arr[0][i],true,true);
		}	
			eval("document.forms."+frmname+"."+fieldname).selectedIndex=0;
	}

<!-- =================================================================================== -->
//					<!-- End -->
<!-- =================================================================================== -->



<!-- =================================================================================== -->
//					<!-- Function To Display Current Datee  -->
<!-- =================================================================================== -->


function DisplayDate(DisplayFormat)
{
	var DisplayDate1="";	
	TodaysDate = new Date();	
	var strMonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	var strweek=new Array("Sunday","Monday","Tuesday","Wednesday","Thrusday","Friday","Saturday");
		DisplayDate1=strweek[TodaysDate.getDay()] + ", " + TodaysDate.getDate() + "-" + strMonth[TodaysDate.getMonth()] + "-" + TodaysDate.getFullYear();	
	return DisplayDate1;
}

<!-- =================================================================================== -->
//					<!-- End -->
<!-- =================================================================================== -->


<!-- =================================================================================== -->
//					<!-- Function To Create Cookie  -->
<!-- =================================================================================== -->
	function setCookie(name,value,duration)
	{
		cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
		document.cookie=cookiestring;
		if(!getCookie(name))
		{
			return false;
		}
	}
<!-- =================================================================================== -->
//					<!-- End Function -->
<!-- =================================================================================== -->

<!-- =================================================================================== -->
//					<!-- Function To Get Cookie Value -->
<!-- =================================================================================== -->
	function getCookie(cookiename) 
	{
		 var cookiestring=""+document.cookie;
		 var index1=cookiestring.indexOf(cookiename);
			 if (index1==-1 || cookiename=="") return ""; 
		 var index2=cookiestring.indexOf(';',index1);
			 if (index2==-1) index2=cookiestring.length; 
			return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
	}

<!-- =================================================================================== -->
//					<!-- End Function  -->
<!-- =================================================================================== -->

<!-- =================================================================================== -->
//					<!-- Function To Getxpirydate -->
<!-- =================================================================================== -->

	function getExpiryDate(nodays)
	{
		var UTCstring;
		Today = new Date();
		nomilli=Date.parse(Today);
		Today.setTime(nomilli+nodays*24*60*60*1000);
		UTCstring = Today.toUTCString();
		return UTCstring;
	}
<!-- =================================================================================== -->
//					<!-- End Function  -->
<!-- =================================================================================== -->


function getScreenX(formWidth)
{
return (parseFloat(screen.width) - parseFloat(formWidth)) / 2;
}

function getScreenY(formHeight)
{
return (parseFloat(screen.height) - parseFloat(formHeight)) / 2;
}
