//spa.js
var children=Array(); 
var hasChildren = false;
var noFocusToChildForRedload = false;

function popwin(newUrl,winName,wWidth,wHeight) {

  if (popwin.arguments.length == 1) {
    winName = "win1";
    wHeight = 400;
    wWidth = 720;
  }
  else if (popwin.arguments.length == 2) {
    wHeight = 400;
    wWidth = 720;
  }
  var wTop  = (screen.availHeight / 2) - (wHeight /2);
  var wLeft = (screen.availWidth / 2) - (wWidth /2);

  var newWindow = window.open(newUrl,winName,"status,scrollbars,resizable,top=" 
                          + wTop + ",left=" + wLeft + ",width=" + wWidth + ",height=" + wHeight);
  newWindow.focus();
  if (parent.children != "undefined")
      parent.hasChildren = true;
  if (parent.children != "undefined")
    parent.children[parent.children.length]= newWindow;
}




function closeAllchildren() 
{ 
  if (parent.children != "undefined")
    for(var n=0;n<parent.children.length;n++) 
    {
      parent.children[n].close(); 
    }   
//window.close(); 
} 


function isDelete(anItem) {
	return confirm("Delete record '" + anItem + "'. Do you want to continue?");
}

function encodeURI(html) {
        encodedHtml = escape(html);
        encodedHtml = encodedHtml.replace(/\//g,"%2F");
        encodedHtml = encodedHtml.replace(/\?/g,"%3F");
        encodedHtml = encodedHtml.replace(/=/g,"%3D");
        encodedHtml = encodedHtml.replace(/&/g,"%26");
        encodedHtml = encodedHtml.replace(/@/g,"%40");
        return encodedHtml;
}

function toUCase(field) {
    field.value = field.value.toUpperCase();
}

function toLCase(field) {
    field.value = field.value.toLowerCase();
}

function getTodayDate() {
  var today = new Date()
  var month = today.getMonth()+1
  var year = today.getYear()
  var day = today.getDate()
  if(day<10) day = "0" + day
  if(month<10) month= "0" + month 
  if(year<1000) year+=1900
  
  return day+"/"+month+"/"+year;
}

