function onInit(secs)
{
	var date = new Date(Number(secs));
    document.form.secondsName.value = date.toLocaleString();    
}

function onOk()
{
   var stringCheck = document.form.readOnly.value;
   if (readOnly=="true")
   {
   		window.close();
   		return;
   }
   
	if (verifyTSInfo())
	{
	   	var seconds = document.form.secondsName_ms.value;

   		var replicaNum = document.form.replicaNum.value;
   		var eventID = document.form.eventID.value;
   		var list = [seconds, replicaNum, eventID];
   		var timestamp = pack(list);

   		eval("opener." + returnMethodName + "(\"" + timestamp + "\")");
   		window.close();
	}
	else
		alert(missingFieldsError);	
}

function returnFromTSCalendar(date, name)
{
	document.form.secondsName.value = date.toLocaleString();
   	document.form.secondsName_ms.value = date.valueOf();
}

function onLoadTSCalendar(name)
{
   var value = document.form.secondsName_ms.value;

   if(value != null && value.length>0)
   {
      return new Date(Number(value));
   }   
}

// Check to see if the all the attributes have been assigned value
function verifyTSInfo()
{
	var seconds = document.form.secondsName_ms.value;
   	var replicaNum = document.form.replicaNum.value;
	var eventID = document.form.eventID.value;
	
	// Now need to make sure the required fields have values in them.
	if (seconds == null || seconds == "" ||
	  	replicaNum == null || replicaNum == "" ||
		eventID == null || eventID == "")
	{		
		return false;
	}

	return true;
}	