// Title: Tigra Calendar
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 3.2 (European date format)
// Date: 10/14/2002 (mm/dd/yyyy)
// Feedback: feedback@softcomplex.com (specify product title in the subject)
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.
// Note: Script consists of two files: calendar?.js and calendar.html
// About us: Our company provides offshore IT consulting services.
//    Contact us at sales@softcomplex.com if you have any programming task you
//    want to be handled by professionals. Our typical hourly rate is $20.

var calendars = [];

function calendar_popup(obj_day, obj_month, obj_year) {

	this.popup    = calendar_popup_popup;
	// validate input parameters
	if (!obj_day || !obj_month || !obj_year) {
		return calendar_popup_error("Error calling the calendar: no target controls specified");
	}
	if (((obj_day.length||99) == 99) || ((obj_month.length||99) == 99) || ((obj_year.length||99) == 99)) {
		return calendar_popup_error("Error calling the calendar: parameter specified is not valid tardet control");
	}
	this.day_target = obj_day;
	this.month_target = obj_month;
	this.year_target = obj_year;
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}

function calendar_popup_popup(nDay, nMonth, nYear) {
	
	if (nYear && nMonth && nDay) {
		this.dt_day = nDay;
		this.dt_month = nMonth;
		this.dt_year = nYear;
	} else {	
		this.dt_day = this.day_target.options[this.day_target.selectedIndex].value;	
		this.dt_month = this.month_target.options[this.month_target.selectedIndex].value;	
		this.dt_year = this.year_target.options[this.year_target.selectedIndex].value;	
	}
	var obj_calwindow = window.open(
		'../js/calendar.html?day=' + this.dt_day.valueOf()+ 
		'&month=' + this.dt_month.valueOf()+ 
		'&year=' + this.dt_year.valueOf()+ 
		'&id=' + this.id,
		'Calendar', 'width=200,height=190,status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
	);
	obj_calwindow.opener = window;
	obj_calwindow.focus();
}

function calendar_popup_error (str_message) {
	alert (str_message);
	return null;
}
