//Functions shared by PNG & Nashville HTML pages
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
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; i0&&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&&i0&&parent.frames.length){t=n.split("?");
x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
}else{x=document.getElementById(n)}return x;
}
function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
v=(v=='show')?'visible':(v='hide')?'hidden':v;
if(obj)obj.style.visibility=v;}} else{
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; }}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0 Modified to use timeout for IE4 error when immediately focusing
myWindow = window.open(theURL,winName,features);
//setTimeout("myWindow.focus()",250); //prevents error in IE4 focusing before window is created
}
//used for image swap on reload on homePage
function getHomePageImage() {
var picNum = (Math.floor(Math.random()*3));
var picName = pics[picNum];
document.homeImage.src = picName;
}
//used on home page for NN4 resize bug w/ flash, draws flash or gif
function getFlash() {
var theVersion = parseInt(navigator.appVersion);
if ((navigator.appName == "Netscape") && (theVersion < 5 )) {
theSource = '
';
document.write(theSource);
}
else {
theSource = '';
document.write(theSource);
}
}
//check for empty field in search box
function checkSearch( form ) {
if (form.SearchField.value=="" || form.SearchField.value==" " ) {
alert("Please enter a value to search for.");
} else {
form.SearchField.value=form.SearchField.value.toLowerCase();
form.submit();
}
}
function FixCookieDate(date){
var base = new Date(0);
var skew = base.getTime(); //dawn of Unix time - should be 0
if (skew > 0)
{
date.setTime(date.getTime() - skew)
}
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
return getCookieVal (j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) {
break;
}
}
return null;
}
//set cookie values
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "" : "");
}
function DeleteCookie (name) {
path = "/";
document.cookie = name + "=" + ";path=" + path + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
var popupBPWin
function genericPopup(page)
{
var scwidth, scheight, popwidth, popheight, popleft, poptop;
var popFeatures, popURL, popupURLTA;
//Set the default window positions for default screen of 800 by 600
scwidth = 0;
scheight = 0;
popheight = 500;
popwidth=700;
popleft = 65;
poptop = 25;
popFeatures = ""
popURL = "https://bp.piedmontng.com/billpresentment/bp.asp";
popURLTA = "https://bp.piedmontng.com/tradeallies/ta.asp";
//popFeatures = 'width='+popwidth+',height='+popheight+',left='+popleft+',top='+poptop+'toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes';
if(!popupBPWin || popupBPWin.closed)
{
//Check screen resolution and reset popup window if not default 800 by 600
if((screen.width > 800) && (screen.height > 600))
{
popwidth = 640;
popheight = 650;
popleft = 168;
poptop = 25;
}
popFeatures = 'width='+popwidth+',height='+popheight+',left='+popleft+',top='+poptop+'toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes';
//Used to switch between Company pages
switch(page)
{
case(1): //Page 1 is Piedmont
break;
case(2): //Nashville Gas
popURL = popURL + "?sid=2";
break;
case(3): //NCNG Page
popURL = popURL+"?sid=3"
break;
case(4): //ECNG Page
popURL = popURL+"?sid=4";
break;
case(5): //PNG Page
popURL = popURLTA+"?sid=1";
break;
case(6): //Nashville Page
popURL = popURLTA+"?sid=2";
break;
case(7): //NCNG Page
popURL = popURLTA+"?sid=3";
break;
case(8): //ECNG Page
popURL = popURLTA+"?sid=4";
break;
default:
break;
}
popupBPWin=window.open(popURL,"",popFeatures);
}else{
popupBPWin.focus()
}
}
var popupPOLWin
function POLPopup(page)
{
if(!popupPOLWin || popupPOLWin.closed)
{popupPOLWin=window.open("https://www.piedmontng.com/apps/gms/default.asp","","width=600,height=450,left=168,top=25,toolbar=yes,status=yes,location=no,menubar=yes,scrollbars=yes,resizable=yes,");
}else{
popupPOLWin.focus()
}
}
var popupTradeAlliesWin
function genericTradeAlliesPopup(page)
{
if(!popupTradeAlliesWin || popupTradeAlliesWin.closed)
{popuptradeAlliesWin=window.open("https://bp.piedmontng.com/SalesForms/servicerequestform.asp","","width=600,height=650,left=168,top=25 toolbar=yes,status=yes,location=no,menubar=yes,scrollbars=yes,resizable=yes,");
}else{
popupTradeAlliesWin.focus()
}
}
var popupSafeHarborWin
function SafeHarborPopup(page)
{
if(!popupSafeHarborWin || popupSafeHarborWin.closed)
{popupSafeHarborWin=window.open("http://www.piedmontng.com/investorRelations/safeHarbor","","width=600,height=650,left=168,top=25,toolbar=yes,status=yes,location=no,menubar=yes,scrollbars=yes,resizable=yes,");
}else{
popupSafeHarborWin.focus()
}
}
var popupTAWin
function genericTAPopup(page)
{
var scwidth, scheight, popwidth, popheight, popleft, poptop;
var popFeatures, popURL;
//Set the default window positions for default screen of 800 by 600
scwidth = 0;
scheight = 0;
popheight = 500;
popwidth= 650;
popleft = 168;
poptop = 25;
popFeatures = ""
//Set the default URL for Piedmontng
popURL = "https://bp.piedmontng.com/TradeAllies/ta.asp";
//popFeatures = 'width='+popwidth+',height='+popheight+',left='+popleft+',top='+poptop+'toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes';
if(!popupTAWin || popupTAWin.closed)
{
//Check screen resolution and reset popup window if not default 800 by 600
if((screen.width > 800) && (screen.height > 600))
{
popwidth = 640;
popheight = 650;
popleft = 168;
poptop = 25;
}
popFeatures = 'width='+popwidth+',height='+popheight+',left='+popleft+',top='+poptop+'toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes';
//Used to switch between Company pages
switch(page)
{
case(1): //Page 1 is Piedmont
break;
case(2): //Nashville Gas
popURL = popURL + "?sid=2";
break;
case(3): //NCNG Page
popURL = popURL+"?sid=3"
break;
case(4): //ECNG Page
popURL = popURL+"?sid=4";
break;
default:
// No need to fix this. This the default.
break;
}
popupTAWin=window.open(popURL,"",popFeatures);
}else{
popupTAWin.focus()
}
}
function checkInput(thisform)
{
thisform.submit();
}
var CSPopUpWin
var closetime = 0;
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=200,top=50,toolbar=yes,status=yes,location=no,menubar=yes,scrollbars=yes,resizable=yes,width=" + WIDTH + ",height=" + HEIGHT;
CSPopUpWin = window.open(URL, "preview", windowprops);
CSPopUpWin.blur();
//if (closetime) setTimeout("CSPopUpWin.close();", closetime*1000);
}
function EmergencyPopUp()
{
window.open("http://www.piedmontng.com/eprise/main/piedmontng/emergency_popup","","width=525,height=250,left=168,top=100 toolbar=no,status=no,location=no,menubar=no,scrollbars=no,resizable=no,");
//width = 525; // width of window in pixels
//height = 400; // height of window in pixels
//width=0; //smallest window Netscape will allow
//height=0; //smallest window Netscape will allow
//delay = 0; // time in seconds before popup opens
}
var timerID;
function CustomerSurveyPopUp()
{
var expdate = new Date();
var curdate = expdate;
var ref
var sid
url = "http://www.piedmontng.com/customer_survey/survey.asp";
width = 525; // width of window in pixels
height = 400; // height of window in pixels
//width=0; //smallest window Netscape will allow
//height=0; //smallest window Netscape will allow
delay = 0; // time in seconds before popup opens
if(!GetCookie("survey1"))
{
sid = 1 //Set serverid to 1 for Piedmont
// alert("Cookie not found ");
//alert("Window location is " + window.location);
ref = String(window.location).toLowerCase();
//Try to determine if we are coming from nashville gas
if((ref.indexOf("nashvillegas.com") > -1) || (ref.indexOf("ngc") > -1))
sid = 2;
// alert("sid = " + sid);
FixCookieDate(expdate);
//Set cookie to expire in 6 months
expdate.setTime(expdate.getTime() + (180 * 24 * 60 * 60 * 1000)); // 6 months
SetCookie("survey1","Customer Survey",expdate,"/");
if((typeof(CSPopUpWin) != "object") || (CSPopUpWin.Closed))
{
//timerID = "Start(CSPopUpWin=window.open("http://www.piedmontng.com/customer_survey/survey.asp?sid="+sid,"","width=600,height=550,left=168,top=25 toolbar=yes,status=yes,location=no,menubar=yes,scrollbars=yes,resizable=yes,");
url += "?sid="+sid;
Start(url, width, height);
}else{
CSPopUpWin.focus();
}
}
}
function alternate(id){
if(document.getElementsByTagName){
//try catch to catch null tables
var table = document.getElementById(id);
if(table != null){
var rows = table.getElementsByTagName("TR");
for(i = 0; i < rows.length; i++){
//manipulate rows
if(i % 2 == 0){
rows[i].className = "even";
}else{
rows[i].className = "odd";
}
}
}
}
}
function alternateRows(){
el = document.getElementsByTagName("TABLE");
for (i = 0; i < el.length; i++)
{
if (el.className == "altRows") {
rows = el.getElementsByTagName("TR");
for (j = 0; j < rows.length; j++) {
//manipulate rows
if (j % 2 == 0) {
rows[j].className = "even";
} else {
rows[j].className = "odd";
}
}
}
}
}