
var View = 1;

function SelectBox(name, id, start, end, selectedValue, valueAdjust, increment, data, eventCall, className, style){
	this.Name = name;
	this.Id = id;
	this.Start = start;
	this.End = end;
	this.SelectedValue = selectedValue;
	this.ValueAdjust = valueAdjust;
	this.Increment = increment;
	this.Data = data;
	this.EventCall = eventCall;
	this.ClassName = className;
	this.Style = style;
}

SelectBox.prototype.Render = function(){
	
	var text = '<select ';
  
	if(this.Name != null){ text += ' name="' + this.Name + '" '; }
	if(this.Id != null){ text += ' id="' + this.Id + '" '; }
	if(this.EventCall != null){ text += ' onchange="' + this.EventCall + '" '; }
	if(this.ClassName != null){ text += ' class="' + this.ClassName + '" '; }
	if(this.Style != null){ text += ' style="' + this.Style + '" '; }
	text += '>';
	var ii;
	var i = this.Start;
	text += '<option value="">...</option>';
	do{
		
		if(i<10){ ii = '0' + (i+this.ValueAdjust) } else { ii = i }
		text += '<option value="' + ii + '"';
		if((i+this.ValueAdjust) ==  Math.abs(this.SelectedValue)){ text += ' selected="selected" ' };
		text += '>';
		if(this.Data != null) { text += this.Data[i-1] } else { text += i }
		text += '</option>';
		i += this.Increment;
	}
	while(i<=this.End)
	text += '</select>';
	document.write(text);
}

/*
SelectBox.prototype.Render = function(){
	
	document.write('<select ');
	if(this.Name != null){ document.write(' name="' + this.Name + '" '); }
	if(this.Id != null){ document.write(' id="' + this.Id + '" '); }
	if(this.EventCall != null){ document.write(' onchange="' + this.EventCall + '" '); }
	if(this.ClassName != null){ document.write(' class="' + this.ClassName + '" '); }
	if(this.Style != null){ document.write(' style="' + this.Style + '" '); }
	document.write('>');
	var ii;
	var i = this.Start;
	document.write('<option value="">...</option>');
	do{
		document.write('<option ');
		if(i<10){ ii = '0' + (i+this.ValueAdjust) } else { ii = i }
		document.write('<option value="' + ii + '"');
		if((i+this.ValueAdjust) ==  Math.abs(this.SelectedValue)){ document.write(' selected="selected" ') };
		document.write('>');
		if(this.Data != null) { document.write(this.Data[i-1]) } else { document.write(i) }
		document.write('</option>');
		i += this.Increment;
	}
	while(i<=this.End)
	document.write('</select>');
}
*/
	
function SelectBoxCombined(name, id, start, end, selectedValue, valueAdjust, increment, data, eventCall, className, style){
	this.Name = name;
	this.Id = id;
	this.Start = start;
	this.End = end;
	this.SelectedValue = selectedValue;
	this.ValueAdjust = valueAdjust;
	this.Increment = increment;
	this.Data = data;
	this.EventCall = eventCall;
	this.ClassName = className;
	this.Style = style;
}
	
	
SelectBoxCombined.prototype.Render = function(){
	document.write('<select ');
	if(this.Name != null){ document.write(' name="' + this.Name + '" '); }
	if(this.Id != null){ document.write(' id="' + this.Id + '" '); }
	if(this.EventCall != null){ document.write(' onchange="' + this.EventCall + '" '); }
	if(this.ClassName != null){ document.write(' class="' + this.ClassName + '" '); }
	if(this.Style != null){ document.write(' style="' + this.Style + '" '); }
	document.write('>');
	var Today = new Date();
	var SelectedValue = this.SelectedValue.split(',');
	var SelectedMonth = SelectedValue[0];
	var SelectedYear = SelectedValue[1];
	for(var year=Today.getFullYear();year<=Today.getFullYear()+2;year++){
		var i = 1;
		for(var month = 0;month<=11;month++){
			var ThisDate = new Date(year, month, 1);
			if(i<10){ i = '0' + i } else { i = i }
			if(Today.getMonth() <= month || Today.getYear() < year){
				document.write('<option value="' + i + ',' + year + '"')
				if(((SelectedMonth-1) == month) && (SelectedYear == year)){
					document.write(' selected="selected" ');
				}
				document.write('>');
				document.write(MonthShortName[month] + ', ' + year + '</option>');
			}
			i++;
		}
	}
	document.write('</select>');
}
