function generateICECubeEnabledButton(buttonNames, tooltips, actions, separationInPx)
{
	generateICECubeButtons(	"/ICECube/images/button/button_enabled_left.png",
				"/ICECube/static/images/button/button_enabled_bg.png",
				"/ICECube/static/images/button/button_enabled_right.png",
				buttonNames,
				tooltips,
				actions,
				separationInPx,
				"pointer");
}

function generateICECubeGreyButton(buttonNames, tooltips, actions, separationInPx)
{
	generateICECubeButtons(	"/ICECube/static/images/button/button_grey_left.png",
				"/ICECube/static/images/button/button_grey_bg.png",
				"/ICECube/static/images/button/button_grey_right.png",
				buttonNames,
				tooltips,
				actions,
				separationInPx,
				"default");
}

function generateICECubeDisabledButton(buttonNames, tooltips, actions, separationInPx)
{
	generateICECubeButtons(	"/ICECube/static/images/button/button_disabled_left.png",
				"/ICECube/static/images/button/button_disabled_bg.png",
				"/ICECube/static/images/button/button_disabled_right.png",
				buttonNames,
				tooltips,
				actions,
				separationInPx,
				"pointer");
}

function generateICECubeActionButton(buttonNames, tooltips, actions, separationInPx)
{
	generateICECubeButtons(	"/ICECube/static/images/button/button_ation_left.gif",
				"/ICECube/static/images/button/button_action_bg.gif",
				"/ICECube/static/images/button/button_action_right.gif",
				buttonNames,
				tooltips,
				actions,
				separationInPx,
				"pointer");
}

function generateICECubeButtons(leftImg, middleImg, rightImg, buttonNames, tooltips, actions, separationInPx, cursor)
{
	buttonNumber=buttonNames.length;
	if (buttonNumber>0)
	{
		var button="";
		button+="<table border='0' cellpadding='0' cellspacing='2'>";
		button+="<tbody>";
		button+="<tr>";

		for (buttonCount=0;buttonCount<buttonNumber;buttonCount++)
		{
			button+="<td nowrap style=\"text-align: center;vertical-align: top;\">";
			if (!actions[buttonCount]==(""))
				button+="<a onClick=\""+actions[buttonCount]+"\" href=\"#\" style=\"text-decoration: none;cursor:"+cursor+"\" title=\""+tooltips[buttonCount]+"\">";
			else
			{
				cursor="default";
				button+="<a style=\"text-decoration: none;cursor:"+cursor+"\" title=\""+tooltips[buttonCount]+"\">";
				button+="<div style=\"text-align:left;\" onclick=\""+actions[buttonCount]+"\">";
			}
			
			button+="<table cellspacing=0 cellpadding=0><tr>";
			button+="<td nowrap><img src=\""+leftImg+"\" alt=\"\" style=\"vertical-align: top; align:left;border:0\"/></td>";
			button+="<td nowrap style=\"background: url("+middleImg+");\"><font style=\"text-align:center;vertical-align: middle;font-size:0.7em\" color=white size=3>&nbsp;&nbsp;"+buttonNames[buttonCount]+"&nbsp;&nbsp;</"+"font></td>";
			button+="<td nowrap><img src=\""+rightImg+"\" alt=\"\" style=\"vertical-align: top; border:0\"/></td>";
			button+="</tr></table>";
			if (actions[buttonCount]==(""))
				button+="</"+"div>";
			button+="</"+"a>";
			button+="</"+"td>";
			if (buttonCount+1!=buttonNumber)
				button+="<td width="+separationInPx+"px></"+"td>";
		}
		button+="</"+"tr>";
		button+="</"+"tbody>";
		button+="</"+"table>";
		document.writeln(button);
	}
	
	function initialiseCalendars()
	{
		start_cal = new CalendarPopup("calendar");
		end_cal = new CalendarPopup("calendar");
		start_cal.setCssPrefix("ICE");
		start_cal.showNavigationDropdowns();
		start_cal.setWeekStartDay(1);

		end_cal.setCssPrefix("ICE");
		end_cal.showNavigationDropdowns();
		end_cal.setWeekStartDay(1);
	}
}

