//spa.js
var children=Array(); 
var hasChildren = 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("Hapuskan rekod '" + anItem + "'. Adakah anda pasti?");
}

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;
}
