
/* **********************************************************************************
 Copyright (c) 2002-2003 HelpHire E-Register, All Rights Reserved.
 This work contains trade secrets and confidential material of HelpHire E-Register,
 and its use or disclosure in whole or in part  without explicit written permission
 of HelpHire E-Register is prohibited.
 Project Name          :   Guild Claim System
 File Name             :   GCSGeneric
 Author                :   IT Solutions
 Description           :   This java script file contains all the generic ans commonly 
                           used validations required for the system.   
 Modification History  :
 ==================================================================================
 Modified by   Date            Version.No.     Description
 ==================================================================================
 IT Solutions		 November 19, 2002    0.1          Original Version
 IT Solutions        January 7, 2003      2.0          Change Queries 
 **********************************************************************************/
//This variable is the default date format
var DATE_FORMAT = "DD/MM/YYYY";
var DATETIME_FORMAT = "DD/MM/YYYY hh:mm";
var strScreenRes = '0';
var CURRENT_DATE = new Date();
var strStylesheet = '../CSS/gcm.css';
var strBack ='';
var blnBackGround='1';
var url = '';
var CurrentFocus = '';
var obj = null;
if (blnBackGround=='1')
	strBack='background="../Images/content_bck.gif"';
else 
	strBack='bgcolor="#6e757d"';

if (screen.width <= 800 && screen.height <= 600)
    strStylesheet = '../CSS/gcm800.css' ;
else
    strStylesheet = '../CSS/gcm.css' ;

var strConfirmMsg = " Do you want to proceed with this operation? "

var isNetscape = false;
var isIE = false;

//This determines which browser the user is using
if (parseInt(navigator.appVersion) >= 4) {
	if(navigator.appName == "Netscape") {
		isNetscape = true;
	}else if (navigator.appName == "Microsoft Internet Explorer"){
		isIE = true;
	}
}

/*=====================================================================
Function Name   : showSel

Description     : This function is used for muting Enter key in IE
				  			  
Values Passed   : N/A
				  				  
Returns         : None
=====================================================================*/

function showSel()
{
	//document.onkeyup = EnterKeyCheck
	
}

/*=====================================================================
Function Name   : showCARfile

Description     : shows a CAR (word document)
				  			  
Values Passed   : filepath - relative sub-folder i.e. /Documents/GAR
				  showFileName - filename to show
				  				  
Returns         : None
=====================================================================*/
function showCARfile(filepath, showFileName)
{
	var ShowFileWindow,
		url = filepath + showFileName;

	ShowFileWindow = window.open(url,"ShowFileWindow","resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,left=0,top=0,width=" + (screen.width - 100) + "px,height=" + (screen.height - 100) + "px")
}


/*=====================================================================
Function Name   : imgswap

Description     : This function is used in getting an expression.
				  			  
Values Passed   : name - The formname
				  type - The type
				  				  
Returns         : None
=====================================================================*/


function imgswap(name, type)  
{
  eval("document." + name + ".src = '" + type + "'");
}

/*=====================================================================
Function Name   : dualimgswap

Description     : This function is used in getting an expression.
				  			  
Values Passed   : name - The formname
				  type - The type
				  name2 - The second name
				  type2 - The second type
				  				  
Returns         : None
=====================================================================*/


function dualimgswap(name, type, name2, type2)  
{
  eval("document." + name + ".src = '" + type + "'");
  eval("document." + name2 + ".src = '" + type2 + "'");
}


/*=====================================================================
Function Name   : trimString

Description     : This function is used in checking for number
				  			  
Values Passed   : strValue - The string that is to be trunner
				  				  				  
Returns         : Returns a string.
=====================================================================*/


function trimString(strValue)
{
    strValue = strValue + "" ;
    for (var startIndex=0;strValue.length > startIndex && strValue.charAt(startIndex)==' ';startIndex++);
    for (var endIndex=strValue.length-1;endIndex > startIndex && strValue.charAt(endIndex)==' ';endIndex--);
    return strValue.substring(startIndex,endIndex+1);
}


/*=====================================================================
Function Name   : isAlphaNumericWithSpecial

Description     : This function is used in checking for a special character
				  in the passed string.
				  			  
Values Passed   : strValue - The string that is seatched for the special
							 character.
				  strExpChrs - The special character to be searched for.
				  				  
Returns         : Returns either true or false.
=====================================================================*/

function isAlphaNumericWithSpecialChar(strValue, strExpChrs)
{
    var chrValue = '';
    for (var index = 0; index < strValue.length; ++index)
    {
        chrValue = strValue.charAt(index);
        if ((chrValue < 'a' || chrValue > 'z') &&
        (chrValue < 'A' || chrValue > 'Z') &&
        (chrValue < '0' || chrValue > '9'))
        {

            if ((strExpChrs.length > 0) && (strValue.charCodeAt(index) != "13") && (strValue.charCodeAt(index) != "160") && (strExpChrs.indexOf(chrValue) == -1)  )
            {
                return false;
            }
            if(strExpChrs.length == 0)
            {
                return false;
	    }
        }
    }
    return true;
}


/*=====================================================================
Function Name   : isAlphaNumeric

Description     : This function is used in checking for a special character.
				  			  
Values Passed   : chrValue - The character value to be checked.
				  				  
Returns         : Returns either true or false.
=====================================================================*/

function isAlphaNumeric(chrValue)
{
    if ((chrValue < 'a' || chrValue > 'z') &&
        (chrValue < 'A' || chrValue > 'Z') &&
        (chrValue < '0' || chrValue > '9'))
    {
        return false;
    }
    return true;

}



/*=====================================================================
Function Name   : isValidEmail

Description     : This function is used in validating the entered email 
				  address.
				  			  
Values Passed   : str - The string to be validated.
				  
Returns         : Returns true or false.
=====================================================================*/

function isValidEmail(str)
{

	if(str.length > 0)
        {
        	var strMessage = "The email address is not in a correct format Eg:aaaa@asd.com";
        	var strFirst = str.substring(0,1);

	        if (!isAlphaNumeric(strFirst))
        	{
	            return false;
	        }

	        var supported = 0;
        	if (window.RegExp)
        	{
	            var tempStr = "a";
        	    var tempReg = new RegExp(tempStr);
	            if (tempReg.test(tempStr))
        	        supported = 1;
        	}
	        if (!supported)
        	    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	        var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
        	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{2,3})(\\]?)$");
	        if(!r1.test(str) && r2.test(str))
        	    return (!r1.test(str) && r2.test(str));

	        return (!r1.test(str) && r2.test(str));
    	}
    	return true;
}



/*=====================================================================
Function Name   : isGreaterThanDate

Description     : This function is used in finding checking the biggest 
				  among the two dates provided  as inputs.
				  			  
Values Passed   : StartDate - The starting date
				  EndDate - The ending date
				  
Returns         : Returns true or false.
=====================================================================*/
function isGreaterThanDate(StartDate,EndDate)
{
	var intStart;
	var intEnd;
	var strStartDay;
	var strEndDay;
	var strStartMonth;
	var strEndMonth;
	var strStartYear;
	var strEndYear;

	var strSelectedFormat = DATE_FORMAT;
	var strStartDate = trimString(StartDate);
	var strEndDate = trimString(EndDate);

	intStart = strSelectedFormat.indexOf('D');
	intEnd = strSelectedFormat.lastIndexOf('D');

	if(StartDate.length > 0)
    	strStartDay = strStartDate.substring(intStart,intEnd + 1);

	strEndDay = strEndDate.substring(intStart,intEnd + 1);

	//Get the starting and ending index of "m" and get the month part.
	intStart = strSelectedFormat.indexOf('M');
	intEnd = strSelectedFormat.lastIndexOf('M');

	if(StartDate.length > 0)
    	strStartMonth = strStartDate.substring(intStart,intEnd + 1);
	strEndMonth   = strEndDate.substring(intStart,intEnd + 1);

	//Get the starting and ending index of "m" and get the year part.
	intStart = strSelectedFormat.indexOf('Y');
	intEnd = strSelectedFormat.lastIndexOf('Y');

	if(StartDate.length > 0)
    	strStartYear = strStartDate.substring(intStart,intEnd + 1);

	if(EndDate.length > 0)
		strEndYear   = strEndDate.substring(intStart,intEnd + 1);

	if(StartDate.length > 0)
	{
		if (strStartMonth.length > 2)
		{
			strStartMonth = monthToNum(strStartMonth);
		}
	}
	if(EndDate.length > 0)
	{
		if (strEndMonth.length > 2)
		{
			strEndMonth = monthToNum(strEndMonth);
		}
	}

    var dt1;
    var dt2;
    if(StartDate.length > 0)
    {
        dt1 = new Date(parseInt(strStartYear), parseInt(strStartMonth-1), parseInt(strStartDay-0)) ;
    }
    else
    {
        dt1 = CURRENT_DATE;
        var curYear = dt1.getYear();

		if (curYear < 200) curYear += 1900 ;

		if((intEnd-intStart) == 1)
		{
			curYear = '' + curYear;
			curYear = curYear.substring(2,curYear.length);
		}
		var dayStart = dt1.getDate();
		var monStart = dt1.getMonth();
		var yrStart  = curYear;
    	dt1    = new Date(yrStart, monStart , dayStart);
    }

    dt2 = new Date(parseInt(strEndYear), parseInt(strEndMonth-1), parseInt(strEndDay-0));
    if(dt1.getTime() > dt2.getTime())
    {
        return false;
    }
    return true;
}

/*=====================================================================
Function Name   : isGreaterThanDateTime

Description     : This function is used in finding checking the biggest 
				  among the two date times provided  as inputs.
				  			  
Values Passed   : StartDate - The starting date
				  EndDate - The ending date
				  
Returns         : Returns true or false.
=====================================================================*/
function isGreaterThanDateTime(StartDate,EndDate)
{
	var intStart;
	var intEnd;
	var strStartDay;
	var strEndDay;
	var strStartMonth;
	var strEndMonth;
	var strStartYear;
	var strEndYear;
	var strStartHour;
	var strEndHour;
	var strStartMin;
	var strEndMin;

	var strSelectedFormat = DATETIME_FORMAT;
	var strStartDate = trimString(StartDate);
	var strEndDate = trimString(EndDate);

	intStart = strSelectedFormat.indexOf('D');
	intEnd = strSelectedFormat.lastIndexOf('D');
	
	if(StartDate.length > 0)
    	strStartDay = strStartDate.substring(intStart,intEnd + 1);

	strEndDay = strEndDate.substring(intStart,intEnd + 1);

	//Get the starting and ending index of "m" and get the month part.
	intStart = strSelectedFormat.indexOf('M');
	intEnd = strSelectedFormat.lastIndexOf('M');

	if(StartDate.length > 0)
    	strStartMonth = strStartDate.substring(intStart,intEnd + 1);
	strEndMonth   = strEndDate.substring(intStart,intEnd + 1);

	//Get the starting and ending index of "m" and get the year part.
	intStart = strSelectedFormat.indexOf('Y');
	intEnd = strSelectedFormat.lastIndexOf('Y');

	if(StartDate.length > 0)
    	strStartYear = strStartDate.substring(intStart,intEnd + 1);

	if(EndDate.length > 0)
		strEndYear   = strEndDate.substring(intStart,intEnd + 1);
		
	intStart = strSelectedFormat.indexOf('h');
	intEnd = strSelectedFormat.lastIndexOf('h');
	
	if(StartDate.length > 0)
    	strStartHour = strStartDate.substring(intStart,intEnd + 1);

	if(EndDate.length > 0)
		strEndHour   = strEndDate.substring(intStart,intEnd + 1);
		
	intStart = strSelectedFormat.indexOf('m');
	intEnd = strSelectedFormat.lastIndexOf('m');
	
	if(StartDate.length > 0)
    	strStartMin = strStartDate.substring(intStart,intEnd + 1);

	if(EndDate.length > 0)
		strEndMin   = strEndDate.substring(intStart,intEnd + 1);

	if(StartDate.length > 0)
	{
		if (strStartMonth.length > 2)
		{
			strStartMonth = monthToNum(strStartMonth);
		}
	}
	if(EndDate.length > 0)
	{
		if (strEndMonth.length > 2)
		{
			strEndMonth = monthToNum(strEndMonth);
		}
	}

    var dt1;
    var dt2;
    if(StartDate.length > 0)
    {
        dt1 = new Date(parseInt(strStartYear), parseInt(strStartMonth-1), parseInt(strStartDay-0), parseInt(strStartHour),parseInt(strStartMin)) ;
    }
    else
    {
        dt1 = CURRENT_DATE;
        var curYear = dt1.getYear();

		if (curYear < 200) curYear += 1900 ;

		if((intEnd-intStart) == 1)
		{
			curYear = '' + curYear;
			curYear = curYear.substring(2,curYear.length);
		}
		var dayStart = dt1.getDate();
		var monStart = dt1.getMonth();
		var yrStart  = curYear;
    	dt1    = new Date(yrStart, monStart , dayStart);
    }

    dt2 = new Date(parseInt(strEndYear), parseInt(strEndMonth-1), parseInt(strEndDay-0),parseInt(strEndHour), parseInt(strEndMin) );
    
    if(dt1.getTime() > dt2.getTime())
    {
        return false;
    }
    return true;
}

/*=====================================================================
Function Name   : getCheckedBoxCount

Description     : This function is used in getting the total count of all 
				  the checked check boxes in the screen.
				  			  
Values Passed   : strFormName - The form object
				  
Returns         : Clears all the controls in the screen.
=====================================================================*/

function getCheckedBoxCount(strFormName)
{
    var intChkCounter = 0 ;
    var intNoOfElements = strFormName.elements.length ;

    for ( var intIndex = 0; intIndex < intNoOfElements; intIndex++ )
    {
        if(strFormName.elements[intIndex].type.toLowerCase() == "checkbox")
        {
            if (strFormName.elements[intIndex].checked)
                intChkCounter++ ;

        }
    }

    return(intChkCounter) ;

}


/*=====================================================================
Function Name   : checkAllCheckBoxes

Description     : This function is used in selecting all the check boxes in
				  the form.
				  			  
Values Passed   : thisForm - The form object
				  
Returns         : Checks all the check boxes, else returns false.
=====================================================================*/


function checkAllCheckBoxes(thisForm)
{
	var count = 0;
	for(var i = 0; i < thisForm.elements.length; i++)
	{
		var elemType = thisForm.elements[i].type;

		if(elemType.toUpperCase() == 'CHECKBOX')
		{
			thisForm.elements[i].checked=true;
		}
	}

	return false;
}


/*=====================================================================
Function Name   : isValidNumber

Description     : This function is used in checkin if the entered number
				  is in valid format or not. The number along with the length
				  and precision to be checked is passed as parameters
				  
Values Passed   : intVal - The number to be checked.
				  intNumLength - The length of the integer portion.
				  intDecLength - The length of the decimal portion.
				  
Returns         : True if valid, else returns false
=====================================================================*/
function isValidNumber(intVal,intNumLength, intDecLength)

{
	if (intVal!="" && intVal!="." && intNumLength!=0 && intDecLength !=0)
    {
		regval=eval('/^-?[0-9]{0,' + intNumLength + '}[\\.][0-9]{0,' + intDecLength +'}$|^-?[0-9]{0,' + intNumLength + '}$/');
		return regval.test(intVal);
	}
	else if (intVal!="" && intNumLength!=0 )
	{
		regval=eval('/^-?[0-9]{0,' + intNumLength + '}$/');
		return regval.test(intVal);
	}
	else
	{
		return false;
	}
}

/*=====================================================================
Function Name   : IsNumeric

Description     : This checks that only numeric numbers have been entered
				  eg '001'
				  
Values Passed   : srtString - The number to be checked.
				  
Returns         : True if valid, else returns false
=====================================================================*/
function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         
         IsNumber = false;
         }
      }
   return IsNumber; 
   }

/*=====================================================================
Function Name   : FormatNumber

Description     : Formats the number to two decimal places eg .00
				  
Values Passed   : intVal - The number to be checked.
				  intNumOfDec - The number of decimal places.
				  
Returns         : The formatted number
=====================================================================*/
function formatNumber(intVal, intNumOfDec) 
   { 
      var decimal = 1 
      for(i=1; i<=intNumOfDec;i++) 
         decimal = decimal *10 

      var myFormattedNum = (Math.round(intVal * decimal)/decimal).toFixed(intNumOfDec) 
      
      return myFormattedNum;
      //alert(myNum + "   " +  myFormattedNum)             
   } 


/*=====================================================================
Function Name   : calculateSettlementValue

Description     : This function is used in calculating the settlement value
				  for the user entered discount and current value.
				  Settlement is calculated from the formula in the function.
				  
Values Passed   : intCurrentValue - The current value entered by the user.
				  intDiscount - The dicount value entered by the user.
				  
Returns         : Returns the calculated number, else returns false
=====================================================================*/


function calculateSettlementValue(intCurrentValue,intDiscount)
{
	if (intCurrentValue!="" && intDiscount!="")
	{	
		//EZG 30/6/2004 change to the discount calculation as it wasn't working correctly.
		var strTemp=Math.round(intCurrentValue * (1 - (intDiscount/100))*Math.pow(10,2))/Math.pow(10,2);
		
		return strTemp;
	}
	else
		return false;
}

/*=====================================================================
Function Name      : calculateDiscount

Description     : This function is used in calculating the discount for
				  the user entered settlement value and current value.
				  Discount is calculated from the formula in the function.
				  				  
Values Passed   : intCurrentValue - The current value entered by the user.
				  intSettlementValue - The settlement value entered by the user.

Returns         : Returns the calculated number, else returns false.
=====================================================================*/

				
function calculateDiscount(intCurrentValue, intSettlementValue )
{
	if (intCurrentValue!="" && intSettlementValue!="")
	{		
		//EZG 30/6/2004 change to the discount calculation as it wasn't working correctly.
		strTemp=Math.round(100*(1-(intSettlementValue/intCurrentValue))*Math.pow(10,2))/Math.pow(10,2);
		
		return strTemp;
	}
	else
		return false;
}


/*=====================================================================
Function Name   : isValidDate

Description     : This function is used in checking if the entered date
				  is valid or not.
				  
Values Passed   : intDay - The day part of the date to be validated.
				  intMon - The month part of the date to be validated.
				  intYear - The Year part of the date to be validated.

Returns         : True if valid, else returns false
=====================================================================*/
function isValidDate(intDay,intMon,intYear)
{
	var arrMonth=new Array(12);
	var strYear
	if (intDay.toString().length != 2)
		return false;
		
	if (intMon.toString().length != 2)
		return false;
	
	strYear = intYear.toString()
	//Added to remove the time
	if(strYear.length > 4)
		intPlace = strYear.indexOf(" ");
		strYear = strYear.substr(0,intPlace); 
	
	if (strYear.length != 4)
		return false;
		
	arrMonth[1]=31;
	if ((intYear%4)==0)    
		arrMonth[2]=29;
	else
		arrMonth[2]=28;
	arrMonth[3]=31;
	arrMonth[4]=30;
	arrMonth[5]=31;
	arrMonth[6]=30;
	arrMonth[7]=31;
	arrMonth[8]=31;
	arrMonth[9]=30;
	arrMonth[10]=31;
	arrMonth[11]=30;
	arrMonth[12]=31;
	
	if (intDay>arrMonth[intMon])
		return false;
	else
		return true;
}			

/*=====================================================================
Function Name   : isValidDateChars

Description     : This function is used in checking if the entered date
				  is valid or not.
				  
Values Passed   : strDate :  the date to check

Returns         : True if valid, else returns false
=====================================================================*/
function isValidDateChars(strDate)
{
   var ValidChars = "0123456789/";
   var IsNumber=true;
   var Char;
   for (i = 0; i < strDate.length && IsNumber == true; i++) 
      { 
      Char = strDate.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber; 
}			

/*=====================================================================
Function Name   : showStatus

Description     : This function is used in setting the clients name in 
				  the status bar of the browser
				  
Values Passed   : None

Returns         : None
=====================================================================*/


function showStatus()
{
	window.status = "Guild Claim System"
	return true;
}


function similar()
{
		var temp,str;
		for (i=0;i<document.forms[0].elements.length;i++)
		{
			if (document.forms[0].elements[i].type != 'undefined' && document.forms[0].elements[i].name != '__VIEWSTATE')
			{	
										
				if(document.forms[0].elements[i].type == 'checkbox')
				{
					temp='hid'+ document.forms[0].elements[i].name;
					str=eval('document.forms[0].'+ temp);
					var chkval ;
					if(document.forms[0].elements[i].checked)
					{
							chkval  = -1
					}
					else
					{		chkval = 0
					
					}
					if (chkval!= str.value)
					{
						return false;
					}
					
				}
										
				if(document.forms[0].elements[i].type == 'select-one')
				{
					temp='hid'+ document.forms[0].elements[i].name;
					str=eval('document.forms[0].'+ temp);
					if (document.forms[0].elements[i].value!= str.value)
					{
						return false;
					}
					
				}
				
				if(document.forms[0].elements[i].type=='text')
				{
					temp='hid'+ document.forms[0].elements[i].name;
					str=eval('document.forms[0].'+ temp);
					if (trimString(document.forms[0].elements[i].value)!= trimString(str.value))
					{
						return false;
					}
				}
				
				if(document.forms[0].elements[i].type=='textarea')
				{
					temp='hid'+ document.forms[0].elements[i].name;
					str=eval('document.forms[0].'+ temp);
					if (trimString(document.forms[0].elements[i].value)!= trimString(str.value))
					{
						return false;
					}
				}
				
				if(document.forms[0].elements[i].type=='radio')
				{
					if (document.forms[0].elements[i].checked)
					{
						temp='hid'+ document.forms[0].elements[i].name;
						str=eval('document.forms[0].'+ temp);
						
						if (trimString(document.forms[0].elements[i].value)!= trimString(str.value))
						{
							return false;
						}
					}
				}
				
			}
		}	
		return true;
}	

/*=====================================================================
Function Name   : AssignUrl

Description     : Assign the Url
				  			  
Values Passed   : url
				  				  
Returns         : None
=====================================================================*/
function AssignUrl(url1)
{
	url = url1;	
}
/*=====================================================================
Function Name   : EnterKeyCheck

Description     : This function is used to check for Enter Key
				  			  
Values Passed   : evt Event Handle
				  				  
Returns         : None
=====================================================================*/
function EnterKeyCheck(evt)
{		
	
		if(CurrentFocus=='textarea')
		{
			return false;
		}
	
	var theButtonPressed;
	if (isNetscape) 
	{
		theButtonPressed = evt.which;
	}else if(isIE) 
	{
		theButtonPressed = window.event.keyCode;
	}
	
	if (theButtonPressed == 13)
	{					
		if (Validate())
		{					
			document.forms[0].action=url;
			document.forms[0].submit();
			return true;
		}
		else
		{
			return false;
		}					
		
	}
	return false;
}	

/*=====================================================================
Function Name   : DateComparison

Description     : This function checks the passed date is either in the 
				  future or in the past depending on 2nd param				  			  
Values Passed   : sDate		= the date to chack
				  CurDbDate = The current db date
				  bPastDate as True (in past) False (in future)	  
				  bDateTime as true (compare date and time) False (just compare date)
Returns         : None
=====================================================================*/
function DateComparison(sDate,CurDbDate,bPastDate,bDatetime)
{
	var currdateTemp
	var currdate,currmonth,curryear,sDateTemp,sDateTemp1,sDateTemp2,sDateTemp3
	//converting database date for comparision
	currdateTemp=CurDbDate.split("/")
	if (currdateTemp.length==0)
		return false;
	
	currdate=currdateTemp[0];
	if (currdate.length < 2)
		currdate='0' + currdate;
	currmonth=currdateTemp[1];
	if (currmonth.length < 2)
		currmonth='0' + currmonth;
	curryear=currdateTemp[2];
	CurDbDate=currdate + '/' + currmonth + '/' + curryear 
	
	if(!isValidDate(currdate,currmonth,curryear))
		return false;
											
	// Converted the date to check to standard formats
	sDateTemp=sDate.split("/")
	if (sDateTemp.length<3)
		return false;
	
	sDateTemp1=sDateTemp[0];
	if (sDateTemp1.length < 2)
		sDateTemp1='0' + sDateTemp1;
		sDateTemp2=sDateTemp[1];
	if (sDateTemp2.length < 2)
		sDateTemp2='0' + sDateTemp2;
		sDateTemp3=sDateTemp[2];
		sDateTemp= sDateTemp1 + '/' + sDateTemp2 + '/' + sDateTemp3;
		
	if(!isValidDate(sDateTemp1,sDateTemp2,sDateTemp3))
		return false;
		
	if(bPastDate=true)
	{
		if(bDatetime=true)
			return (isGreaterThanDateTime(sDateTemp,CurDbDate));
		else
			return (isGreaterThanDate(sDateTemp,CurDbDate));		
	}
	else
	{
		if(bDatetime=true)
			return (isGreaterThanDateTime(CurDbDate,sDateTemp));
		else
			return (isGreaterThanDate(CurDbDate,sDateTemp));
	}
}

