function GoToListing(psModule)
{
	window.location.href="../Controls/frm_SearchList.aspx?qsModule=" + psModule
}
//**************for email address validation... added by sheetal on 6-2-2006*****************	
				function  chkemail(vsemail)
		{
			var email = new String(vsemail);
			var flag = false;
			var flag2 = false;
			var flag3 = false;
			var flag4 = false;
			var flag5 = false;
			var vicnt = 0;
			var substr = new String(email.substring(email.indexOf('@'),email.length));
			var substr2 = new String(email.substring(email.charAt(0),email.indexOf('@')));
				
				if(email.indexOf('@') <= 0)	
				{
					alert(email + ' email id is not valid');			
					return false
				}
				
				if(substr.indexOf('.') <= 0)	
				{
					alert(email + ' email id is not valid');			
					return false
				}
			
				if(substr.indexOf('.') == 1)
				{
					alert(email + ' email id is not valid. "." is not allowed immediately after "@". ');			
					return false
				}

				if(substr2.indexOf('.') == 0)	
				{
					alert(email + ' email id is not valid. "." cannot be the first character of email id.');
					return false
				}
				
				for (var i=email.length-1; i>0; i--)
					{
					//alert(email.charCodeAt(i));
					if ((Number(email.charCodeAt(i)))==95 ||(Number(email.charCodeAt(i)))== 46 || (Number(email.charCodeAt(i)))== 45 || ((Number(email.charCodeAt(i)))>=48 && (Number(email.charCodeAt(i)))<=57) || ((Number(email.charCodeAt(i)))>=64 && (Number(email.charCodeAt(i)))<=90) || ((Number(email.charCodeAt(i)))>=97 && (Number(email.charCodeAt(i))) <=122))
							{     
							}
					else
							{
								alert(email + ' email id is not valid');
								return false
							}
							
															
					if (email.charAt(i)=="@")
						{
						if (flag==true)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
								flag=true
							}
						}
						
						if (substr.charAt(i)=="_")
						{
					
						if (flag2==true)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
								flag2=true
							}
						}
						
						/*if (substr2.charAt(i)=="_")
						{
						if (flag3==true)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
								flag3=true
							}
						}*/
						if (substr.charAt(i)=="-")
						{

						if (flag4==true)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
								flag4=true
							}
						}
						
						/*if (substr2.charAt(i)=="-")
						{
						if (flag5==true)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
								flag5=true
							}
						}
						*/
						
						if (email.charAt(i)==".")
						{
							if (i==email.length-1)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
							}
						}
						if (email.charAt(i)=="-")
						{
							if (i==email.length-1)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
							}
						}
						/*if (email.charAt(i)=="_")
						{
							if (i==email.length-1)
							{
								alert(email + ' email id is not valid');	
								return false	
							}
							else
							{
							}
						}*/
						
						//if (email.charAt(i)==" ")
						//{
						//	alert(email + ' email id is not valid');	
						//	return false	
						//}
											
						if (email.charAt(i)==".")
						{
							if ((vicnt-i)==1)
							{
								alert(email + ' email id is not valid');
								return false;
							}
							vicnt = i
						}
						if (email.charAt(i)=="-")
						{
							if ((email.charAt(i-1)=="_")||(email.charAt(i+1)=="_"))
							{
								alert(email + ' email id is not valid');
								return false;
							}
						}
						if (email.charAt(i)=="-")
						{
							if ((email.charAt(i-1)==".")||(email.charAt(i+1)=="."))
							{
								alert(email + ' email id is not valid');
								return false;
							}
						}
						if (email.charAt(i)=="_")
						{
							if ((email.charAt(i-1)==".")||(email.charAt(i+1)=="."))
							{
								alert(email + ' email id is not valid');
								return false;
							}
						}
							
											
				}
													
			}	
										
		//********************* end of email address validation *********************
/*************************************ReplaceSTRXML code block by Abhishek 30 may 2006******************************************/////////////////
function ReplaceSTRXML(S)
{	
	/*var NewSTR = new String(S)
	

	var Samp = "&"
	var Sapos = "'"
	var Squot = '"'
	var Slt = "<"
	var Sgt = ">"
	
	var Sampxml = "&amp;"
	var Saposxml = "&apos;"
	var Squotxml = "&quot;"
	var Sltxml = "&lt;"
	var Sgtxml = "&gt;"
	
	 NewSTR = NewSTR.replace(Samp,Sampxml)
	 
	
	 NewSTR = NewSTR.replace(Sapos,Saposxml)
	  
	
	 NewSTR = NewSTR.replace(Squot,Squotxml)
	  
	
	 NewSTR = NewSTR.replace(Slt,Sltxml)
	   
	
	 NewSTR = NewSTR.replace(Sgt,Sgtxml)
	 return NewSTR	*/
	
}
/****************        end           **////////////////
function checkValueTable(ptblChk)
{
		var vbCheck = false;
		for(i=0;i<ptblChk.rows.length;i++)
		{
				if(ptblChk.rows[i].cells[0].childNodes[0].checked)
						{vbCheck=true}
		}
		return vbCheck
}

function checkValue(strObject)
{
	for(i=0;i<document.Form1.elements.length;i++)
	{
		objName = String(document.Form1.elements(i).name)
		if(objName.indexOf(strObject) >= 0)	
		{
			if(isEmpty(document.Form1.elements(i).value))
			{
				document.Form1.elements(i).focus()
				return true
			}
			else
			{
				return false
			}
			break;
		}
	}
}

function setPageSize()
{
	var objPageSize = document.getElementById("hdnPageSize");
	if(isWhitespace(objPageSize.value))
	{
		alert("Kind Enter Page Size");
		document.getElementById("txtPageSize[0]").focus();
		window.event.returnValue = false;
		return 0;
	}
	
	if(!(isNumeric(objPageSize.value)))
	{
		alert("Kindly Type A Number As Page Size");
		document.getElementById("txtPageSize[0]").focus();
		window.event.returnValue = false;
		return 0;
	}
	if( parseInt(objPageSize.value, 10) <= 0 )
	{
		alert("Kindly Enter A Number Greater then Zero As Page Size");
		
		//document.Form1.txtPageSize[0].focus();
		document.getElementById("txtPageSize[0]").focus();
		window.event.returnValue = false;
		return 0;
	}
	window.event.returnValue = true;
}

function chkPageSizeBoth()
{ 	
	if (document.getElementById("hdnPageSize").value == document.getElementById("txtPageSize[0]").value )
	{
		if(!(isWhitespace(document.getElementById("txtPageSize[0]").value)))
		{
			if(isDigit(document.getElementById("txtPageSize[0]").value)==true)
			{
				document.getElementById("txtPageSize[1]").value = document.getElementById("txtPageSize[0]").value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[0]").value ;
			}
			else 
			{
				document.getElementById("txtPageSize[0]").value = document.getElementById("txtPageSize[1]").value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[1]").value ;							
			}
		}
		else 
		{
			document.getElementById("txtPageSize[0]").value = document.getElementById("txtPageSize[1]").value ;
			document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[1]").value ;							
		}
	}
	else
	{
		if(!(isWhitespace(document.getElementById("txtPageSize[1]").value)))
		{
			if(isDigit(document.getElementById("txtPageSize[1]").value)==true)
			{
				document.getElementById("txtPageSize[0]").value = document.getElementById("txtPageSize[1]").value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[1]").value ;
			}
			else
			{
				document.getElementById("txtPageSize[1]").value = document.getElementById("txtPageSize[0]").value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[0]").value ;							
			}
		}
		else 
		{
			document.getElementById("txtPageSize[1]").value = document.getElementById("txtPageSize[0]").value ;
			document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize[0]").value ;							
		}
	}
}

/* Code Block Modified by Ashwin on 06/05/2005*/
function chkPageSize()
{ 	
	if (document.getElementById("hdnPageSize").value == document.getElementById("txtPageSize").value )
	{
		if(!(isWhitespace(document.getElementById("txtPageSize").value)))
		{
			if(isDigit(document.getElementById("txtPageSize").value)==true)
			{
				//document.Form1.txtPageSize[1].value = document.Form1.txtPageSize.value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;
			}
			else 
			{
				//document.Form1.txtPageSize.value = document.Form1.txtPageSize[1].value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;							
			}
		}
		else 
		{
			//document.Form1.txtPageSize.value = document.Form1.txtPageSize.value ;
			document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;							
		}
	}
	else
	{
		if(!(isWhitespace(document.getElementById("txtPageSize").value)))
		{
			if(isDigit(document.getElementById("txtPageSize").value)==true)
			{
				//document.Form1.txtPageSize[0].value = document.Form1.txtPageSize[1].value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;
			}
			else
			{
				//document.Form1.txtPageSize[1].value = document.Form1.txtPageSize[0].value ;
				document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;							
			}
		}
		else 
		{
	//		document.Form1.txtPageSize[1].value = document.Form1.txtPageSize[0].value ;
			document.getElementById("hdnPageSize").value = document.getElementById("txtPageSize").value ;							
		}
	}
}

function isEmpty(strValue)
{
	var strNew;
	strNew=''
	for(intC=0;intC<=strValue.length-1;intC++)
	{
		if(strValue.substring(intC,intC+1) != " ")
		{
			return false
			break;
		}
	}
	return true
}

function isWhitespace(s)
{   var i;
var whitespace = " \t\n\r";		
	//if (isEmpty(s)) return true;
	var s = s.toString();
	if(Number(s)==0)
	{
		return true
	}
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
	return true;
}

function isDigit (c)
{   
	return ((c >= "0") && (c <= "9"))
}

function isNumeric(s)
{
	if (typeof(s)=='undefined') return false;

	s = s.toString();
	
	if (arguments.length > 1 && s.length <=0) return false;
	
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		//if (!(c==',' || c=='.') && !isDigit(c)) return false;
		if (c==',') return false;
		if (c=='.')
		{
		}
		else if(!isDigit(c)) return false;
	}

	return true;
}

/*function	formatNum(objNum)
		{
				alert(event.keyCode)
		}*/

function kPress(strVal)
{
    
    if(strVal=="CAP")		//Capital Alpha Numeric
    {
		if(event.keyCode >= 97 && event.keyCode <= 122)
			{event.keyCode = event.keyCode - 32}
    }
    
	if(strVal=="CAN")		//Capital Alpha Numeric
	{
		
		if(event.keyCode == 58)
			{event.keyCode=0}
		if(event.keyCode >= 97 && event.keyCode <= 122)
			{event.keyCode = event.keyCode - 32}
		if(event.keyCode==39 || event.keyCode < 65 || event.keyCode > 122 || (event.keyCode > 91 && event.keyCode < 97))
		{
			if(event.keyCode >=65 && event.keyCode <=97 || event.keyCode > 58 || event.keyCode == 32)
				{event.keyCode=0;}
		}
	}
	if(strVal=="AN")		//Alpha Numeric
	{
		if(event.keyCode == 58)
			{event.keyCode=0}
		if(event.keyCode==39 || event.keyCode < 65 || event.keyCode > 122 || (event.keyCode > 91 && event.keyCode < 97))
		{
			if(event.keyCode !=32 && event.keyCode !=46 && (event.keyCode < 47 || event.keyCode > 58))
				{event.keyCode=0}
		}
	}
	//-----------------Added by sheetal on 20-jan-2006 ----Character------------------------
	if(strVal=="CHR")		//Character
	{
		if(event.keyCode<65 || event.keyCode > 122)
		{
			event.keyCode = 0
		}
		else
		{
		    if(event.keyCode < 97 && event.keyCode > 90)
		    {
		        event.keyCode = 0
		    }
		}
	}
	//----------------------------------End of Character-------------------------------------
	
	if(strVal=="NUM")		//Numeric
	{
		if(event.keyCode<48 || event.keyCode > 57)
		{
			event.keyCode=0;
		}
	}
	if(strVal=="NUMD")		//Numeric
	{
		if(event.keyCode<48 || event.keyCode > 57)
		{
			if(event.keyCode!=46)
			{
				event.keyCode=0
			}
			
		}
	}
	if(strVal=="NUMDE")		//Numeric
	{
		if(event.keyCode<48 || event.keyCode > 57)
		{
		    if(event.keyCode==13)
	        {
		        event.keyCode=13
	        }
	        else
	        {
			    if(event.keyCode!=46)
			    {
				    event.keyCode=0
			    }
			}
		}

	}
	if(strVal=="SMS")		//Alpha Numeric
	{
		if(event.keyCode == 58 || event.keyCode == 47 || event.keyCode == 92 || event.keyCode == 91)
			{event.keyCode=0}
		if(event.keyCode==39 || event.keyCode < 65 || event.keyCode > 122 || (event.keyCode > 91 && event.keyCode < 97))
		{
			if(event.keyCode !=32 && event.keyCode !=46 && (event.keyCode < 47 || event.keyCode >= 58))
				{event.keyCode=0}
		}
/*		if(event.keyCode >=0 && event.keyCode <= 31)
			{event.keyCode=0}
		if(event.keyCode == 58 || event.keyCode == 33 || event.keyCode == 94 || event.keyCode == 47 || event.keyCode == 92 || event.keyCode == 40 || event.keyCode == 41 || event.keyCode == 60 || event.keyCode == 62 || event.keyCode == 124 || event.keyCode == 38 || event.keyCode == 44 || event.keyCode == 96)
			{event.keyCode=0}*/
	}
	if (strVal=="")
	{
		if(event.keyCode<=47 || event.keyCode>=59)
		{event.keyCode=0;}	
	}
}

function myTime(objTime)
{
	s = new String(objTime.value)
	if(s.length==2)
	{
		objTime.value += ":"
	}
	if(s.length>1)
	{
		if(s.substring(2,3) != ":")
		{
			objTime.value = s.substring(0,2) + ":" + s.substring(2,4)
		}
	}	
}

function setTime(objTime)
{
	s = new String(objTime.value)
	
	if (parseInt(s) > 60)
	{
		alert("Kindly Enter Time less than 60 Minutes.");
		return false;
	}
}
/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Below New Function.										   */
/*	Reason		:	Place Time In Correct Format.									   */
/*-------------------------------------------------------------------------------------*/
function fnFixedTime(objTime)
{
	s = new String(objTime.value);
	switch(parseInt(s.length))
	{
		case 1:
			objTime.value = "00:0" + s;
			break;
		case 2:
			objTime.value = "00:" + s;
			break;
		case 3:
			objTime.value = "00" + s;
			break;
		case 4:
			objTime.value = "0" + s;
			break;
	}
}
/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Above New Function.										   */
/*	Reason		:	Place Time In Correct Format.									   */
/*-------------------------------------------------------------------------------------*/

function fnMaxLength(poText,piLength)
{
	
	s = new String(poText.value)
	if(s.length>(piLength-1))
	{   
	    return false
	    //event.keyCode=0;
	}
	else
	{
	    return true
	}
}

function EnableDisable(poControl,pbEnable)
{
	if(pbEnable)
		{pbEnable=false}
	else
		{pbEnable=true}
	poControl.disabled = pbEnable
	if(pbEnable)
	{
		poControl.style.backgroundColor="#fff7d1"
	}
	else
	{
		poControl.style.backgroundColor="#ffffff"
	}
}

function ReadOnlyObject(poControl,pbEnable)
{
	/*if(pbEnable)
		{pbEnable=false}
	else
		{pbEnable=true}*/
	poControl.readOnly = pbEnable
	if(pbEnable)
	{
		poControl.style.backgroundColor="#fff7d1"
	}
	else
	{
		poControl.style.backgroundColor="#ffffff"
	}
}

function CloseMe()
{
	window.close();
}

function GoToPage(psPage)
{
	window.parent.location.href=psPage
}

function TimeValid(poTime)
{
	var vsTime
	vsTime = poTime.value
	vsTime = vsTime.replace(":","")
	if(vsTime.length<4)
	{
		alert("Kindly Enter Time in proper format")
		return false
	}
	if(vsTime.substring(0,2) <=0 && vsTime.substring(2,4) <=0)
	{
		alert("Kindly Enter correct time")
		return false
	}
	if((vsTime.substring(0,2) >24 || vsTime.substring(0,2) <=0))
	{
		alert("Kindly Enter correct hh")
		return false
	}
	if(vsTime.substring(2,4) >60 || vsTime.substring(2,4) <0)
	{
		alert("Kindly Enter correct mm")
		return false
	}
	return true
}

function ChkValidation(psChk,psFormName)
{
	var vsName
	var vsChecked=false
	var voForm 
	if(typeof(psFormName)=="undefined")
	{
		psFormName="form1"
	}
	voForm = eval("document." + psFormName)
	if(typeof(voForm.elements.length) == 'undefined')
	{
		return false
	}
	else
	{
		for(vicnt=0;vicnt<voForm.elements.length;vicnt++)
		{
			vsName = voForm.elements[vicnt].name
			if(vsName.indexOf(psChk)>=0)
			{
				if(voForm.elements[vicnt].checked)
				{
					vsChecked = true
					break;
				}
			}
		}
	}	
	return vsChecked
}

function CloseMe()
{
	window.close();
}

function RemoveMsg()
{
	document.all.lblerrmsg.innerText = ""
}

function ProcessingMsg()
{
	document.all.lblerrmsg.innerText = "Processing please wait....."
}

// Added by Ashwini 05-mar-04
function DateToStr(psdate)
{
  
	var vsdate 
	var vsdd 
	var vsmm 
	var vsyy 

	vsdd = psdate.substr(0,2)
	vsmm = psdate.substr(3,2)
	vsyy = psdate.substr(6,4)
	vsdate = vsyy + vsmm + vsdd
		
	return(vsdate)
}

// Added by Ashwini 05-mar-04
function CheckDate(psfrom_dt,psto_dt)
{

	if (psfrom_dt > psto_dt)
	{
		alert('Kindly Enter To date Greater than From date');
		return false;
	}
	else
	{
		return true;
	}
	
}


/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Below New Function.										   */
/*	Reason		:	To validate marks entry.										   */
/*-------------------------------------------------------------------------------------*/
function myMarks(objMarks)
{
	s = new String(objMarks.value)
	if (s.length==1)
	{
		if (s.substring(0, 1)==".")
		{
			if(event.keyCode==46){ event.keyCode = 0;}	
		}
	}
	if (s.length==2)
	{
		if (s.substring(0, 1)=="." || s.substring(1, 2)==".")
		{
			if(event.keyCode==46){ event.keyCode = 0; }
		}
		else
		{
			if (s.substring(0, 1)!="." || s.substring(1, 2)!=".")
			{ 
				if(event.keyCode==46){ event.keyCode = 0; }
				objMarks.value += "." 
			}
		}
	}
	if(s.length==3)
	{
		if (s.substring(0, 1)==".")
		{ event.keyCode =0; }
		if(s.substring(1, 2)=="." || s.substring(2, 3)==".")
		{
			if(event.keyCode==46){ event.keyCode = 0; }
		}
	}
	if(s.length==4)
	{
		if (s.substring(1, 2)==".")
		{ event.keyCode =0; }
		if(s.substring(2, 3)==".")
		{
			if(event.keyCode==46){ event.keyCode = 0; }
		}
	}
	if(s.length==5)
	{
		if(s.indexOf(".")>0)
		{
			if(event.keyCode==46){ event.keyCode = 0; }
		}
	}
}

/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Above New Function.										   */
/*-------------------------------------------------------------------------------------*/



/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Below New Function.										   */
/*-------------------------------------------------------------------------------------*/
function fnSetMarks(objMarks)
{
	s = new String(objMarks.value);

	if(s.length==5)
	{
		if(s.indexOf(".")<0)
		{
			objMarks.value = s.substring(0, 2) + "." + s.substring(3, 5);
		}
	}	
}

/*-------------------------------------------------------------------------------------*/
/*	End Block	:	Added Above New Function.										   */
/*-------------------------------------------------------------------------------------*/





/*-------------------------------------------------------------------------------------*/
/* Start Block	: Newly Added Function.												   */
/* Reason		: To return Month No												   */
/*-------------------------------------------------------------------------------------*/
function GetMonthNo(Mon)
		{
			var MonthNo;
			if (Mon=="Jan")
			{
				MonthNo="1"
			}
			if (Mon=="Feb")
			{
				MonthNo="2"
			}
			if (Mon=="Mar")
			{
				MonthNo="3"
			}
			if (Mon=="Apr")
			{
				MonthNo="4"
			}
			if (Mon=="May")
			{
				MonthNo="5"
			}
			if (Mon=="Jun")
			{
				MonthNo="6"
			}
			if (Mon=="Jul")
			{
				MonthNo="7"
			}
			if (Mon=="Aug")
			{
				MonthNo="8"
			}
			if (Mon=="Sep")
			{
				MonthNo="9"
			}
			if (Mon=="Oct")
			{
				MonthNo="10"
			}
			if (Mon=="Nov")
			{
				MonthNo="11"
			}
			if (Mon=="Dec")
			{
				MonthNo="12"
			}
			
			return MonthNo
		}
/*-------------------------------------------------------------------------------------*/
/* End Block	: Newly Added Function.												   */
/*-------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------*/
/* Start Block	: Newly Added Function.												   */
/* Reason		: To check proper Date Format										   */
/*-------------------------------------------------------------------------------------*/
	function fnCheckDate(objStDate, objEndDate)
		{
			var Str_StartDate = new String(objStDate.value);
			var Str_EndDate = new String(objEndDate.value);
			var Str_Date = new Date();
						
			if (Str_StartDate.length == 0 || Str_EndDate.length == 0)
			{
				alert('Kindly Select Date.');
				return false;
			}
			else if (Str_StartDate.length == 0 && Str_EndDate.length != 0)
			{
				alert('Kindly Select From Date.');
				return false;
			}
			else if (Str_StartDate.length != 0 && Str_EndDate.length == 0)
			{
				alert('Kindly Select To Date.');
				return false;
			}
			else if (Str_StartDate.length != 0 && Str_EndDate.length != 0)
			{   
				var dt_StartDate = new Date(Str_StartDate.substr(7,4), GetMonthNo(Str_StartDate.substr(3,3)) - 1 , Str_StartDate.substr(0,2), 0, 0, 0);
				var dt_EndDate = new Date(Str_EndDate.substr(7,4), GetMonthNo(Str_EndDate.substr(3,3)) - 1 , Str_EndDate.substr(0,2), 0, 0, 0);
				if (dt_StartDate > dt_EndDate)
					{   
						alert('Kindly Select From Date Less Than To Date.');
						return false;
					}
					else
					{
						return true;
					}
			}
			
		}


/*-------------------------------------------------------------------------------------*/
/* End Block	: Newly Added Function.												   */
/*-------------------------------------------------------------------------------------*/


/********************************Date Validation*////////////////

function GetDt(objDate,viflg)
{
	try
	{
		//var myObj = eval(thedate)
		if(objDate.disabled==false)	
		{
			//window.open ("../controls/calendar.asp?objdt="+objDate.name,null,"height=170,width=270,resizable=no,status=no,toolbar=no,menubar=no,left=360,top=200");
			if(viflg=="MDY")
			{
			    objDate.value=window.showModalDialog("../controls/calendar_n.htm?objdt="+ objDate.name,"","center:1;dialogWidth:20;dialogHeight:13;help:no;resizable:yes;status:no;scroll:no;")
			}
			else
			{
			   objDate.value=window.showModalDialog("../controls/calendar.htm?objdt="+ objDate.name,"","center:1;dialogWidth:20;dialogHeight:13;help:no;resizable:yes;status:no;scroll:no;")
			}
			
			if(objDate.value=='undefined')
			{
				objDate.value=''
			}
		}	
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function datecompare(frmdt,todt,poFocusOn,psMsg)
{
	if(dtos(frmdt.value) > dtos(todt.value))
	{
		if(typeof(psMsg)=="undefined")
		{
				alert("Kindly Enter To Date Greater then From Date!")
		}
		else
		{
				alert(psMsg)
		}		
		if(typeof(poFocusOn)=="object")
		{
				poFocusOn.focus()
		}		
		return false
	}
}


function valdate(tgDate,nAllowFutDt,Fld)    //for validating date 
{
	try
	{	
		if (tgDate.value.length < 10)
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			}	
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		mon1=tgDate.value.substr(2,1);
		mon2=tgDate.value.substr(5,1);
		if( mon1 != "/" || mon2!= "/")
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			} 
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		dd=tgDate.value.substr(0,2);
		mm=tgDate.value.substr(3,2);
		yy=tgDate.value.substr(6,4);

		/*mm=tgDate.value.substr(0,2);
		dd=tgDate.value.substr(3,2);
		yy=tgDate.value.substr(6,4);*/

		chk=isNaN(dd);
		if ( isNaN(dd) || isNaN(mm) || isNaN(yy))
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			}
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		if ((dd==0) || (dd > 31) || (mm==0)	|| (mm >12) ||(yy==0) || (yy <=1900))
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Invalid Date")
			}
			else
			{
				/*if(Fld != "undefined")
				{
					alert("Invalid " + Fld + ":" + tgDate.value);
				}
				else
				{
				*/	alert("Invalid Date :" + tgDate.value);
				//}
			}	
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		if (mm==2)
		{
			nleap= yy % 4 ;
			if (nleap!=0 && dd>28)
			{
			if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();  
				tgDate.focus();
				return(false); 
			}
			else if (dd>29)
			{
			if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			} 
		}
		else if (mm==4 || mm==6 || mm==9 || mm==11)
		{
			if (dd>30) 
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
		}
		if (nAllowFutDt==0)   // not allowing future date
		{
			today = new Date();
			td = today.getDate();
			mth = today.getMonth();
			yr = today.getYear();
			mth++;
			if (yy>yr)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Future Year")
				}
				else
				{
					alert("Future Year!");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
			else if ( yy==yr && mm>mth)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Future Month")
				}
				else
				{
					alert("Future Month!");
				}     
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
			else if ((yy==yr && mm==mth) && dd>td)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Future Date")
				}
				else
				{
					alert("Future Date!");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
		}

		if (nAllowFutDt==1)   // not allowing past date
		{
			today = new Date();
			td = today.getDate();
			mth = today.getMonth();
			yr = today.getYear();
			mth++;
			if (yy<yr)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{	
					errormsg("Past Date not Allowed!")
				}
				else
				{
					alert("Past Date not Allowed!");
				}	
				tgDate.select();
				tgDate.focus();
				return(false);
			}
			else if ( yy==yr && mm<mth)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Past Date not Allowed!")
				}
				else
				{
					alert("Past Date not Allowed!");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
			else if ((yy==yr && mm==mth) && dd<td)
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Past Date not Allowed !")
				}
				else
				{
					alert("Past Date not Allowed");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
		}
		return(true);
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function valdate_n(tgDate,nAllowFutDt,Fld)    //for validating date 
{
	try
	{	
		if (tgDate.value.length < 10)
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			}	
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		mon1=tgDate.value.substr(2,1);
		mon2=tgDate.value.substr(5,1);
		if( mon1 != "/" || mon2!= "/")
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			} 
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		/*dd=tgDate.value.substr(0,2);
		mm=tgDate.value.substr(3,2);
		yy=tgDate.value.substr(6,4);*/

		mm=tgDate.value.substr(0,2);
		dd=tgDate.value.substr(3,2);
		yy=tgDate.value.substr(6,4);

		chk=isNaN(dd);
		if ( isNaN(dd) || isNaN(mm) || isNaN(yy))
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Input Date in DD/MM/YYYY format")
			}
			else
			{
				alert("Input date in DD/MM/YYYY format");
			}
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		if ((dd==0) || (dd > 31) || (mm==0)	|| (mm >12) ||(yy==0) || (yy <=1900))
		{
			if (typeof(document.all.errmsg)!="undefined")
			{
				errormsg("Invalid Date")
			}
			else
			{
				/*if(Fld != "undefined")
				{
					alert("Invalid " + Fld + ":" + tgDate.value);
				}
				else
				{
				*/	alert("Invalid Date :" + tgDate.value);
				//}
			}	
			tgDate.select();
			tgDate.focus();
			return(false);
		}
		if (mm==2)
		{
			nleap= yy % 4 ;
			if (nleap!=0 && dd>28)
			{
			if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();  
				tgDate.focus();
				return(false); 
			}
			else if (dd>29)
			{
			if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			} 
		}
		else if (mm==4 || mm==6 || mm==9 || mm==11)
		{
			if (dd>30) 
			{
				if (typeof(document.all.errmsg)!="undefined")
				{
					errormsg("Invalid Date")
				}
				else
				{
					alert("Kindly Enter valid Date");
				}	
				tgDate.select();
				tgDate.focus();
				return(false); 
			}
		}
		
	    return(true);
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function gtDay(strDate)
{
	try
	{
		var mydate = new String(strDate)
		//  return (mydate.substring(0,2))
		return (mydate.substring(5,3))
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function gtMonth(strDate)
{
	try
	{	
		var mydate = new String(strDate)
		return (mydate.substring(0,2))
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function gtYear(strDate)
{
	try
	{
		var mydate = new String(strDate)
		return (mydate.substring(10,6))
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function dtos(strDate)
{
	try
	{
		var myDate=new String(strDate)
		if(myDate!="")
			//{return (myDate.substring(10,6) + myDate.substring(5,3) + myDate.substring(0,2))}
			{return (myDate.substring(10,6) + myDate.substring(0,2) + myDate.substring(5,3))}
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function stod(strDate)
{
	try
	{
		var myDate = new String(strDate)
		if(myDate!="")
			//{return (myDate.substring(8,6) + "/" + myDate.substring(6,4) + "/" + myDate.substring(0,4))}
			{return (myDate.substring(6,4) + "/" + myDate.substring(8,6) + "/" + myDate.substring(0,4))}
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}

function mydate(objdt)    // keyhandler for date text box
{
	try
	{
		var aday = new Array(0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
		var yr=gtYear(objdt.value);
		var lp= yr % 4;
		if(lp==0)
			{aday[2]=29}
		if (event.keyCode==43)      //+ key
		{
			if (objdt.value!=='')
			{
				if (valdate(objdt,2)==true)
				{
					nmonth= new Number(gtMonth(objdt.value));
					nday= new Number(gtDay(objdt.value));
					nyear= new Number(gtYear(objdt.value));
					if (nday+1>aday[nmonth])
					{
						if (nmonth==12)
						{
							nyear=nyear+1
							newdate='01' +'/01/'+nyear
						}
						else
						{
							//newdate='01' +'/'+ lpad(nmonth+1,2,'0') +'/'+nyear
							newdate=lpad(nmonth+1,2,'0') + '/'+ '01' +'/'+nyear
						}
					}
					else
					{
						//newdate=lpad(nday+1,2,'0') +'/'+lpad(nmonth,2,'0')+'/'+nyear;
						newdate=lpad(nmonth,2,'0')+'/'+lpad(nday+1,2,'0') +'/'+nyear;
					}
					objdt.value=newdate;
					return
				}
			}
			else
			{
				var today
				today = new Date();
				newdate = lpad(today.getDate(),2,"0") + "/";
				newdate += lpad(today.getMonth() + 1,2,"0") + "/";
				newdate += today.getFullYear();
				objdt.value=newdate;
			}
			event.keyCode=0
		}
		else if (event.keyCode==45)  // - key
		{
			if (objdt.value!=='')
			{
				if (valdate(objdt,2)==true)
				{
					nmonth= new Number(gtMonth(objdt.value));
					nday= new Number(gtDay(objdt.value));
					nyear= new Number(gtYear(objdt.value));
					if (nday==1)
					{
						if (nmonth==1)
						{
							nyear=nyear-1
							newdate='31' +'/12/'+nyear
						}
						else
						{
							newdate=lpad(nmonth-1,2,'0') +'/'+'01' +'/'+ nyear
							//newdate='01' +'/'+ lpad(nmonth-1,2,'0') +'/'+nyear
						}
					}
					else
					{
						//newdate=lpad(nday-1,2,'0') +'/'+lpad(nmonth,2,'0')+'/'+nyear;
						newdate=lpad(nmonth,2,'0')+'/'+lpad(nday-1,2,'0') +'/'+nyear;
					}
					objdt.value=newdate;
					return
				}
			}
			else
			{
				var today
				today = new Date();
				newdate = lpad(today.getDate(),2,"0") + "/";
				newdate += lpad(today.getMonth() + 1,2,"0") + "/";
				newdate += today.getFullYear();
				objdt.value=newdate;
			}
			event.keyCode=0
		}
		if((event.keyCode!=13 && event.keyCode!=27) && event.keyCode<=47 || event.keyCode>=59)
		{
			event.keyCode=0
		}
		s = new String(objdt.value);
		if (s.length==2 || s.length==5)
		{
			objdt.value = objdt.value + "/"
		}
	}
	catch(e)
	{
		return false
	}
}

function rpad(strValue,nLength,strStuff)
{
	try
	{
		var mystring = new String(strValue)
		var newstring=''
		mystring=mystring.replace('  ',' ')
		nLength=nLength-mystring.length+1
		for(i=1;i<nLength;i++)
			{newstring= newstring+strStuff}
		return (strValue+newstring)
	}
	catch(e)
	{
		alert(e.description)
		return false
	}
}


//------------------------------------------------------------------------------------------------------------------------------------------------ //
// Function Name	: chkValidEntry()
// Input Parameter	: 1. objChkCtrlIn  => Control To Check Duplicate Entry In.
//					  2. objChkCtrlVal => Value To Check Duplicate Entry.(Array) 
//					  3. vsOperator	   => Comparision Operator.
// Purpose			: Check For No Duplicate Entry. 
// Created By		: Paresh.																														
// Created On		: 6-Jul-2004
// Modified By		: --
// Modified On		: --
// Reason			: --
// Changes			: --
//------------------------------------------------------------------------------------------------------------------------------------------------ //
function chkValidEntry(objChkCtrlIn, objChkCtrlVal, vsOperator)
{
	// Define & Initialize Variable.
	var ChkCtrlVal = '';
	var vOperator = '';
	var vsMsg = '';
	// Loop For Control To Check.
	for (viCtr = 2; viCtr <= objChkCtrlIn.rows.length; viCtr++)
	{
		ChkCtrlVal = '';
		vOperator = '';
		vsMsg = '';
		// Loop For Value To Check.
		for (viCnt = 0; viCnt<=objChkCtrlVal.length-1; viCnt++)
		{
			var viTmp = viCtr-1;
			var viTmpCnt = viCnt + 1;
			ChkCtrlVal = ChkCtrlVal + vOperator + "objChkCtrlIn.rows[" + viTmp + "].cells[" + viTmpCnt + "].innerText == objChkCtrlVal[" + viCnt + "]";
			switch (vsOperator)
			{
				case 'AND':
					vOperator = ' && ';
					break;
				case 'OR':
					vOperator = ' || ';
					break;
			}
			if (viCnt == 0)
			{
				vsMsg = vsMsg + objChkCtrlVal[viCnt];
			}
			else
			{
				vsMsg = vsMsg + " " + vsOperator + " " + objChkCtrlVal[viCnt];
			}
		}
		
		if (eval(ChkCtrlVal))
		{
			alert ("Defination For " + vsMsg + " Is Already Done.");
			window.event.returnValue = false;
			break;
		}
	}					
}

	function lpad(strValue,nLength,strStuff)
	{
		try
		{
			var mystring = new String(strValue)
			var newstring=''
			mystring=mystring.replace('  ',' ')
			nLength=nLength-mystring.length+1
			for(i=1;i<nLength;i++)
				{newstring= newstring+strStuff}
			return (newstring+strValue)
		}
		catch(e)
		{
			alert(e.description)
			return false
		}
	}

	function rpad(strValue,nLength,strStuff)
	{
		try
		{
			var mystring = new String(strValue)
			var newstring=''
			mystring=mystring.replace('  ',' ')
			nLength=nLength-mystring.length+1
			for(i=1;i<nLength;i++)
				{newstring= newstring+strStuff}
			return (strValue+newstring)
		}
		catch(e)
		{
			alert(e.description)
			return false
		}
	}

//------------------------------------------------------------------------------------------------------------------------------------------------ //
// Function End.
//------------------------------------------------------------------------------------------------------------------------------------------------ //			

	function CheckDecimalValue(objCtrl)
	{
		vsCtlValue = new String(objCtrl.value)
				
		/*// If Entered Value Is Start With Decimal Then Don't Allow To Again Put Decimal.
		if (vsCtlValue.length==1)
		{
			if (vsCtlValue.substring(0, 1)==".")
			{
				if(event.keyCode==46){ event.keyCode = 0;}	
			}
		}*/
		ChkDecimalPosition(vsCtlValue, 2)
	}
	
	function ChkDecimalValue(objCtrl, viMaxLength, viPrecision, viScale)
	{
		vsCtlValue = new String(objCtrl.value);
		
		// Check If Any Decimal Present Or Not.
		
		if (event.keyCode == 46)
		{
			alert(vsCtlValue.length)
		}
		
		
		//alert(vsCtlValue.length);
		/*if(vsCtlValue.length > viPrecision && vsCtlValue.length < viPrecision + 1)
		{
			//alert(event.keyCode);
			if (event.keyCode != 46)
			{
				event.keyCode = 0;
			}
		}*/
	}
	
	
		
	function ChkAfterDecimalValue(vsValue, viMaxAllow)
	{
	// Check Any Decimal Position In A Supplied Value.
		if (vsValue.indexOf(".") >= 0)
		{
		    if(event.keyCode==46){ event.keyCode = 0;}
			// If Found Then Allow Only 2 Digits After Decimal.
			var vsAfterDecimalVal = vsValue.substr(vsValue.indexOf(".")+1, vsValue.length);
			if (vsAfterDecimalVal.length > viMaxAllow - 1)
			{
				event.keyCode = 0;
			}
		}
	}	
	
	function OpenReport(psReportName)
	{
		var nHeight = screen.availHeight-50
		var nWidth = screen.availWidth-10
		
		var vsReportName = new String(psReportName)
		if(vsReportName.indexOf("?") > 0)
		{
			var vsRpt_Name = vsReportName.substring(0, vsReportName.indexOf("?"));
			var vsQry_Str = vsReportName.substring(vsReportName.indexOf("?")+1, vsReportName.length);
			window.open("frm_R_Frame.aspx?ReportName=" + vsRpt_Name + "&QryStr=" + vsQry_Str,"","height=" + nHeight + ",width=" + nWidth + ",left=0,top=0,status=yes")
		}
		else
		{
			window.open("../Reports/frm_R_Frame.aspx?ReportName=" + psReportName,"","height=" + nHeight + ",width=" + nWidth + ",left=0,top=0,status=yes")
		}
		
			
		//window.open("frm_R_Frame.aspx?ReportName=" + psReportName ,"","height=" + nHeight + ",width=" + nWidth + ",left=0,top=0,status=yes")
	}

//ShowHelpWindow('ContactPopup','hdn_Dl_Src_Id','0','txtDlSource','','txtDlSource','','Y','Get DealSource');

	function ShowHelpWindow(psModule, psId, piIdCol, psName, piNameCol, psRetFocus, psSearch, psLoadList, psHeading,psSubmit)
	{	
		if(typeof(psSubmit)=="undefined")
				{psSubmit=""}
		var vsQuryString = "qsModule=" + psModule + "&ctrl_Name=" + psId + "$" + piIdCol + "&ctrl_Name=" + psName + "$" + piNameCol + "&ret_Focus=" + psRetFocus + "&qsSearch=" + psSearch + "&qsLoadList=" + psLoadList + "&qsHead=" + psHeading + "&qsSubmit=" + psSubmit + "&qsRights=YYYY"
		window.open("../Controls/frm_SearchList.aspx?" + vsQuryString, "PopUpWindow", "left=10,top=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=770");
	}


/*-----------------------------------------------------------------------------------*/
/*	Function Name	:	MyTrim(pstr)												 */
/*	Purpose			:	This function is used to trim the string on client side.	 */
/*-----------------------------------------------------------------------------------*/	
	function MyTrim(pstr)
	{
		var tstr = new String(pstr);
		tstr = tstr.replace(/^\s-/, "");
		tstr = tstr.replace(/\s-$/, "");
		return tstr.valueOf();
	}
/*-----------------------------------------------------------------------------------*/	


/*-----------------------------------------------------------------------------------*/
/*	Function Name	:	CheckMaxLength(obj, maxlen, caption)						 */
/*	Purpose			:	To check for length of a text in a caption					 */
/*	Parameter		:																 */
/*						a. obj		=> Object to be checked.						 */
/*						b. maxlen	=> Minimum allowable length						 */
/*						c. caption	=> Caption name to be displayed in error message */
/*-----------------------------------------------------------------------------------*/		
	function CheckMaxLength(obj, maxlen, caption)
	{
		var mvlen = MyTrim(obj.value).length;
		var lvLen = parseInt(maxlen) + parseInt(20);
		if (mvlen > lvLen)
		{
		    alert("Kindly Enter "+caption+" Less Than " + lvLen + " Characters.");
			obj.focus();
			return false;
		}
		return true;
	}
/*-----------------------------------------------------------------------------------*/		


		function WindowOpen(psFileName,piHeight,piWidth,piTop,piLeft)
		{
				try
				{
					piHeight = Math.round(((515/572)  * screen.availHeight))
					piWidth = Math.round(((790/800)  * screen.availWidth))
					piTop = Math.round(((20/572) * screen.availHeight))
					piLeft = Math.round(((1/800) * screen.availWidth))

						if(typeof(piHeight) == 'undefined' || piHeight==0)
								{piHeight = 441}
						if(typeof(piWidth) == 'undefined' || piWidth==0)
								{piWidth = 780}
						if(typeof(piTop) == 'undefined' || piTop==0)
								{piTop = 79}
						if(typeof(piLeft) == 'undefined' || piLeft==0)
								{piLeft = 5}
						window.open(psFileName,"","height=" + piHeight + ",width=" + piWidth + ",left=" + piLeft + ",top=" + piTop + ",status=yes,scrollbars=yes,resizable=no")
				}
				catch (e)
				{
						alert("Error : " + e.description)
				}	
		}

/**************************************************************************************
	Function Name     : ConvRsBC
	Input             : Control name, Exchg Rate and Flag
	Output            : NIL
	Purpose           : Function to convert the base currency to Rupees and vice versa
	Created By        : Ankur Patel.
	Created On        : 24 February 2005 
	Modified By       : NIL
	Modified On       : NIL
	Reason            : NIL
**************************************************************************************/

function ConvRsBC(objTxt,ExRt,RsBC)
{
	/*
	if RsBC = R then convert Base Currency To Rupees
	else convert Rupees To Base Currency 
	*/
	if(RsBC == "R")
	{
		//objTxt.value = Math.round(Number(objTxt.value) * Number(ExRt),2)
		objTxt.value = objTxt.value * ExRt
		//objTxt.value = Number(objTxt.value) * Number(ExRt)
	}
	else
	{
		//objTxt.value = Math.round(Number(objTxt.value) / Number(ExRt),2)
		objTxt.value = objTxt.value / ExRt
		//objTxt.value = Number(objTxt.value) / Number(ExRt)
	}
	//FormatNumber(objTxt,'3','')
	return
}		
		
/* Code Block:		Added by Ashwin 
   Reason	 :		For Numeric with Decimal*/		
function formatNum(objNum,vsMinus)
{		
	var counter=0
	var flag
	var Cflag 
	var str
	var vinCtr

	str=new String(objNum.value)		
	if(event.keyCode<48 || event.keyCode > 57) /* If Not Numeric */
	{
			if(vsMinus=='N' && event.keyCode!=46)/* For Not accepting Minus */
			{
				event.keyCode=0
			}	
			if(event.keyCode!=46) /* If Not dot */
			{	if(vsMinus=='M')
				{	
				if(event.keyCode!=45)/* If Not minus */
					event.keyCode=0
				}	
			}		
			if((str.indexOf(".")!=-1 && event.keyCode==46) ) /* If dot found for second time */
				event.keyCode=0																		
			if(vsMinus=='M')
			{		
				if(str.indexOf("-")!=-1 && event.keyCode==45) /* If minus found for second time*/
					event.keyCode=0
			}				
	}
				
	if(event.keyCode==46)
			flag='T'
				
	if(str.length==8) /* If dot not found till position 8 inserts dot at position 8 */
		{
			if( str.indexOf(".")==-1 && event.keyCode!=46)
			objNum.value=objNum.value + '.'
		}
	counter=0					
		
	for(vinCtr=0;vinCtr<str.length;vinCtr++) 
	{				
		if(str.substring(vinCtr,vinCtr+1)==".")		
		{
			counter++
			if(counter>1)
				event.keyCode=0
		}
	}
	if(Cflag=='F')
			counter=0
	return		
}
/* End of Code Block:		Added by Ashwin  */										  

/*Function to compare dates*/
/*By Ankur*/
function CompareDate(vsFstr,vsSstr,vsFlg)
{
	if(vsFlg == "FS")//Compare for first date < second
	{   
		var vsTodDt = new String(vsFstr)
		var vsTxtDt = new String(vsSstr)
		if(Number(vsTodDt.substring(6,10)) < Number(vsTxtDt.substring(6,10)))
		{
			return true
		}
		else
		{
			if(Number(vsTodDt.substring(6,10)) == Number(vsTxtDt.substring(6,10)))
			{   
				if(Number(vsTodDt.substring(3,5)) < Number(vsTxtDt.substring(3,5)))
				//if(Number(vsTodDt.substring(0,2)) < Number(vsTxtDt.substring(0,2)))
				{
					return true
				}
	
				else
				{
					if(Number(vsTodDt.substring(3,5)) == Number(vsTxtDt.substring(3,5)))
					//if(Number(vsTodDt.substring(0,2)) == Number(vsTxtDt.substring(0,2)))
					{
						if(Number(vsTodDt.substring(0,2)) < Number(vsTxtDt.substring(0,2)))
						//if(Number(vsTodDt.substring(3,5)) < Number(vsTxtDt.substring(3,5)))
						{
							return true
						}
						else
						{
							return false
						}
					}
					else
					{
						return false
					}
				}
			}
			else
			{
				return false
			}
		}
	}
	else//Compare for second date < first 
	{
		var vsTodDt = new String(vsFstr)
		var vsTxtDt = new String(vsSstr)
		/*alert(Number(vsTodDt.substring(6,10)))
		alert(Number(vsTxtDt.substring(6,10)))
		alert(Number(vsTodDt.substring(3,5)))
		alert(Number(vsTxtDt.substring(3,5)))
		alert(Number(vsTodDt.substring(0,2)))
		alert(Number(vsTxtDt.substring(0,2)))*/
		if(Number(vsTodDt.substring(6,10)) > Number(vsTxtDt.substring(6,10)))
		{
			return true
		}
		else
		{
			if(Number(vsTodDt.substring(6,10)) == Number(vsTxtDt.substring(6,10)))
			{
				//if(Number(vsTodDt.substring(3,5)) > Number(vsTxtDt.substring(3,5)))
				if(Number(vsTodDt.substring(0,2)) > Number(vsTxtDt.substring(0,2)))
				{
					return true
				}
				else
				{
					//if(Number(vsTodDt.substring(3,5)) == Number(vsTxtDt.substring(3,5)))
					if(Number(vsTodDt.substring(0,2)) == Number(vsTxtDt.substring(0,2)))
					{
						//if(Number(vsTodDt.substring(0,2)) > Number(vsTxtDt.substring(0,2)))
						if(Number(vsTodDt.substring(3,5)) > Number(vsTxtDt.substring(3,5)))
						{
							return true
						}
						else
						{
							return false
						}
					}
					else
					{
						return false
					}
				}
			}
			else
			{
				return false
			}
		}
	}
}


	/*Function To Open Popups*/

	function OpenPopUp(psFileName,piHeight,piWidth,piTop,piLeft)
	{
		piTop = Math.round(((piTop/572) * screen.availHeight))
		piLeft = Math.round(((piLeft/800) * screen.availWidth))
		if(typeof(piTop) == 'undefined' || piTop==0)
			{piTop = Math.round(0.1381 * screen.availHeight)}
		if(typeof(piLeft) == 'undefined' || piLeft==0)
			{piLeft = Math.round(0.00625 * screen.availWidth)}
		window.open(psFileName,"","height=" + piHeight + ",width=" + piWidth + ",left=" + piLeft + ",top=" + piTop + ",status=no,scrollbars=no,resizable=no")
	}
	
		/****Function to check valid email ID By Ankur 07-11-2006*/
    function CheckEmail(vsEmlStr)
    {
        var vrRegExp = new RegExp(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)
        var vrRegExpR = new RegExp(/[.,<>?~`!@#$%^&*()_+-=|\\\"\'/]/)
        var vsRStr = new String(vsEmlStr)
        if(vrRegExp.test(vsEmlStr) == true && vrRegExpR.test(vsRStr.charAt(vsRStr.length-1)) == false && vrRegExpR.test(vsRStr.charAt(0)) == false)
        {
            return true
        }
        else
        {
            return false
        }
        //return vrRegExp.exec(vsEmlStr)
    }

///////////////////////////////////Get Browser Type///////////////////////////////////
//for updates --- http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
// Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
// Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
//                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
//                      correct Opera 5 detection
//                      add support for winME and win2k
//                      synch with browser-type-oo.js
// Revised 26 Mar 01 to correct Opera detection
// Revised 02 Oct 01 to add IE6 detection

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
//     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
// (2) browser version number:
//     is_major (integer indicating major version number: 2, 3, 4 ...)
//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
//     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_ie6, is_ie6up, is_hotjava3, is_hotjava3up,
//     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
// (4) JavaScript version number:
//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
//     is_os2
//     is_mac, is_mac68k, is_macppc
//     is_unix
//     is_sun, is_sun4, is_sun5, is_suni86
//     is_irix, is_irix5, is_irix6
//     is_hpux, is_hpux9, is_hpux10
//     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
//     is_linux, is_sco, is_unixware, is_mpras, is_reliant
//     is_dec, is_sinix, is_freebsd, is_bsd
//     is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.
//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when new versions of browsers are released, so
// in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
// is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
// to check version in code which you want to work on future
// versions.

    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);


    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
    var is_aol   = (agt.indexOf("aol") != -1);
    var is_aol3  = (is_aol && is_ie3);
    var is_aol4  = (is_aol && is_ie4);
    var is_aol5  = (agt.indexOf("aol 5") != -1);
    var is_aol6  = (agt.indexOf("aol 6") != -1);

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

    var is_webtv = (agt.indexOf("webtv") != -1); 

    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    var is_AOLTV = is_TVNavigator;

    var is_hotjava = (agt.indexOf("hotjava") != -1);
    var is_hotjava3 = (is_hotjava && (is_major == 3));
    var is_hotjava3up = (is_hotjava && (is_major >= 3));

    // *** JAVASCRIPT VERSION CHECK ***
    var is_js;
    if (is_nav2 || is_ie3) is_js = 1.0;
    else if (is_nav3) is_js = 1.1;
    else if (is_opera5up) is_js = 1.3;
    else if (is_opera) is_js = 1.1;
    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
    else if (is_hotjava3up) is_js = 1.4;
    else if (is_nav6 || is_gecko) is_js = 1.5;
    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.
    else if (is_nav6up) is_js = 1.5;
    // NOTE: ie5up on mac is 1.4
    else if (is_ie5up) is_js = 1.3

    // HACK: no idea for other browsers; always check for JS version with > or >=
    else is_js = 0.0;

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    var is_win16 = ((agt.indexOf("win16")!=-1) || 
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
               (agt.indexOf("windows 16-bit")!=-1) );  

    var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));

    var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
    var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    var is_win32 = (is_win95 || is_winnt || is_win98 || 
                    ((is_major >= 4) && (navigator.platform == "Win32")) ||
                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                    (agt.indexOf("ibm-webexplorer")!=-1));

    var is_mac    = (agt.indexOf("mac")!=-1);
    // hack ie5 js version for mac
    if (is_mac && is_ie5up) is_js = 1.4;
    var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                               (agt.indexOf("68000")!=-1)));
    var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                                (agt.indexOf("powerpc")!=-1)));

    var is_sun   = (agt.indexOf("sunos")!=-1);
    var is_sun4  = (agt.indexOf("sunos 4")!=-1);
    var is_sun5  = (agt.indexOf("sunos 5")!=-1);
    var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
    var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
    var is_irix5 = (agt.indexOf("irix 5") !=-1);
    var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
    var is_hpux  = (agt.indexOf("hp-ux")!=-1);
    var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
    var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
    var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
    var is_aix1  = (agt.indexOf("aix 1") !=-1);    
    var is_aix2  = (agt.indexOf("aix 2") !=-1);    
    var is_aix3  = (agt.indexOf("aix 3") !=-1);    
    var is_aix4  = (agt.indexOf("aix 4") !=-1);    
    var is_linux = (agt.indexOf("inux")!=-1);
    var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
    var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
    var is_mpras    = (agt.indexOf("ncr")!=-1); 
    var is_reliant  = (agt.indexOf("reliantunix")!=-1);
    var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
    var is_sinix = (agt.indexOf("sinix")!=-1);
    var is_freebsd = (agt.indexOf("freebsd")!=-1);
    var is_bsd = (agt.indexOf("bsd")!=-1);
    var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
                 is_sco ||is_unixware || is_mpras || is_reliant || 
                 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

    var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));