// GenImageDate.js

function GenImageDate() {
    this.initialize.apply(this, arguments);
}
GenImageDate.prototype = {
	initialize: function() {
		//
		this.setCount = false;
		this.setCountLimit = 3;
		this.counter = 0;
	},
	
	setCounter: function(_c, _num) {
		this.setCount = _c;
		this.setCountLimit = _num;
	},
	
	genImage: function(_date) {
		if (this.setCount && this.setCountLimit <= this.counter) {
			return;
		}
		// _date = '080218'
		this.date = _date;
		this.DirectoryPath = '/common/img/num/';
		this.y = 'y_' + _date.substring(0, 2) + '.gif';
		this.m = 'm_' + _date.substring(2, 4) + '.gif';
		this.d = 'd_' + _date.substring(4, 6) + '.gif';

		this.yTag = '<img src="' + this.DirectoryPath + this.y + '" />';
		this.mTag = '<img src="' + this.DirectoryPath + this.m + '" />';
		this.dTag = '<img src="' + this.DirectoryPath + this.d + '" />';
		
		this.write();
		this.counter++;
	},

	write: function() {
		document.write(this.yTag);
		this.writeDot();
		document.write(this.mTag);
		this.writeDot();
		document.write(this.dTag);
	},
	
	writeDot: function() {
		document.write('<img src="' + this.DirectoryPath + 'num_dotted.gif" />');
	}
};

//var x = new GenImageDate();
