// JavaScript Document

//-- Jendela Browser Pop-Up --//
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{	if(popUpWin)  { if(!popUpWin.closed) popUpWin.close(); }
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//-- Jendela Pesan --//
function messageWindow(title, msg)
{
  var width="300", height="125";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>'+title+'</title></head>';
  var body = '<center>'+msg+'<br><p><form><input type="button" value="   Done   " onClick="self.close()"></form>';
  msgWindow.document.write(head + body);
}

//-- Kotak Pesan --//
// Example:
// value1 = 3; value2 = 4;
// messageBox("text message %s and %s", value1, value2);
// this message box will display the text "text message 3 and 4"
function messageBox()
{
  var i, msg = "", argNum = 0, startPos;
  var args = messageBox.arguments;
  var numArgs = args.length;

  if(numArgs)
  {
    theStr = args[argNum++];
    startPos = 0;  endPos = theStr.indexOf("%s",startPos);
    if(endPos == -1) endPos = theStr.length;
    while(startPos < theStr.length)
    {
      msg += theStr.substring(startPos,endPos);
      if (argNum < numArgs) msg += args[argNum++];
      startPos = endPos+2;  endPos = theStr.indexOf("%s",startPos);
      if (endPos == -1) endPos = theStr.length;
    }
    if (!msg) msg = args[0];
  }
  alert(msg);
}

//-- Nama Bulan Indonesia --//
function bulan(nilai)
{
	if (nilai == 1) bulan = 'Januari';
	if (nilai == 2) bulan = 'Februari';
	if (nilai == 3) bulan = 'Maret';
	if (nilai == 4) bulan = 'April';
	if (nilai == 5) bulan = 'Mei';
	if (nilai == 6) bulan = 'Juni';
	if (nilai == 7) bulan = 'Juli';
	if (nilai == 8) bulan = 'Agustus';
	if (nilai == 9) bulan = 'September';
	if (nilai == 10) bulan = 'Oktober';
	if (nilai == 11) bulan = 'Nopember';
	if (nilai == 12) bulan = 'Desember';
	if (nilai < 1) ||  (nilai > 12) bulan = 'Tidak diketahui';
}
