﻿// JScript File
window.defaultStatus='Fun for smarter generation';
var oBt;

function displayStatusMsg(msgStr) {
  status=msgStr;
  document.MM_returnValue = true;
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function validateDateMinute(oSrc, args) {
  var iDay, iMonth, iYear, iHour, iMinute;
  var arrTgl, arrJam, arrValues;
  arrValues = args.Value.split(" ");
  if (arrValues.length==2) {
    arrTgl = arrValues[0].toString().split("/");
    arrJam = arrValues[1].toString().split(":");
    if (arrTgl.length==3 && arrJam.length==2) {
        iDay = arrTgl[0]; iMonth = arrTgl[1]; iYear = arrTgl[2];
        iHour = arrJam[0]; iMinute = arrJam[1];
        var testDate = new Date(iYear, iMonth - 1, iDay, iHour, iMinute, 0);
        if ((testDate.getDate()==iDay) && 
            (testDate.getMonth()==iMonth - 1) &&
            (testDate.getFullYear()==iYear) &&
            (testDate.getHours()==iHour) &&
            (testDate.getMinutes()==iMinute)) {
            return true;
        }
    }
  }
  args.IsValid = false;
  return;
}

function hideOnSubmit() {
    document.aspnetForm.style.display = "none";
    var newElement = document.createElement("div");
	newElement.innerText = 'Harap tunggu sebentar...';
	document.body.appendChild(newElement);
}

function delConfirm() {
  return (confirm('Anda yakin akan menghapusnya?'));
}

function disButtonOnSubmit() {
  if (oBt!=null) oBt.disabled = true;
}

function openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) {
  if(window.screen)if(isCenter)if(isCenter=='true'){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function FotoView(x,y,z) {
  openBrWindow('produkfoto.aspx?id='+x+'&pictype='+y+'&judul='+z, '_blank','status=yes','500','500','true');
}

