JDATE = {
	date:function(d) {
		k = d.indexOf("/");			
		return JSTR.toint(d.substring(0, k));
	},
	month:function(d) {
		i = d.indexOf("/");
		return JSTR.toint(d.substring(i + 1, i + 3));
	},
	year:function(d) {
		i = d.indexOf("/");
		return JSTR.toint(d.substring(i + 4, i + 9));
	},
	hour:function(d) {
		i = d.indexOf(":");
		return JSTR.toint(d.substring(i-2, i));
	},
	minute:function(d) {
		i = d.indexOf(":");
		return JSTR.toint(d.substring(i + 1, i + 3));
	},
	cyear:function() {
		var o = new Date();
		var c = o.getYear();
		if(navigator.appName == "Netscape")
			c += 1900;
		return c;
	},
	time:function(t) {
		if(!JSTR.exist(t, '1234567890:') || JSTR.count(t, ':') != 1)
			return false;
		if(!JSTR.between(JDATE.hour(t), 0, 23))
			return false;
		if(!JSTR.between(JDATE.minute(t), 0, 59))
			return false;
		return true;
	},
	fdate:function(d, s, e) {
		if(!JSTR.exist(d, '1234567890/') || JSTR.count(d, '/') != 2)
			return false;
		y = JDATE.year(d);
		m = JDATE.month(d);
		n = JDATE.date(d);
		if(typeof(s) == 'undefined')
			s = JDATE.cyear() - 1;
		if(typeof(e) == 'undefined')
			e = JDATE.cyear() + 222;
		if(!JSTR.between(y, s, e))
			return false;	
		if(!JSTR.between(m, 1, 12))
			return false;	
		if(!JSTR.between(n, 1, 31))
			return false;	
		if (m == 4 || m == 6 || m == 9 || m == 11 )
			if(n > 30)
				return false;
		if(((y % 4 == 0) && (y %100 != 0)) || y % 400 == 0) {
			if((m == 2 ) && ( n > 29))
				return false;
		} else
			if((m == 2 ) && ( n > 28))
				return false;
		return true;
	},
	fdatetime:function(d, s, e) {
		if(!JSTR.exist(d, '1234567890/: ') || JSTR.count(d, '/') != 2 || JSTR.count(d, ':') != 1 || JSTR.count(d, ' ') != 1)
			return false;
		y = JDATE.year(d);
		m = JDATE.month(d);
		n = JDATE.date(d);
		h = JDATE.hour(d);
		i = JDATE.minute(d);
		if(typeof(s) == 'undefined')
			s = JDATE.cyear() - 1;
		if(typeof(e) == 'undefined')
			e = JDATE.cyear() + 222;
		if(!JSTR.between(y, s, e))
			return false;	
		if(!JSTR.between(m, 1, 12))
			return false;	
		if(!JSTR.between(n, 1, 31))
			return false;	
		if (m == 4 || m == 6 || m == 9 || m == 11 )
			if(n > 30)
				return false;
		if(((y % 4 == 0) && (y %100 != 0)) || y % 400 == 0) {
			if((m == 2 ) && ( n > 29))
				return false;
		} else
			if((m == 2 ) && ( n > 28))
				return false;
		if((h > 23) || ( i > 59)) 
			return false;
		return 	true;
	},
	compare:function(d1, d2) {
		y1 = JDATE.year(d1);
		m1 = JDATE.month(d1);
		n1 = JDATE.date(d1);
		y2 = JDATE.year(d2);
		m2 = JDATE.month(d2);
		n2 = JDATE.date(d2);
		if(y1 < y2)
			return true;
		if(y1 == y2)
			if(m1 == m2) {
				if(n1 <= n2)
					return true;
			} else
				if(m1 < m2)
					return true;
		return false;
	},
	comparetime:function(d1, d2) {
		y1 = JDATE.year(d1);
		m1 = JDATE.month(d1);
		n1 = JDATE.date(d1);
		h1 = JDATE.hour(d1);
		i1 = JDATE.minute(d1);
		y2 = JDATE.year(d2);
		m2 = JDATE.month(d2);
		n2 = JDATE.date(d2);
		h2 = JDATE.hour(d2);
		i2 = JDATE.minute(d2);
		if(y1 < y2)
			return true;
		if(y1 == y2)
			if(m1 == m2) {
				if(d1 == d2) {
					if(h1 == h2)
						if(m1 <= m2) return true;
					else 
						if(h1 < h2) return true;
				} else 
					if(n1 < n2)
						return true;
			} else
				if(m1 < m2)
					return true;
		return false;
	},
	cdate:function(d) {
		if(!JDATE.fdate(d))
			return false;
		y = JDATE.year(d);
		m = JDATE.month(d);
		n = JDATE.date(d);
		o = new Date();
		cn = o.getDate();
		cm = o.getMonth() + 1;
		cy = o.getYear();
		if(y > cy)
			return true;
		if(y == cy)
			if(cm == m) {
				if(cn < n)
					return true;
			} else
				if(cm < m)
					return true;
		return false;
	},
	check:function(d, m) {
		switch(m) {
			case '04':
			case '06':
			case '09':
			case '11': 
				if(d>'30') return 0;
				break;
			case '02':
				if(d>'28') return 0;
				break;
		}
		return 1;
	}
}
