//alan.warriner@bigfoot.com
//http://www.alan-warriner.co.uk
//date validator function DateObject.IsValid(Y,M,D,h,m,s,ms)
//all parameters optional
//Javascript 1.3

//add member to date object
Date.prototype.IsValid=IsValid;

//***************
//*  Functions  *
//***************

//**************************************************
//check if a date is valid
//return true if ok
//date object is set to date value parameters

function IsValid(Year,Month,Day,Hours,Minutes,Seconds,Milliseconds)
{
switch (arguments.length)
	{
	case 0:Year=0;
	case 1:Month=0;
	case 2:Day=1;
	case 3:Hours=0;
	case 4:Minutes=0;
	case 5:Seconds=0;
	case 6:Milliseconds=0;
	}

this.setYear(Year);
this.setMonth(Month);
this.setDate(Day);
this.setHours(Hours);
this.setMinutes(Minutes);
this.setSeconds(Seconds);
this.setMilliseconds(Milliseconds);

if((Year!=this.getYear()&&Year!=this.getFullYear())||Month!=this.getMonth()||Day!=this.getDate()
||Hours!=this.getHours()||Minutes!=this.getMinutes()||Seconds!=this.getSeconds()||Milliseconds!=this.getMilliseconds() )
 {	
 return false;
 }
else
 {
 return true;
 }
}

