function whtl(width, height)
{
   var left = (screen.availWidth - width) / 2;
   var top = (screen.availHeight - height) / 2;

   var result = "";

   result += "width=" + width + ",";
   result += "height=" + height + ",";
   result += "top=" + top + ",";
   result += "left=" + left + ",";

   return result;
}

function setEditing(on)
{
   var page = "/admin/content/setEditMode.jsp";
   var query = "?enable=" + on;

   window.open(
      page + query,
      "setEditMode",
      whtl(400, 100) +
      "toolbar=no,location=no,status=no," +
      "menubar=no,scrollbars=no,resizable=no");
}

function updatePage()
{
   location.reload();
}

function onPageLoad()
{
   modifyDocLinks();
}

function modifyDocLinks()
{
   var links = document.getElementsByTagName("A");
   var re = /.*\.pdf/i;

   for (var i = 0; i < links.length; ++i)
   {
      var node = links.item(i);
      var href = node.href;

      if (href.match(re))
      {
         node.onclick = adjustDocLink;
      }
   }
}

function adjustDocLink()
{
   var href = this.href;

   this.setAttribute("href", "/doc_tracker.jsp?doc=" + escape(this.href));
}

function toTruePay()
{
   var msg =
      "Please note: To pay online, you will be leaving the BPU.com" +
      " Web site and entering the certified secure TruePay Web site." +
      " You will need your BPU account number and initially the five" +
      " digit zip code of your service address. For new users, your" +
      " zip code will serve as your PIN.";

   alert(msg);

   location.href = "https://www.truepay.net/kcbpu";
}

function journey_water1()
{
	var desktop = window.open("/just_for_kids/journey.html", "_blank", "width=605, height=403, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no");
}

function electricalTables()
{
	var desktop = window.open("/documents/OutageInformation.pdf", "_blank");
}

function JumpToIt(list)
{
	var newPage = list.options[list.selectedIndex].value;
	if (newPage != "None")
	{
		location.href=newPage;
	}
}
