
function MakeArray(n) {
 this.length = n
 return this
}

monthNames = new MakeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"

dayNames = new MakeArray(7)
dayNames[1] = "Sunday"
dayNames[2] = "Monday"
dayNames[3] = "Tuesday"
dayNames[4] = "Wednesday"
dayNames[5] = "Thursday"
dayNames[6] = "Friday"
dayNames[7] = "Saturday"

daysMonth = new MakeArray(12)
daysMonth[1] = 31
daysMonth[2] = 28
daysMonth[3] = 31
daysMonth[4] = 30
daysMonth[5] = 31
daysMonth[6] = 30
daysMonth[7] = 31
daysMonth[8] = 31
daysMonth[9] = 30
daysMonth[10] = 31
daysMonth[11] = 30
daysMonth[12] = 31

var now = new Date()


function makemail( a, s, q ) {
  /* Set the default values */
  xa = "support";
  xs = "energex.com";
  xq = "Energex Urgent Message";
  /* if the user didn't give me data, use the defaults */
  if (a.length == 0) a = xa;
  if (s.length == 0) s = xs;
  if (q.length == 0) q = xq;
  /* construct the address and kick it off */
  x = "mailto:" + a + "@" + s + "?subject=" + q;
  document.location.href = x;
}


function trimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}


function checkMail(addr)
{
    // Tests email address for valid syntax, returns TRUE if not valid //
    var filter  =
/^([a-zA-Z0-9_\.\-])+([a-zA-Z0-9])\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(addr)) return false;
        else return true;
}


function getRadioButtonValue (radio)
{  var result = ""; 
   for (var i = 0; i < radio.length; i++) {   
          if (radio[i].checked) {
                        result =  radio[i].value;
                        break 
          }
    }
    return result
}


function clearDefault(el) {

	if (el.defaultValue==el.value) el.value = ""
		
}


function nextPage() {
	var nextpg
	thispage=ipage
	
	nextpg = thispage + 1
	if ( nextpg >= 6 ) { nextpg = 0 }
	
	toggleBox(cLayer[thispage],0)
	toggleBox(cLayer[nextpg],1)

	ipage = nextpg
	return true	

}


function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}



//////////////////////////////////////////////////////////////////
// The preloadImages() function preloads all the "flipped" images
// so that when a user mouses over a navigation button,
// the rollover takes place immediately.  (If you do not
// preload images, the first time a user mouses over each
// navigation button the "mouseover" image must TRavel
// from the Web server, causing an unatTRactive delay.
///////////////////////////////////////////////////////////////////

function preloadImages() {

    // If there are images embedded in the document...

    if (document.images) {

       // Set the imgFiles variable equal to an array of all the
       // image files passed as arguments to the preloadImages() function.

       var imgFiles = preloadImages.arguments;

       // Create a new array called preloadArray

       var preloadArray = new Array();

       // For each image file sent as an argument to preloadImages()
       // (all of them)...

       for (var i=0; i < imgFiles.length; i++) {

            // Create a new Image object in the preloadArray array 
            // and associate it with a source file, thus loading
            // that image into memory.

            preloadArray[i] = new Image;
            preloadArray[i].src = imgFiles[i];
       }
    }
}


function swap(id, newsrc) {
// This function is called to swap out an image being displayed 

  var theImage = locateImage(id);
  if (theImage) { // if an image was found
      theImage.src = newsrc;   //swap it out
      }

}


function locateImage(name) {
// Start with a blank variable called theImage
   var theImage = false;
   
// If there are images defined for this document . . .

   if (document.images) {
// Assign the image we're looking for to theImage
      theImage = document.images[name];
      }

// If theImage exists, return it to the calling function
   if (theImage) {
       return theImage;
       }
// Otherwise, return false(0) to the calling function
   return (false);
}


function customDateString(oneDate) {
 var theDay = dayNames[oneDate.getDay() + 1]
 var theMonth = monthNames[oneDate.getMonth() + 1]
 var theYear = oneDate.getYear()
 theYear += (theYear < 100) ? 1900 : 0

// It seems that Netscape is returning Year since 1900 even after 2000

 if (theYear < 1900) {
    theYear += 1900
    }
// return theDay + ", " + theMonth + " " + oneDate.getDate() + ", " + theYear
 return theMonth + " " + oneDate.getDate() + ", " + theYear
}


function dropdown(mySel)
{
var myWin, myVal;
myVal = mySel.options[mySel.selectedIndex].value;
if(myVal)
   {
   if(mySel.form.target)myWin = parent[mySel.form.target];
   else myWin = window;
   if (! myWin) return true;
   myWin.location = myVal;
   }
return false;
}