function openPhoto(image) {
	photoWindow = open(image, "photo_window", "width=700,height=550,scrollbars=no,resizable=yes,screenX=1,screenY=1,top=1,left=1");
	photoWindow.focus();
}

function openMini(page) {
	miniWindow = open(page, "mini_window", "width=390,height=420,scrollbars=no,resizable=no,screenX=1,screenY=1,top=1,left=1");
	miniWindow.focus();
}

function openStatus() {
	miniWindow = open("status.jsp", "mini_window", "width=390,height=420,scrollbars=no,resizable=no,screenX=1,screenY=1,top=1,left=1");
	miniWindow.focus();
}

function menuoverlink(obj) {
	obj.className="MenuOver";
	obj.style.cursor="hand";
}
function menuover(obj) {
	obj.className="MenuOver";
}
function menuout(obj) {
	obj.className="Menu";
}

function menudown(obj) {
	obj.className="MenuDown";
}
function submenuover(obj) {
	obj.className="SubMenuOver";
	obj.style.cursor="hand";
}

function submenuout(obj) {
	obj.className="SubMenu";
}

function submenudown(obj) {
	obj.className="SubMenuDown";
}

function nav(link) {
	location.href=link;
}

function show(objid) {
	document.getElementById(objid).style.display = "block";
}

function hide(objid) {
	document.getElementById(objid).style.display = "none";
}

function showhide(hideid, showid) {
	document.getElementById(showid).style.display = "block";
	document.getElementById(hideid).style.display = "none";
}
//
//Mover Box Script
//

/* This Function Moves rows from one list box to another */
function Activate_MoverBox(active_box,dest_box)
{ for(var i=0; i<active_box.options.length; i++)
	{if(active_box.options[i].selected && active_box.options[i].value != "" && active_box.options[i].value != "#")
		{
			var luo_option = new Option();
			luo_option.value = active_box.options[i].value;
			luo_option.text  = active_box.options[i].text;
			dest_box.options[dest_box.options.length] = luo_option;
			active_box.options[i].value = "";
			active_box.options[i].text  = "";
		}
	}
	Remove_Empty_Rows(active_box);
	Remove_Empty_Rows(dest_box);
	//Sort_ListBox(dest_box);
	dest_box.selectedIndex = -1;
	active_box.selectedIndex = -1;
}

/* This Function Sorts a List box */
function Sort_ListBox(box)
{	var temp      = new Object();
	var li_count  = box.options.length;
	for(var x=0; x < li_count; x++)
	{
		for(var y=(x+1); y<li_count; y++)
		{
			if(box.options[x].text > box.options[y].text)
			{
				temp.text = box.options[x].text;
				temp.value = box.options[x].value;
				box.options[x].text  = box.options[y].text;
				box.options[x].value = box.options[y].value;
				box.options[y].text  = temp.text;
				box.options[y].value = temp.value;
			}
		}
	}
}

/* This Function removes empty lines from the list box */
function Remove_Empty_Rows(box)
{   var li_count = box.options.length ;
	var li_offset= 0;
	var li_total = 0;
	for(var li_next  = 0; (li_next + li_offset) < (li_count); li_next++)
	{ while(box.options[li_next + li_offset].value == "")
		{   li_offset++;
			if ((li_next + li_offset) >= li_count) break;
		}
	  if ((li_next + li_offset) >= li_count) break;
	  box.options[li_total].value = box.options[li_next + li_offset].value;
	  box.options[li_total].text  = box.options[li_next + li_offset].text;
	  li_total++
	}
	box.options.length = (li_count - li_offset);
}

/* This Function determines what a user typed in a text box
   and then moves all the entries in a source list box the
   that match the patterns to the destination box. */
function f_MoverFastEntry(atxt_data, alb_FromBox, alb_ToBox, auo_next_focus)
{
	var ls_data = atxt_data.value;

	if (ls_data.length > 0)
	{
		var ls_match = /(\b\w+\b)+/;
		var lobj_results = ls_match.exec(ls_data);

		while (lobj_results != null)
		{	ls_data = ls_data.slice(lobj_results[0].length + 1);
			var lreg_pattern = new RegExp(("^" + lobj_results[0]) ,"i");
			for(var i=0; i<alb_FromBox.options.length; i++)
			{if(lreg_pattern.test(alb_FromBox.options[i].text))
				{alb_FromBox.options[i].selected = true;}
			}
			lobj_results = ls_match.exec(ls_data);
		}
	Activate_MoverBox(alb_FromBox,alb_ToBox);
	atxt_data.value = "";
	}
	if (auo_next_focus.toString() == "[object]") auo_next_focus.focus();
}

function f_SelectAll(alb_Selected)
{   for(var i=0; i<alb_Selected.options.length; i++)
	{ alb_Selected.options[i].selected = true;
	}
}

function f_DeSelectAll(alb_Selected)
{   for(var i=0; i<alb_Selected.options.length; i++)
	{ alb_Selected.options[i].selected = false;
	}
}


// Title: Timestamp picker
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 1.0.a (Date selector only) reworked by Richard Perry
// Date: 12-12-2001 (mm-dd-yyyy)
// Version 1.0.b reworked by Eddie May. Added time display and made compliant with Netscape 6.2.
// Date 22/01/2002 (dd-mm-yyyy).
// Author: Denis Gritcyuk <denis@softcomplex.com>
// Notes: Permission given to use this script in any kind of applications if
//    header lines are left unchanged. Feel free to contact the author
//    for feature requests and/or donations

function show_calendar4x(str_target, str_datetime) {
var arr_months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
var n_weekstart = 0; // day week starts from (normally 0 or 1)

var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt4x(str_datetime));

var dt_prev_month = new Date(dt_datetime);
dt_prev_month.setMonth(dt_datetime.getMonth()-1);
if (dt_datetime.getMonth()%12 != (dt_prev_month.getMonth()+1)%12) {
dt_prev_month.setMonth(dt_datetime.getMonth());
dt_prev_month.setDate(0);
}
var dt_next_month = new Date(dt_datetime);
dt_next_month.setMonth(dt_datetime.getMonth()+1);
if ((dt_datetime.getMonth() + 1)%12 != dt_next_month.getMonth()%12)
dt_next_month.setDate(0);


var dt_prev_year = new Date(dt_datetime);
dt_prev_year.setYear(dt_datetime.getFullYear()-1);

var dt_next_year = new Date(dt_datetime);
dt_next_year.setYear(dt_datetime.getFullYear()+1);

var dt_firstday = new Date(dt_datetime);
dt_firstday.setDate(1);
dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
var dt_lastday = new Date(dt_next_month);
dt_lastday.setDate(0);

// html generation (feel free to tune it for your particular application)
// print calendar header
var str_buffer = new String (
"<html>\n"+
"<head>\n"+
"        <title>Calendar</title>\n"+
"</head>\n"+
"<body bgcolor=\"White\">\n"+
"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
"<tr><td bgcolor=\"#4682B4\">\n"+
"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
"<tr>\n"+
"        <td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar4x('"+
str_target+"', '"+dt2dtstr4x(dt_prev_year)+"'+document.cal.time.value);\">"+
"<img src=\"/images/calendar/prev_year.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"previous year\"></a></td>\n"+
"        <td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar4x('"+
str_target+"', '"+ dt2dtstr4x(dt_prev_month)+"'+document.cal.time.value);\">"+
"<img src=\"/images/calendar/prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"previous month\"></a></td>\n"+

"        <td bgcolor=\"#4682B4\" colspan=\"3\">"+
"<font color=\"white\" face=\"tahoma, verdana\" size=\"1\">"
+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+

"        <td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar4x('"
+str_target+"', '"+dt2dtstr4x(dt_next_month)+"'+document.cal.time.value);\">"+
"<img src=\"/images/calendar/next.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"next month\"></a></td>\n"+
"        <td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar4x('"
+str_target+"', '"+dt2dtstr4x(dt_next_year)+"'+document.cal.time.value);\">"+
"<img src=\"/images/calendar/next_year.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"next year\"></a></td>\n"+
"</tr>\n");
var dt_current_day = new Date(dt_firstday);
// print weekdays titles
str_buffer += "<tr>\n";
for (var n=0; n<7; n++)
str_buffer += "        <td bgcolor=\"#87CEFA\">"+
"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+
week_days[(n_weekstart+n)%7]+"</font></td>\n";

// print calendar table
str_buffer += "</tr>\n";
while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
dt_current_day.getMonth() == dt_firstday.getMonth()) {
// print row heder
str_buffer += "<tr>\n";
for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
if (dt_current_day.getDate() == dt_datetime.getDate() &&
dt_current_day.getMonth() == dt_datetime.getMonth())
// print current date
str_buffer += "        <td bgcolor=\"#FFB6C1\" align=\"right\">";
else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
// weekend days
str_buffer += "        <td bgcolor=\"#DBEAF5\" align=\"right\">";
else
// print working days of current month
str_buffer += "        <td bgcolor=\"white\" align=\"right\">";

if (dt_current_day.getMonth() == dt_datetime.getMonth())
// print days of current month
str_buffer += "<a href=\"javascript:window.opener."+str_target+
".value='"+dt2dtstr4x(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
else
// print days of other months
str_buffer += "<a href=\"javascript:window.opener."+str_target+
".value='"+dt2dtstr4x(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
dt_current_day.setDate(dt_current_day.getDate()+1);
}
// print row footer
str_buffer += "</tr>\n";
}
// print calendar footer
str_buffer +=
"<form name=\"cal\">\n<input type=\"hidden\" name=\"time\" value=\"\" size=\"8\" maxlength=\"8\">\n</form>\n" +
"</table>\n" +
"</tr>\n</td>\n</table>\n" +
"</body>\n" +
"</html>\n";


var vWinCal = window.open("", "Calendar",
"width=200,height=250,status=no,resizable=yes,top=200,left=200");
vWinCal.opener = self;
vWinCal.focus();
var calc_doc = vWinCal.document;
calc_doc.write (str_buffer);
calc_doc.close();

}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt4x(str_datetime) {
var re_date = /^(\d+)-(\d+)-(\d+)$/;
if (!re_date.exec(str_datetime))
return alert("Invalid Datetime format: "+ str_datetime);
return (new Date (RegExp.$1, RegExp.$2-1, RegExp.$3, 0, 0, 0));
}

function dt2dtstr4x(dt_datetime) {
return (new String (
<!--dt_datetime.getDate()+"/"+(dt_datetime.getMonth()+1)+"/"+dt_datetime.getFullYear()));-->
dt_datetime.getFullYear()+"-"+lessThanTen(dt_datetime.getMonth()+1)+"-"+lessThanTen(dt_datetime.getDate())));
}
function dt2tmstr4x(dt_datetime) {
return (new String (
" "+ lessThanTen(dt_datetime.getHours())+":"+lessThanTen(dt_datetime.getMinutes())+":"+lessThanTen(dt_datetime.getSeconds())));
}

function lessThanTen(someNumber) {
	if (someNumber < 10)
		return (new String ("0" + someNumber));
	 return someNumber;
}

