
function openDetails(obj, item, type, w, h, winX, winY)  {
//    winStyle = 'height='+h+',width='+w+',screenX='+winX+',screenY='+winY+',left='+winX+',top='+winY+',dependent=yes,status=yes,location=yes';
    winStyle = 'height='+h+',width='+w+',screenX='+winX+',screenY='+winY+',left='+winX+',top='+winY+',dependent=yes,resizable=yes';


//    if (!d_win)
      d_win = window.open("", 'detailWin', winStyle);

    d_win.window.focus();

    var step_old = obj.step.value;
    obj.step.value = "details:"+ item + ":" + type;
    obj.target = "detailWin";
    obj.submit();
    obj.step.value = step_old;
    obj.target = "_self";
  }
  function closerDetails()  {
    if (d_win)
      d_win.close();
  };

  function openWorksheet(url, w, h, winX, winY)  {
//    winStyle = 'height='+h+',width='+w+',screenX='+winX+',screenY='+winY+',left='+winX+',top='+winY+',dependent=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,menubar=yes';
    winStyle = 'height='+h+',width='+w+',screenX='+winX+',screenY='+winY+',left='+winX+',top='+winY+',dependent=yes,resizable=yes';

//    if (!ws_win)
      ws_win = window.open(url, 'worksheetWin', winStyle);
    ws_win.window.focus();
  }

  function closerWorksheet()  {
    if (ws_win)
      ws_win.close();
  };

function showweek () {
	if (week==0)
	{
		week="Sunday";
	}
	if (week==1)
	{
		week="Monday";
	}
	if (week==2)
	{
		week="Tuesday";
	}
	if (week==3)
	{
		week="Wednesday";
	}
	if (week==4)
	{
		week="Thursday";
	}
	if (week==5)
	{
		week="Friday";
	}
	if (week==6)
	{
		week="Saturday";
	}
}
function showmonth() {
	if (month==0)
	{
		month="January";
	}
	if (month==1)
	{
		month="February";
	}
	if (month==2)
	{
		month="March";
	}
	if (month==3)
	{
		month="April";
	}
	if (month==4)
	{
		month="May";
	}
	if (month==5)
	{
		month="June";
	}
	if (month==6)
	{
		month="July";
	}
	if (month==7)
	{
		month="August";
	}
	if (month==8)
	{
		month="September";
	}
	if (month==9)
	{
		month="October";
	}
	if (month==10)
	{
		month="November";
	}
if (month==11)
{
month="December";
}
}
function showtime() {
if (minutes <10)
{
min="0"+minutes;
}
else {
min=minutes;
}
if (seconds <10)
{
sec="0"+seconds;
}
else {
sec=seconds;
}
if (hours > 12)
{
hours=hours - 12;
ampm="PM";
}
else 
{ 
ampm="AM"; 
}
if (hours == 12)
{
hours=12;
ampm="PM";
}
if (hours == 0)
{
hours=12;
ampm="AM";
}
}
function showyear() {
year=new Date().getFullYear().toString();
time_id = document.getElementById("disyear");
time_child = time_id.firstChild;
    if (time_child)
      time_id.removeChild(time_child);
year= year + " ";
time_value = document.createTextNode(year);
time_id.appendChild(time_value);
}
function inittime() {
week=new Date().getDay().toString();
today=new Date().getDate().toString();
year=new Date().getFullYear().toString();
month=new Date().getMonth().toString();
hours=new Date().getHours().toString();
minutes=new Date().getMinutes().toString();
seconds=new Date().getSeconds().toString();
ampm="PM";
showweek();
showmonth();
showtime();
curtime =month+ ", "+ today+ ", " + hours + ":"+ min + ":"+ sec +" "+ ampm;
//Total
time_id = document.getElementById("time");
time_child = time_id.firstChild;
    if (time_child)
      time_id.removeChild(time_child);
time_value = document.createTextNode(curtime);
time_id.appendChild(time_value);
timerID=setTimeout("inittime();",1000);
}
