

var calendar = new DHTMLSuite.calendar({minuteDropDownInterval:5,numberOfRowsInHourDropDown:6,callbackFunctionOnDayClick:'getDateFromCalendar',isDragable:false,displayTimeBar:true}); 
	calendar.setCallbackFunctionOnClose('myOtherFunction');
	
	function myOtherFunction(inputArray)
	{
		var references = calendar.getHtmlElementReferences(); // Get back reference to form field.
		references.myDate.value = formatDate(new Date(getDateFromFormat(inputArray.year + '-' + inputArray.month + '-' + inputArray.day + ' ' + inputArray.hour + ':' + inputArray.minute,"y-MM-dd HH:mm")),gl_date_form);		
	}
	
	var gl_date_format="yyyy-MM-dd";
	var gl_date_form="yyyy-mm-dd";
	
	function pickDate(buttonObj,inputObject,date_format,date_form)
	{
		gl_date_format=date_format;
		gl_date_form=date_form;
		calendar.setCalendarPositionByHTMLElement(inputObject,0,inputObject.offsetHeight+2);	// Position the calendar right below the form input
		calendar.setInitialDateFromInput(inputObject,date_format);	// Specify that the calendar should set it's initial date from the value of the input field.
		calendar.addHtmlElementReference('myDate',inputObject);	// Adding a reference to this element so that I can pick it up in the getDateFromCalendar below(myInput is a unique key)
		if(calendar.isVisible()){
			calendar.hide();
		}else{
			calendar.resetViewDisplayedMonth();	// This line resets the view back to the inital display, i.e. it displays the inital month and not the month it displayed the last time it was open.
			calendar.display();
		}		
	}	
	/* inputArray is an associative array with the properties
	year
	month
	day
	hour
	minute
	calendarRef - Reference to the DHTMLSuite.calendar object.
	*/
	function getDateFromCalendar(inputArray)
	{
		
		var references = calendar.getHtmlElementReferences(); // Get back reference to form field.
		references.myDate.value = formatDate(new Date(getDateFromFormat(inputArray.year + '-' + inputArray.month + '-' + inputArray.day + ' ' + inputArray.hour + ':' + inputArray.minute,"y-MM-dd HH:mm")),gl_date_form);
		calendar.hide();	
	}	
	
	var img_path_rating="";
	function init_rating(rating_obj_id,rating_field_id,img_path)
	{
		img_path_rating=img_path;
		for(var i=0;i<5;i++)
		{
			$('star'+i).onmouseover=function()
			{
				cont=this.id.replace("star","");
				for(var j=0;j<parseInt(cont)+1;j++)
					$('star'+j).src=img_path_rating+"starfull.jpg";
			}
			$('star'+i).onmouseout=function()
			{
				cont=this.id.replace("star","");
				for(var j=cont;j<5;j++)
					$('star'+j).src=img_path_rating+"starempty.jpg";
			}
			$('star'+i).onclick=function()
			{
				$(rating_field_id).value=parseInt(this.id.replace("star",""))+1;
				for(var j=0;j<5;j++)
				{
					$('star'+j).onmouseover=function(){}
					$('star'+j).onmouseout=function(){}
				}
				$(rating_obj_id).onmouseout=function(){}
			}
		}	
		$(rating_obj_id).onmouseout=function()
		{
			for(var j=0;j<5;j++)
				$('star'+j).src=img_path_rating+"starempty.jpg";
		}
	}