function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

StopShow();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

HideAllLayers();
}

function MM_swapLayerImage() { //v3.0
  var i,j=0,x,a=MM_swapLayerImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

function MM_showHideLayers() { //v6.0 
if (document.layers) {}
else if (navigator.product == 'Gecko' && !window.find) {}
else {
var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
}

var showtimer
var hidetimer

function ShowLayer(thename) {
showtimer = setTimeout("MM_showHideLayers('" + thename + "flyout','','show')",100);
}

function HideLayer(thename) {
hidetimer = setTimeout("MM_showHideLayers('" + thename + "flyout','','hide')",100);
}

var onhidetimer

function HideOnLayer(thename) {
clearTimeout(onhidetimer);
onhidetimer = setTimeout("MM_showHideLayers('" + thename + "flyout','','hide')",150);
}

var onshowtimer

function ShowOnLayer(thename) {
clearTimeout(onshowtimer);
onshowtimer = setTimeout("MM_showHideLayers('" + thename + "flyout','','show')",150);
}

function StopShow() {
clearTimeout(showtimer);
clearTimeout(onshowtimer);
}

function StopHide() {
clearTimeout(showtimer);
clearTimeout(hidetimer);
clearTimeout(onhidetimer);
}

function HideAllLayers() {
//Residential
HideLayer('resmyaccount');
HideLayer('reselec');
HideLayer('respricing');
HideLayer('resyourbill');
HideLayer('resmeter');
HideLayer('resnews');
HideLayer('ressafety');
HideLayer('rescontact');
//Business
HideLayer('busmyaccount');
HideLayer('buselectricity');
HideLayer('buspricing');
HideLayer('busbill');
HideLayer('busmeter');
HideLayer('bussafety');
HideLayer('buscontact');
//Farming
HideLayer('farmmyaccount');
HideLayer('farmdirect');
HideLayer('farmrd1');
HideLayer('farmwrightson');
HideLayer('farmbilling');
HideLayer('farmmeter');
HideLayer('farmnews');
HideLayer('farmsafety');
HideLayer('farmcontact');
//Large Business
HideLayer('largebusmyaccount');
HideLayer('largebusjoin');
HideLayer('largebusenergy');
HideLayer('largebusaccountmanagement');
HideLayer('largebusproducts');
HideLayer('largebusbilling');
HideLayer('largebusunder');
HideLayer('largebusnews');
HideLayer('largebuscontact');
//Active
HideLayer('myaccountHistory');
HideLayer('myaccountManage');
HideLayer('myaccountOnline');
HideLayer('myaccountSSC');
HideLayer('myaccountMeterreading');
HideLayer('myaccountTsandcs');
}

function goback() {
  top.history.back();
}

// Random Banner Pictures

var currentdate = 0;
var core1 = 0;
var core2 = 0;
var core3 = 0;

function initArray() {

this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}

image1 = new initArray(
"rb-topimage_home.jpg",
"rb-topimage_home02.jpg"
);

image2 = new initArray(
"onlinebill_home_tile.gif",
"mercury_one_bill_home.gif",
"mercury_one_bill_tile_castle_home.gif",
"mercury_one_bill_wild_west_home.gif"
);

link2 = new initArray(
"onlinebill.aspx",
"onebill.aspx",
"onebill.aspx",
"onebill.aspx"
);

image3 = new initArray(
"mercury_no_matter_size_small1.gif",
"mercury_no_matter_size_small2.gif",
"mercury_no_matter_size_small3.gif"
);

var currentdate = new Date();
var core1 = currentdate.getSeconds() % image1.length;
var core2 = currentdate.getSeconds() % image2.length;
var core3 = currentdate.getSeconds() % image3.length;
var ranimage1 = image1[core1];
var ranimage2 = image2[core2];
var ranlink2 = link2[core2];
var ranimage3 = image3[core3];

MM_preloadImages('../images/rb-topimage_home.jpg','../images/rb-topimage_home02.jpg','../images/rb-topimage_home03.jpg','../Images/rb-topbar_residential_on.gif','../Images/rb-topbar_business_on.gif','/Images/rb-subbar_home_on.gif','../Images/rb-subbar_community_on.gif','../Images/rb-subbar_kids_on.gif','../Images/rb-subbar_environment_on.gif','../Images/rb-subbar_contact_on.gif','../Images/rb-subbar_help_on.gif','../images/rb-topbar_residential_on.gif','../images/rb-topbar_business_on.gif','../images/rb-topbar_farming_on.gif','../images/rb-topbar_largebusiness_on.gif','../images/rb-subbar_about_on.gif','../images/rb-subbar_home_on.gif','../images/rb-subbar_news_on.gif','../images/rb-subbar_community_on.gif','../images/rb-subbar_kids_on.gif','../images/rb-subbar_environment_on.gif','../images/rb-subbar_contact_on.gif','../images/rb-subbar_help_on.gif','../images/rb-footer_terms_on.gif','../images/rb-footer_privacy_on.gif','../images/rb-footer_sitemap_on.gif','../images/rb-footer_maori_on.gif','../images/rb-footer_samoan_on.gif','../images/rb-footer_tongan_on.gif','../images/rb-footer_chinsimp_on.gif','../images/rb-footer_chintrad_on.gif','../images/rb-footer_korean_on.gif');

// Commond code for Bill Explanation Pop-Ups

// Title: Tigra Hints
// URL: http://www.softcomplex.com/products/tigra_hints/
// Version: 1.3
// Date: 09/03/2003 (mm/dd/yyyy)
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.

var THintsS = [];
function THints (o_cfg, items) {
	this.n_id = THintsS.length;
	THintsS[this.n_id] = this;
	this.top = o_cfg.top ? o_cfg.top : 0;
	this.left = o_cfg.left ? o_cfg.left : 0;
	this.n_dl_show = o_cfg.show_delay;
	this.n_dl_hide = o_cfg.hide_delay;
	this.b_wise = o_cfg.wise;
	this.b_follow = o_cfg.follow;
	this.x = 0;
	this.y = 0;
	this.divs = [];
	this.iframes = [];
	this.show  = TTipShow;
	this.showD = TTipShowD;
	this.hide = TTipHide;
	this.move = TTipMove;
	// register the object in global collection
	this.n_id = THintsS.length;
	THintsS[this.n_id] = this;
	// filter Netscape 4.x out
	if (document.layers) return;
	var b_IE = navigator.userAgent.indexOf('MSIE') > -1,
	s_tag = ['<iframe frameborder="0" scrolling="No" id="TTifip%name%" style="visibility:hidden;position:absolute;top:0px;left:0px;',   b_IE ? 'width:1px;height:1px;' : '', o_cfg['z-index'] != null ? 'z-index:' + o_cfg['z-index'] : '', '" width=1 height=1></iframe><div id="TTip%name%" style="visibility:hidden;position:absolute;top:0px;left:0px;',   b_IE ? 'width:1px;height:1px;' : '', o_cfg['z-index'] != null ? 'z-index:' + o_cfg['z-index'] : '', '"><table cellpadding="0" cellspacing="0" border="0"><tr><td class="', o_cfg.css, '" nowrap>%text%</td></tr></table></div>'].join('');


	this.getElem = 
		function (id) { return document.all ? document.all[id] : document.getElementById(id); };
	this.showElem = 
		function (id, hide) { 
		this.divs[id].o_css.visibility = hide ? 'hidden' : 'visible'; 
		this.iframes[id].o_css.visibility = hide ? 'hidden' : 'visible'; 
		};
	this.getWinSz = window.innerHeight != null 
		? function (b_hight) { return b_hight ? innerHeight : innerWidth; }
		: function (b_hight) { return document.body[b_hight ? 'clientHeight' : 'clientWidth']; };	
	this.getWinSc = window.innerHeight != null 
		? function (b_hight) { return b_hight ? pageYOffset : pageXOffset; }
		: function (b_hight) { return document.body[b_hight ? 'scrollTop' : 'scrollLeft']; };	
	if (window.opera) {
		this.getSize = function (id, b_hight) { 
			return this.divs[id].o_css[b_hight ? 'pixelHeight' : 'pixelWidth']
		};
		document.onmousemove = function () {
			for (var n_i in THintsS) {
				THintsS[n_i].x = event.clientX;
				THintsS[n_i].y = event.clientY;
				if (THintsS[n_i].b_follow && THintsS[n_i].visible) 
					THintsS[n_i].move(THintsS[n_i].visible);
			}
			return true;
		};
	}
	else {
		this.getSize = function (id, b_hight) { 
			return this.divs[id].o_obj[b_hight ? 'offsetHeight' : 'offsetWidth'] 
		};
		document.onmousemove = b_IE
		? function () {
			for (var n_i in THintsS) {
				THintsS[n_i].x = event.clientX + document.body.scrollLeft;
				THintsS[n_i].y = event.clientY + document.body.scrollTop;
				if (THintsS[n_i].b_follow && THintsS[n_i].visible) 
					THintsS[n_i].move(THintsS[n_i].visible);
			}
			return true;
		} 
		: function (e) {
			for (var n_i in THintsS) {
				THintsS[n_i].x = e.pageX;
				THintsS[n_i].y = e.pageY;
				if (THintsS[n_i].b_follow && THintsS[n_i].visible) 
					THintsS[n_i].move(THintsS[n_i].visible)
			}
			return true;
		};
	}
	for (i in items) {
		document.write (s_tag.replace(/%text%/g, items[i]).replace(/%name%/g, i));
		this.divs[i] = { 'o_obj' : this.getElem('TTip' + i) };
		this.divs[i].o_css = this.divs[i].o_obj.style;
		this.iframes[i] = { 'o_obj' : this.getElem('TTifip' + i) };
		this.iframes[i].o_css = this.iframes[i].o_obj.style;
		
	}
}
function TTipShow (id) {
	if (document.layers) return;
	this.hide();
	if (this.divs[id]) {
		if (this.n_dl_show) this.divs[id].timer = setTimeout('THintsS[' + this.n_id + '].showD("' + id + '")', this.n_dl_show);
		else this.showD(id);
		this.visible = id;
	}
}

function TTipShowD (id) {
	this.move(id);
	this.showElem(id);
	if (this.n_dl_hide) this.timer = setTimeout("THintsS[" + this.n_id + "].hide()", this.n_dl_hide);
}

function TTipMove (id) {
	var n_x = this.x + this.left, n_y = this.y + this.top;
	if (this.b_wise) {
		var n_w = this.getSize(id), n_h = this.getSize(id, true),
		n_win_w = this.getWinSz(), n_win_h = this.getWinSz(true),
		n_win_l = this.getWinSc(), n_win_t = this.getWinSc(true);
		if (n_x + n_w > n_win_w + n_win_l) n_x = n_win_w + n_win_l - n_w;
		if (n_x < n_win_l) n_x = n_win_l;
		if (n_y + n_h > n_win_h + n_win_t) n_y = n_win_h + n_win_t - n_h;
		if (n_y < n_win_t) n_y = n_win_t;
	}
	this.divs[id].o_css.left = n_x;
	this.divs[id].o_css.top = n_y;
	this.iframes[id].o_css.left = n_x;
	this.iframes[id].o_css.top = n_y;
	this.iframes[id].o_css.height = n_h-this.top;
	this.iframes[id].o_css.width = this.getSize(id, false)-this.left;
}

function TTipHide () {
	if (this.timer) clearTimeout(this.timer);
	if (this.visible != null) {
		if (this.divs[this.visible].timer) clearTimeout(this.divs[this.visible].timer);
		setTimeout('THintsS[' + this.n_id + '].showElem("' + this.visible + '", true)', 10);
		this.visible = null;
	}
}

function wrap (s_) {
	return "<table width='200' cellspacing='0' cellpadding='5' border='0' style='border: 1px solid #036; background:#fff;'><tr><td>"+s_+"</td></tr></table>"
}

var HINTS_CFG = {
	'top'        : 20, // a vertical offset of a hint from mouse pointer
	'left'       : 0, // a horizontal offset of a hint from mouse pointer
	'css'        : 'hintsClass', // a style class name for all hints, TD object
	'show_delay' : 200, // a delay between object mouseover and hint appearing
	'hide_delay' : 10000, // a delay between hint appearing and hint hiding
	'wise'       : true,
	'follow'     : false,
	'z-index'    : 0 // a z-index for all hint layers
}
// TO DO: Remove all references in code ref to this function
// NETRATING 
function _rsLinkTrack(_rsClickUrl) {
	return;
}

