/*--------------------------------------------------
  Javascript functions

  Aug 02, 06 - add func getElement()
  Jan 11, 08 - add func show_progressbar()
--------------------------------------------------*/

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images ) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

//--------------------------------------------------
// Find document object, compatible with firefox
//--------------------------------------------------
function getElement(aID) {

  return (document.getElementById) ? document.getElementById(aID): document.all[aID];
}


//--------------------------------------------------
// Pop-up message about our local calling area
//--------------------------------------------------
function help_expanded_local_calling() {

   var html = "Expanded Local BC Calling area now includes Vancouver Lower Mainland, Abbotsford, Victoria and Nanaimo!";

   var posX = (screen.availWidth - 400) / 2;
   var posY = (screen.availHeight - 100) / 2;

   var sFeatures = "left="+posX+",top="+posY+",width=400,height=120," +
                   "alwaysRaised=yes,dependent=yes," +
                   "directories=no,location=no,menubar=no,titlebar=no,toolbar=no,";

   var wh = window.open( "", "ExpandedMsg", sFeatures );

   if (wh) {
      html = "<html><head><title>Expanded Local Calling Area</title></head><body>\n" +
             "<table width=\"90%\" height=\"100%\" align=\"center\" border=0 cellspacing=1 cellpadding=2>\n" +
             "<tr><td>\n" +
             "<font face=\"verdana,arial\" size=2><b>" + html + "</b></font><br>\n" +
             "</td></tr>\n" +
             "<tr><td align=center><br><a href=\"javascript:self.close();\"><font face=\"verdana,arial\" size=2><b><u>Close Window</u></b></font></a><br>\n" +
             "</td></tr>\n" +
             "</table>\n" +
             "</body></html>\n";
      wh.document.write(html);
      wh.document.close();
      wh.focus();
   } else {
      alert( html );
   }
}


var wh_progressbar;

//--------------------------------------------------
// display progress bar in a pop-up window
//--------------------------------------------------
function show_progressbar( to_display ) {

   if ((to_display == true) || (to_display == "visible")) {

      var posX = (screen.availWidth - 400) / 2;
      var posY = (screen.availHeight - 100) / 2;

      var sFeatures = "left="+posX+",top="+posY+",width=400,height=100," +
                      "alwaysRaised=yes,dependent=yes," +
                      "directories=no,location=no,menubar=no,titlebar=no,toolbar=no,dependent=yes,alwaysRaised=yes,";

      wh_progressbar = window.open( "", "ProgressBar", sFeatures );
      if (wh_progressbar) {
 wh_progressbar.document.open("text/html", "replace");
 wh_progressbar.document.write( "<html><head><title>Loading ...</title></head><body>\n" );
 wh_progressbar.document.write( "<table align=center width=\"300\" border=0 cellspacing=0 cellpadding=2 bgcolor=\"#cc3300\">\n" );
 wh_progressbar.document.write( "<tr><td valign=top>\n" );
 wh_progressbar.document.write( "<table width=\"100%\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"#ffffff\">\n" );
 wh_progressbar.document.write( "<tr height=40><td align=center height=40><font style=\"font-family:verdana,arial;font-size:12px;\"><b>One moment please ...</b></font></td></tr>\n" );
 wh_progressbar.document.write( "<tr height=20><td align=center height=20><img src=\"/images/processing.gif\" border=0 width=\"280\" height=\"10\" alt=\"Please wait ...\"></td></tr>\n" );
 wh_progressbar.document.write( "</table>\n" );
 wh_progressbar.document.write( "</td></tr>\n" );
 wh_progressbar.document.write( "</table>\n" );
 wh_progressbar.document.write( "</body></html>\n" );
 wh_progressbar.document.close();

      }

   } else {
      if (wh_progressbar)
         wh_progressbar.close();
   }

   return wh_progressbar;
}

