// Support Script (409)
function PopulateWith(TheList, Items)
{
  var iCount = TheList.getCount();
  for (var i=0; i<iCount; i++)
    if (TheList.elementID)
      TheList.elementID.options[0] = null;
    else
      alert("bad or wrong DE for state population");

  i = 0;
  iCount = Items.length;
 	for (i=0; i<iCount; i++)
    TheList.addOption(Items[i], i, "");

  TheList.setSelectedByPosition(0);
}
// Support Script (664)
// These date functions work for Nav 3 and above.

function getDayName(d)
{   
   var theDay = d.getDay()

   if (theDay == 0) 
            return "Sunday"
   if (theDay == 1) 
            return "Monday"
   if (theDay == 2) 
            return "Tuesday"
   if (theDay == 3) 
            return "Wednesday"
   if (theDay == 4) 
            return "Thursday"
   if (theDay == 5) 
            return "Friday"
   if (theDay == 6) 
            return "Saturday"
}

function getFullYear(d)
{
   var y = d.getYear();

   if (y < 2000) 
   {
        y += 1900
   }

   return y
}

function getMonthName(d)
{
   var theMonth = d.getMonth()
   
   if (theMonth == 0) 
            return "January"
   if (theMonth == 1) 
            return "February"
   if (theMonth == 2) 
            return "March"
   if (theMonth == 3) 
            return "April"
   if (theMonth == 4) 
            return "May"
   if (theMonth == 5) 
            return "June"
   if (theMonth == 6) 
            return "July"
   if (theMonth == 7) 
            return "August"
   if (theMonth == 8) 
            return "September"
   if (theMonth == 9) 
            return "October"
   if (theMonth == 10) 
            return "November"
   if (theMonth == 11) 
            return "December"
}

// A helper function for the other functions in this
// support script

function DateSupportReplaceAwithBinC(aa,bb,cc)
{
 var a = aa + ""
 var b = bb + ""
 var c = cc + ""
	var i = c.indexOf(a);
	var l = b.length;
	while (i != -1)	
 {
		c = c.substring(0,i) + b + c.substring(i + a.length,c.length);
  i += l
		i = c.indexOf(a,i);
	}
	return c;
}


function ReplaceTokensWithTimeDate(strIn, leadingZeroes, zoneDiff)
{
    var strOut = strIn
    var now = new Date()
    var d = new Date(now.getTime() + zoneDiff)

    var theTime = ""
    var theHours
    var theMinutes
    var theSeconds
    var ampm = "am"

    theHours = d.getHours()
    if (theHours >= 12)
    {
        ampm = "pm"
    }
    if (theHours > 12)
    {
         theHours -= 12   
    }

    theMinutes = d.getMinutes()
    if (leadingZeroes, theMinutes < 10)
    {
        theMinutes = "0" + theMinutes
    }
    
    theTime = theHours + ":" + theMinutes + ampm

    theSeconds = d.getSeconds()
    if (leadingZeroes && theSeconds < 10)
    {
        theSeconds = "0" + theSeconds
    }

    strOut = DateSupportReplaceAwithBinC("[monthname]", getMonthName(d), strOut)
    strOut = DateSupportReplaceAwithBinC("[monthnumber]", d.getMonth(d) + 1, strOut)
    strOut = DateSupportReplaceAwithBinC("[dayname]", getDayName(d), strOut)
    strOut = DateSupportReplaceAwithBinC("[daynumber]", d.getDate(), strOut)
    strOut = DateSupportReplaceAwithBinC("[year]", getFullYear(d), strOut)
    strOut = DateSupportReplaceAwithBinC("[time]", theTime, strOut)
    strOut = DateSupportReplaceAwithBinC("[hours]", theHours, strOut)
    strOut = DateSupportReplaceAwithBinC("[minutes]", theMinutes, strOut)
    strOut = DateSupportReplaceAwithBinC("[seconds]", theSeconds, strOut)
    strOut = DateSupportReplaceAwithBinC("[ampm]", ampm, strOut)

    return strOut
}


// This function takes the name of an edit box and a 
// flag that says whether or not to pad single digit 
// minutes and seconds with a zero.  It provides a 
// real time clock in an edit box.
//
function SetTimeText(strElementName, blnLeadingZeroes, zoneDiff)
{
  var theObj = eval(strElementName)

  theObj.setText(ReplaceTokensWithTimeDate(theObj.ContentString,blnLeadingZeroes, zoneDiff))
  setTimeout("SetTimeText('" + strElementName + "'," + blnLeadingZeroes + "," + zoneDiff + ")",1000)
}

// Returns a JavaScript Date object
// Expected format of date is 8/17/1998
// Expected format of time is 12:02am or 1:09pm
// Gives an error message if format is wrong.
//
function MakeDate(strDate, strTime)
{

 var tempDate = new Date(strDate)
 var strFormatted = getMonthName(tempDate) + " " + tempDate.getDate() + ", " + getFullYear(tempDate)

	var colonPos = strTime.indexOf(":")
	var ampmPos = strTime.indexOf("am")
	if (ampmPos == -1)
		ampmPos = strTime.indexOf("AM")
    if (ampmPos == -1)
		ampmPos = strTime.indexOf("pm")
	if (ampmPos == -1)
		ampmPos = strTime.indexOf("PM")

	// assume format of time is okay
	var theHours = strTime.substring(0,colonPos)
	var theMinutes = strTime.substring(colonPos + 1, ampmPos)
	var ampm = strTime.substring(ampmPos, strTime.length)
	ampm = ampm.toUpperCase()

	if (ampm == "PM")
	{
		if (theHours != "12")
		{
			theHours += 12
		}
	}
	else
	{
		if (theHours == "12")
		{
			theHours = "0"
		}
	}

	var outDate = new Date(strFormatted + " " + theHours + ":" + theMinutes)
	return outDate
}

function document_onLoad() {
var i = 0;
s = new Array(51);
s[i++] = "Select one"
s[i++] = "Alabama"
s[i++] = "Alaska"
s[i++] = "Arizona"
s[i++] = "Arkansas"
s[i++] = "California"
s[i++] = "Colorado"
s[i++] = "Connecticut"
s[i++] = "Delaware"
s[i++] = "Florida"
s[i++] = "Georgia"
s[i++] = "Hawaii"
s[i++] = "Idaho"
s[i++] = "Illinois"
s[i++] = "Indiana"
s[i++] = "Iowa"
s[i++] = "Kansas"
s[i++] = "Kentucky"
s[i++] = "Louisiana"
s[i++] = "Maine"
s[i++] = "Maryland"
s[i++] = "Massachusetts"
s[i++] = "Michigan"
s[i++] = "Minnesota"
s[i++] = "Mississippi"
s[i++] = "Missouri"
s[i++] = "Montana"
s[i++] = "Nebraska"
s[i++] = "Nevada"
s[i++] = "New Hampshire"
s[i++] = "New Jersey"
s[i++] = "New Mexico"
s[i++] = "New York"
s[i++] = "North Carolina"
s[i++] = "North Dakota"
s[i++] = "Ohio"
s[i++] = "Oklahoma"
s[i++] = "Oregon"
s[i++] = "Pennsylvania"
s[i++] = "Rhode Island"
s[i++] = "South Carolina"
s[i++] = "South Dakota"
s[i++] = "Tennessee"
s[i++] = "Texas"
s[i++] = "Utah"
s[i++] = "Vermont"
s[i++] = "Virginia"
s[i++] = "Washington"
s[i++] = "West Virginia"
s[i++] = "Wisconsin"
s[i++] = "Wyoming"

PopulateWith(State, s);
var style = "Month Day, Year";
var d = new Date();

if (style == "MM/DD/YY") {
  var date_string = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getYear();
  }
  else if (style == "MM/DD/YYYY") {
  var date_string = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear();
  }
  else if (style == "MM-DD-YY") {
  var date_string = (d.getMonth()+1) + "-" + d.getDate() + "-" + d.getYear();
  }
  else if (style == "MM-DD-YYYY") {
  var date_string = (d.getMonth()+1) + "-" + d.getDate() + "-" + d.getFullYear();
  }
  else if (style == "DD/MM/YY") {
  var date_string = d.getDate() + "/" + (d.getMonth()+1) + "/" + d.getYear();
  }
  else if (style == "DD/MM/YYYY") {
  var date_string = d.getDate() + "/" + (d.getMonth()+1) + "/" + d.getFullYear();
  }
  else if (style == "Month Day, Year") {
  var date_string = getMonthName(d) + " " + d.getDate() + ", " + d.getFullYear();
  }
  else if (style == "Day of week, Month Day, Year") {
  var date_string = getDayName(d) + " " + getMonthName(d) + " " + d.getDate() + ", " + d.getFullYear();
  }
  else if (style == "Locale") {
  var date_string = d.toLocaleString();
  }
  else {
  var date_string = d.toGMTString();
  }

HiddenDate.setText(date_string);
 }
function UpdateBttn__onClick() {
var options="";
options+="status="+(("0"=="1")?"yes":"no")
options+=",directories="+(("0"=="1")?"yes":"no")
options+=",location="+(("0"=="1")?"yes":"no")
options+=",toolbar="+(("0"=="1")?"yes":"no")
options+=",menubar="+(("0"=="1")?"yes":"no")
options+=",scrollbars="+(("1"=="1")?"yes":"no")
options+=",resizable="+(("1"=="1")?"yes":"no")

if (parseInt("700")  > 0) options+=",width="+"700"
if (parseInt("600") > 0) options+=",height="+"600"

if (parseInt("190") >= 0)
{
	options+=",top="+"190"
	options+=",screenY="+"190"
}
if (parseInt("80") >= 0)
{
	options+=",left="+"80"
	options+=",screenX="+"80"
}

page = "";
if (page.length == 0) page = "MngContact.asp";

window.open(page,"NewWindow",options);
 }
function _UpdateBttn__onClick() { if (UpdateBttn) return UpdateBttn.onClick(); }
function Check1__onClick() {
HiddenSubscribe.setText("no");
 }
function _Check1__onClick() { if (Check1) return Check1.onClick(); }

