mpdErr = false;
mpdErrArray = new Array();
mpdData = new Array();

var contiguousStateObj = new Object();
contiguousStateObj["AL"] = "true";
contiguousStateObj["AR"] = "true";
contiguousStateObj["AZ"] = "true";
contiguousStateObj["CA"] = "true";
contiguousStateObj["CO"] = "true";
contiguousStateObj["CT"] = "true";
contiguousStateObj["DC"] = "true";
contiguousStateObj["DE"] = "true";
contiguousStateObj["FL"] = "true";
contiguousStateObj["GA"] = "true";
contiguousStateObj["IA"] = "true";
contiguousStateObj["ID"] = "true";
contiguousStateObj["IL"] = "true";
contiguousStateObj["IN"] = "true";
contiguousStateObj["KS"] = "true";
contiguousStateObj["KY"] = "true";
contiguousStateObj["LA"] = "true";
contiguousStateObj["MA"] = "true";
contiguousStateObj["MD"] = "true";
contiguousStateObj["ME"] = "true";
contiguousStateObj["MI"] = "true";
contiguousStateObj["MN"] = "true";
contiguousStateObj["MO"] = "true";
contiguousStateObj["MS"] = "true";
contiguousStateObj["MT"] = "true";
contiguousStateObj["NC"] = "true";
contiguousStateObj["ND"] = "true";
contiguousStateObj["NE"] = "true";
contiguousStateObj["NH"] = "true";
contiguousStateObj["NJ"] = "true";
contiguousStateObj["NM"] = "true";
contiguousStateObj["NV"] = "true";
contiguousStateObj["NY"] = "true";
contiguousStateObj["OH"] = "true";
contiguousStateObj["OK"] = "true";
contiguousStateObj["OR"] = "true";
contiguousStateObj["PA"] = "true";
contiguousStateObj["RI"] = "true";
contiguousStateObj["SC"] = "true";
contiguousStateObj["SD"] = "true";
contiguousStateObj["TN"] = "true";
contiguousStateObj["TX"] = "true";
contiguousStateObj["UT"] = "true";
contiguousStateObj["VA"] = "true";
contiguousStateObj["VT"] = "true";
contiguousStateObj["WA"] = "true";
contiguousStateObj["WI"] = "true";
contiguousStateObj["WV"] = "true";
contiguousStateObj["WY"] = "true";

function ww(str){document.write(str);}
// Date utility
var mpdNODOW = new Array('Воскресенье','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота','Воскресенье');
var mpdSNODOW = new Array('Воскр','Пон','Вт','Ср','Чт','Пт','Сб','Воскр');
var mpdNOM = new Array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');
var mpdSNOM = new Array('Января','Февраля','Марта','Апреля','Мая','Июня','Июля','Августа','Сентября','Октября','Ноября','Декабря');
function _getAMPM() {
	return (this.getHours() >= 12) ? 'PM': 'AM';
}
function _get12HourStr() {
	if (this.getHours() > 12) return "" + (this.getHours() - 12);
	else if (this.getHours() == 0) return "12";
	else return "" + this.getHours();
}
function _get24HourStr() {
	if (this.getHours() == 0) return "00";
	else if (this.getHours() < 10) return "0" + this.getHours();
	else return "" + this.getHours();
}
function getAMPM(gh) {
	return (Number(gh) >= 12) ? 'PM': 'AM';
}
function getMonthStr(mnth) {
	var mstr = mnth + 1;
	if (mstr < 10) mstr = "0" + mstr;
	else mstr = "" + mstr;
	return mstr;
}
function _getMonthStr() {
	var mstr = this.getMonth() + 1;
	if (mstr < 10) mstr = "0" + mstr;
	else mstr = "" + mstr;
	return mstr;
}
function getDayStr(dy) {
	var thisdy = '';
	if (Number(dy) < 10) thisdy = "" + "0" + dy;
	else thisdy = ""+dy;
	return thisdy;
}
function _getDayStr() {
	var thisdy = '';
	if (this.getDate() < 10) thisdy = "" + "0" + this.getDate();
	else thisdy = "" + this.getDate();
	return thisdy;
}
function getMonthDayStr(dy,mnth) {
	return getMonthStr(mnth) + getDayStr(dy);
}
function _getMonthDayStr() {
	var mstr = this.getMonth() + 1;
	if (mstr < 10) mstr = "0" + mstr;
	else mstr = "" + mstr;
	var thisdy = '';
	if (this.getDate() < 10) thisdy = "" + "0" + this.getDate();
	else thisdy = "" + this.getDate();
	return mstr + thisdy;
}
function _getMinuteStr() {
	var mstr = this.getMinutes();
	if (mstr < 10) mstr = "0" + mstr;
	else mstr = "" + mstr;
	return mstr;
}
function _getNameOfDayOfWeek() {
	return mpdNODOW[this.getDay()];
}
function getNameOfDayOfWeek(dow) {
	return mpdNODOW[Number(dow)];
}
function _getShortNameOfDayOfWeek() {
	return mpdSNODOW[this.getDay()];
}
function getShortNameOfDayOfWeek(dow) {
	return mpdSNODOW[Number(dow)];
}
function _getNameOfMonth() {
	return mpdNOM[this.getMonth()];
}
function getNameOfMonth(nom) {
	return mpdNOM[Number(nom)];
}
function _getShortNameOfMonth() {
	return mpdSNOM[this.getMonth()];
}
function getShortNameOfMonth(nom) {
	return mpdSNOM[Number(nom)];
}
function _isAfter4AM() {
	return (this.getHours() >= 4) ? true: false;
}
function _isAfter4PM() {
	return (this.getHours() >= 16) ? true: false;
}
Date.prototype.getAMPM = _getAMPM;
Date.prototype.getNameOfDayOfWeek = _getNameOfDayOfWeek;
Date.prototype.getShortNameOfDayOfWeek = _getShortNameOfDayOfWeek;
Date.prototype.getNameOfMonth = _getNameOfMonth;
Date.prototype.getShortNameOfMonth = _getShortNameOfMonth;
Date.prototype.isAfter4AM = _isAfter4AM;
Date.prototype.isAfter4PM = _isAfter4PM;
Date.prototype.getMonthStr = _getMonthStr;
Date.prototype.getDayStr = _getDayStr;
Date.prototype.getMonthDayStr = _getMonthDayStr;
Date.prototype.get12HourStr = _get12HourStr;
Date.prototype.get24HourStr = _get24HourStr;
Date.prototype.getMinuteStr = _getMinuteStr;

function mpdHeadObj(ut,ud,us,ur,up) {
	this.ut = ut;
	this.ud = ud;
	this.us = us;
	this.ur = ur;
	this.up = up;
}

// Public, Permanent API for Head
function mpdHeadUt(){ return (mpdData['head'])?mpdData['head'].ut:''; }
function mpdHeadUd(){ return (mpdData['head'])?mpdData['head'].ud:''; }
function mpdHeadUs(){ return (mpdData['head'])?mpdData['head'].us:''; }
function mpdHeadUr(){ return (mpdData['head'])?mpdData['head'].ur:''; }
function mpdHeadUp(){ return (mpdData['head'])?mpdData['head'].up:''; }

function mpdLocObj(locid,loctype,zip2locid,presname,loctime,tz,techiePoint,stcd,zip2LocIDPresName, regrad) {
	this.locid = locid;
	this.loctype = loctype;
	this.zip2locid = zip2locid;
	this.presname = presname;
	this.loctime = loctime;
	this.tz = tz;
	this.techiePoint = techiePoint;
	this.stcd = stcd;
	this.iscontiguous = _mpdIsContiguous(this.stcd);
	this.zip2LocIDPresName = zip2LocIDPresName;
	this.regrad = regrad;
}

// Public, Permanent API for Loc
function mpdLocId()          { return (mpdData['loc'])?mpdData['loc'].locid:''; }
function mpdLocType()        { return (mpdData['loc'])?mpdData['loc'].loctype:''; }
function mpdLocZip2LocId()   { return (mpdData['loc'])?mpdData['loc'].zip2locid:''; }
function mpdLocPresName()    { return (mpdData['loc'])?mpdData['loc'].presname:''; }
function mpdLocalTmDateObj() { return (mpdData['loc'])?mpdData['loc'].loctime:''; }
function mpdLocTz()          { return (mpdData['loc'])?mpdData['loc'].tz:''; }
function mpdLocTechiePoint() { return (mpdData['loc'])?mpdData['loc'].techiePoint:''; }
function mpdLocIsContiguous(){ return (mpdData['loc'])?mpdData['loc'].iscontiguous:false; }
function mpdLocZip2LocIdPresName() { return (mpdData['loc'])?mpdData['loc'].zip2LocIDPresName:''; }
function mpdLocRegRad()      { return (mpdData['loc'])?mpdData['loc'].regrad:''; }


// Day Forecast
function mpdFObj(lsup,afterRoll) {
	this.lsup = lsup;
	this.afterRoll = afterRoll;
	this.day = new Array();
}
function mpdFDObj(dateObj,dayInd,hi,low,uvi,icon,t,winds,windd,windt,ppcp,hmid) {
	this.dateObj = dateObj;
	this.dayInd = dayInd;
	this.hi = hi;
	this.low = low;
	this.uvi = uvi;
	this.icon = icon;
	this.t = t;
	this.winds = winds;
	this.windd = windd;
	this.windt = windt;
	this.ppcp = ppcp;
	this.hmid = hmid;
}

// Public API for day forecast
function mpdDayFLsup()       { return (mpdData['dayf'])?mpdData['dayf'].lsup:''; }
function mpdDayFARoll()      { return (mpdData['dayf'])?mpdData['dayf'].afterRoll:''; }
function mpdDayFDateObj(day) { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].dateObj:''; }
function mpdDayFDayInd(day)  { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].dayInd:''; }
function mpdDayFHi(day)      { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].hi:''; }
function mpdDayFLow(day)     { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].low:''; }
function mpdDayFUVI(day)     { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].uvi:''; }
function mpdDayFIcon(day)    { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].icon:''; }
function mpdDayFT(day)       { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].t:''; }
function mpdDayFWindS(day)   { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].winds:''; }
function mpdDayFWindD(day)   { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].windd:''; }
function mpdDayFWindT(day)   { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].windt:''; }
function mpdDayFPpcp(day)    { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].ppcp:''; }
function mpdDayFHmid(day)    { return (mpdData['dayf']&&mpdData['dayf'].day[day])?mpdData['dayf'].day[day].hmid:''; }

// Climo
function mpdClimoAbbvObj(hi,low) {
	this.hi = hi;
	this.low = low;
}
function mpdClimoObj(hi,low,rechi,reclow,rechiyr,reclowyr,mean) {
	this.hi = hi;
	this.low = low;
	this.rechi = rechi;
	this.reclow = reclow;
	this.rechiyr = rechiyr;
	this.reclowyr = reclowyr;
	this.mean = mean;
}

// Public API for climatology
function mpdClimoHi(day)       { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].hi:''; }
function mpdClimoLow(day)      { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].low:''; }
function mpdClimoRecHi(day)    { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].rechi:''; }
function mpdClimoRecLow(day)   { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].reclow:''; }
function mpdClimoRecHiYr(day)  { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].rechiyr:''; }
function mpdClimoRecLowYr(day) { return (mpdData['climo']&&mpdData['climo'][day])?mpdData['climo'][day].reclowyr:''; }

// graph helper
function drawImg(url,wid,hei,bor,alt,sty) {
	return '<img src="'+url+'" alt="'+alt+'" width="'+wid+'" height="'+hei+'" border="'+bor+'" style="'+sty+'">';
}
function icon(ino,size,text){ return String('<IMG SRC="http://image.weather.com/web/common/wxicons/'+size+'/'+ino+'.gif" WIDTH="'+size+'" HEIGHT="'+size+'" BORDER="0" ALT="'+text+'">'); }
function imgstr(u,w,h){ return drawImg(u,w,h,'0','',''); }
imgBlank = 'http://ima.weather.com/web/blank.gif';
graphLbls = new Array();
graphVals = new Array();
graphAvgs = new Array();
graphTrgs = new Array();

var tgObjNAVar = -9999;
// Tenday Graph Object
function mpdTGObj() {
	this.day = new Array;
}
function mpdTGDObj(value,label,width) {
	this.value = value;
	this.label = label;
	this.width = width;
}
// Tenday Graph Object public API
function mpdTGValue(day) { return (mpdData['dayfgraph']&&mpdData['dayfgraph'].day[day]&& !(mpdData['dayfgraph'].day[day].value==tgObjNAVar))?mpdData['dayfgraph'].day[day].value:'N/A'; }
function mpdTGLabel(day) { return (mpdData['dayfgraph']&&mpdData['dayfgraph'].day[day])?mpdData['dayfgraph'].day[day].label:''; }
function mpdTGWidth(day) { return (mpdData['dayfgraph']&&mpdData['dayfgraph'].day[day])?mpdData['dayfgraph'].day[day].width:'0'; }


// generic trigger object
function mpdTriggerObj(tt,tu,ts) {
	// tt trigger text
	this.tt = tt;
	// tu trigger url
	this.tu = tu;
	// ts trigger style
	this.ts = ts;
}

// dynamic stylesheet modification helper function
function jtt_aR(sel,sty) {
	document.styleSheets[document.styleSheets.length-1].addRule(sel, sty, -1);
}

// Public API for Ten Day Trigger display
function mpdShowTenDayTrigger(dayOffset) {
        if(graphTrgs[dayOffset]) {
            var myTrgr = new mpdTriggerObj("", "", "wxTrigger");
            myTrgr = getWxTrigger(graphTrgs[dayOffset]);
            if (myTrgr.tu) {
                // draw href, style, text
                return '<a href="'+myTrgr.tu+'" class="'+myTrgr.ts+'">'+myTrgr.tt+'</a>';
            } else {
                // draw style, text without href
                //return '<font class="'+myTrgr.ts+'">'+myTrgr.tt+'</font>';
                return '';
            }
        } else {
            return '';
        }
}
// OAS Variables changed should include: OAS_spoof and OAS_query

// Blocking function required for MPD to work
function mpdLoad() {
	return;
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for day details
function mpdNObj(lsup) {
	this.lsup = lsup;
	this.day = new Array();
}
function mpdNDObj(dObj,dNum,tf,dLabel) {
	this.dObj = dObj;
	this.dNum = dNum;
	this.tf = tf;
	this.dLabel = dLabel;
}

// Public API for day details
function mpdNarrName(day) { return (mpdData['narr'] && mpdData['narr'].day )?mpdData['narr'].day[day].dObj.getShortNameOfMonth():'N/A'; }
function mpdNarrDate(day) { return (mpdData['narr'] && mpdData['narr'].day )?mpdData['narr'].day[day].dObj.getDate():''; }
function mpdNarrLsup() { return (mpdData['narr'] && mpdData['narr'].lsup)? mpdData['narr'].lsup: 'N/A'; }
// function mpdNarrLsupObj() { return new Date(mpdData['narr'].lsup); }
function mpdNarrTF(day) { return (mpdData['narr'] && mpdData['narr'].day)?mpdData['narr'].day[day].tf:'N/A'; }
function mpdNarrApr(day) { return (mpdData['narr'] && mpdData['narr'].day)?mpdData['narr'].day[day].dLabel:'N/A'; }
function mpdNarrDayNum(day) { return (mpdData['narr'] && mpdData['narr'].day[day])?mpdData['narr'].day[day].dNum:''; }
function mpdNarrArrayLength() { return (mpdData['narr'] && mpdData['narr'].day)?mpdData['narr'].day.length:1; }

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for sev wx alerts
function mpdAlrtObj(haveAlert,alertFGColor,alertBGColor,alertStr,alertLength) {
	this.haveAlert = haveAlert;
	this.alertFGColor = alertFGColor;
	this.alertBGColor = alertBGColor;
	this.alertStr = alertStr;
	this.alertLength = alertLength;
}

// Public API for sev wx alerts
function mpdAlertHave() {  return (mpdData['swxalrt'])?mpdData['swxalrt'].haveAlert:'false';  }
    // Text Color
function mpdAlertFGColor() { return (mpdData['swxalrt'])?mpdData['swxalrt'].alertFGColor:''; }
    // ALERT Color
function mpdAlertBGColor() { return (mpdData['swxalrt'])?mpdData['swxalrt'].alertBGColor:''; }
function mpdAlertStr() { return (mpdData['swxalrt'])?mpdData['swxalrt'].alertStr:''; }
function mpdAlertLength() { return (mpdData['swxalrt'])?mpdData['swxalrt'].alertLength:0; }

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for Climo
// Climo
function mpdClimoBaseObj(climoMonth) {
	this.period = new Array();
	this.fact = new Array();
	this.flashParams = '';
	this.climoMonth = climoMonth;
}
function mpdClimoAbbvObj(hi,low) {
	this.hi = hi;
	this.low = low;
}
function mpdClimoObj(hi,low,rechi,reclow,rechiyr,reclowyr,mean,precip) {
	this.hi = hi;
	this.low = low;
	this.rechi = rechi;
	this.reclow = reclow;
	this.rechiyr = rechiyr;
	this.reclowyr = reclowyr;
	this.mean = mean;
	this.precip = precip;
	this.fact = new Array();
}


// Public API for climatology
function mpdClimoHi(period)       { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].hi:'N/A'; }
function mpdClimoLow(period)      { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].low:'N/A'; }
function mpdClimoRecHi(period)    { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].rechi:'N/A'; }
function mpdClimoRecLow(period)   { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].reclow:'N/A'; }
function mpdClimoRecHiYr(period)  { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].rechiyr:'N/A'; }
function mpdClimoRecLowYr(period) { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].reclowyr:'N/A'; }
function mpdClimoMean(period)     { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].mean:'N/A'; }
function mpdClimoPrecip(period)   { return (mpdData['climo'] && mpdData['climo'].period[period])?mpdData['climo'].period[period].precip:'N/A'; }
function mpdClimoArrayLength()    { return (mpdData['climo'])?mpdData['climo'].length:1; }
function mpdClimoPeriodArrayLength()    { return (mpdData['climo'] && mpdData['climo'].period)?mpdData['climo'].period.length:1; }
function mpdClimoWxFactArrayLength()    { return (mpdData['climo'] && mpdData['climo'].fact)?mpdData['climo'].fact.length:0; }
function mpdClimoFlashParams()  { return (mpdData['climo'] && mpdData['climo'].flashParams)?mpdData['climo'].flashParams:''; }

// Used on daily page for NAV
function mpdClimoMonth()  { return (mpdData['climo']&& mpdData['climo'].climoMonth)?mpdData['climo'].climoMonth:''; }

// Climo Link Objects
function mpdClimoLOText(index)  { return (mpdData['climo'] && mpdData['climo'].fact && mpdData['climo'].fact[index].tt)?mpdData['climo'].fact[index].tt:''; }
function mpdClimoLOUrl(index)   { return (mpdData['climo'] && mpdData['climo'].fact && mpdData['climo'].fact[index].tu)?mpdData['climo'].fact[index].tu:''; }
function mpdClimoLOClass(index) { return (mpdData['climo'] && mpdData['climo'].fact && mpdData['climo'].fact[index].tc)?mpdData['climo'].fact[index].tc:''; }
function mpdClimoLOId(index)    { return (mpdData['climo'] && mpdData['climo'].fact && mpdData['climo'].fact[index].tid)?mpdData['climo'].fact[index].tid:''; }
function mpdClimoLOStyle(index) { return (mpdData['climo'] && mpdData['climo'].fact && mpdData['climo'].fact[index].ts)?mpdData['climo'].fact[index].ts:''; }

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for SunRise/SunSet Data  on the monthly climo page
// SunRise/SunSet

function mpdSunRiseSetObj() {
	this.day = new Array();
}

function mpdClimoSunRiseSetObj(sunrise,sunset) {
	this.sunrise = sunrise;
	this.sunset = sunset;
}

// Public API for SunRise/SunSet Data on the monthly climo page
function mpdClimoSunRise(day)       { return (mpdData['climosunriseset']&&mpdData['climosunriseset'].day[day].sunrise)?mpdData['climosunriseset'].day[day].sunrise:''; }
function mpdClimoSunSet(day)      { return (mpdData['climosunriseset']&&mpdData['climosunriseset'].day[day].sunset)?mpdData['climosunriseset'].day[day].sunset:''; }

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for Climo Compare
// Climo Compare
function mpdClimoCompareObj(flashParams) {
	this.flashParams = flashParams;
}

// Public API for Climo Compare Data
function mpdClimoCompFlashParams() { return (mpdData['climocompare']&&mpdData['climocompare'].flashParams.length > 0)?mpdData['climocompare'].flashParams:''; }

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for Hourly Module
// Hourly Module

// using prefix "HM" for Hourly Module

// Hourly Object
function mpdHMObj(lsup,shwprvlnk,shwnxtlnk,navbeghr,navbegday) {
    this.lsup = lsup;
    this.hour = new Array();
    this.shwprvlnk = shwprvlnk;
    this.shwnxtlnk = shwnxtlnk;
    this.navbeghr = navbeghr;
    this.navbegday = navbegday;
    this.flashParams = '';
    this.msg = new mpdHMMsgObj('','','','');
}

// Hourly Module Hour Obj.
function mpdHMHrObj(tp,iconcd,icontxt,temp,fltemp,precip,dp,humid,wind) {
    // Time Period String
    this.tp = tp;
    // Icon Code
    this.iconcd = iconcd;
    // Icon Description
    this.icontxt = icontxt;
    // Temp
    this.temp = temp;
    // Feels Like temp
    this.fltemp = fltemp;
    // precip
    this.precip = precip;
    // dew point
    this.dp = dp;
    // humidity
    this.humid = humid;
    // wind phrase
    this.wind = wind;
}

// Flags should contain booleans
function mpdHMFlagsObj(night,svr,sunr,suns,dd,cmsam,cmspm,cm,cme) {
    // Day or Night
    this.night = night || false;
    // Severe
    this.svr = svr || false;
    // Sunrise
    this.sunr = sunr || false;
    // Sunset
    this.suns = suns || false;
    // Day Divider
    this.dd = dd || false;
    // Commute, start & end
    // commute and end determine which style to apply
    // start determines whether or not to show title
    this.cmsam = cmsam || false;
    this.cmspm = cmspm || false;
    this.cm = cm || false;
    this.cme = cme || false;
}

// Based on generic trigger object
function mpdHMLinkObj(tt,tu,tc,tid,ts) {
    // tt = text
    this.tt = tt;
    // tu = url
    this.tu = tu;
    // tc = class
    this.tc = tc;
    // tid = ID
    this.tid = tid;
    // ts = style
    this.ts = ts;
}

// Promo Link Helper
function mpdHMPromoLnk(type) {
    // If we have a PROMO LINK Array Defined for the Type
    if (mpdData['HMlo'] && mpdData['HMlo'][type]) {
        // If more than 1 item in the array, get a random item.
        if (mpdData['HMlo'][type].length > 1) {
            return mpdData['HMlo'][type][Math.round(Math.random()*(mpdData['HMlo'][type].length - 1))];
        } else { // otherwise, get the first
            return mpdData['HMlo'][type]['0'];
        }
    }
}

// Hourly messages
function mpdHMMsgObj(srMsg,ssMsg,rhMsg,ddMsg) {
    // Sunrise Msg
    this.srMsg = srMsg;
    // Sunset Msg
    this.ssMsg = ssMsg;
    // Day Divider Msg
    this.ddMsg = ddMsg
    // Commute Msg
    this.rhMsg = rhMsg;

}

// Public API for Hourly Data
// Hourly Data
function mpdHMLsup()            { return (mpdData['HMhour'] && mpdData['HMhour'].lsup)?mpdData['HMhour'].lsup:'N/A'; }
function mpdHMShowPrev()        { return (mpdData['HMhour'] && mpdData['HMhour'].shwprvlnk)?mpdData['HMhour'].shwprvlnk:false; }
function mpdHMShowNext()        { return (mpdData['HMhour'] && mpdData['HMhour'].shwnxtlnk)?mpdData['HMhour'].shwnxtlnk:false; }
function mpdHMBegHr()           { return (mpdData['HMhour'] && mpdData['HMhour'].navbeghr)?mpdData['HMhour'].navbeghr:''; }
function mpdHMBegDay()          { return (mpdData['HMhour'] && mpdData['HMhour'].navbegday)?mpdData['HMhour'].navbegday:''; }
function mpdHMDate(hour)        { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].tp)?mpdData['HMhour'].hour[hour].tp:''; }
function mpdHMDate12HrStr(hour) { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].tp)?mpdData['HMhour'].hour[hour].tp.get12HourStr():'N/A'; }
function mpdHMDateAMPM(hour)    { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].tp)?mpdData['HMhour'].hour[hour].tp.getAMPM().toLowerCase():''; }
function mpdHMWXIcon(hour)      { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].iconcd)?mpdData['HMhour'].hour[hour].iconcd:'44'; }
function mpdHMWXIconTxt(hour)   { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].icontxt)?mpdData['HMhour'].hour[hour].icontxt:'N/A'; }
function mpdHMTemp(hour)        { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].temp)?mpdData['HMhour'].hour[hour].temp:'N/A'; }
function mpdHMFLTemp(hour)      { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].fltemp)?mpdData['HMhour'].hour[hour].fltemp:'N/A'; }
function mpdHMPrecip(hour)      { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].precip)?mpdData['HMhour'].hour[hour].precip:'N/A'; }
function mpdHMDewPt(hour)       { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].dp)?mpdData['HMhour'].hour[hour].dp:'N/A'; }
function mpdHMHumid(hour)       { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].humid)?mpdData['HMhour'].hour[hour].humid:'N/A'; }
function mpdHMWind(hour)        { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].wind)?mpdData['HMhour'].hour[hour].wind:'N/A'; }
function mpdHMFlashParams()     { return (mpdData['HMhour'] && mpdData['HMhour'].flashParams)?mpdData['HMhour'].flashParams:''; }
function mpdHMArrayLength()     { return (mpdData['HMhour'] && mpdData['HMhour'].hour)?mpdData['HMhour'].hour.length:1; }
function mpdHMTimeHave()				{ return (mpdData['HMhour'] && mpdData['HMhour'].hour.length > 0)?true:false;}
function mpdHMTimePrdHave(hour) { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour])?true:false; }


// Hourly Date Helper
function hrlyDateHelper(hr) {
    retStr = "";
    if (mpdHMDate(hr)) {
		  retStr += mpdHMDate(hr).getShortNameOfDayOfWeek();
		  retStr += ", ";
    	  retStr += mpdHMDate(hr).getNameOfMonth();
    	  retStr += " ";
    	  retStr += mpdHMDate(hr).getDate();
		} else {
		  retStr = "N/A";
		}
		return retStr;
}


// Display Flags
function mpdHMIsNight(hour)     { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].night)?mpdData['HMflg'][hour].night:false; }
function mpdHMIsSvr(hour)       { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].svr)?mpdData['HMflg'][hour].svr:false; }
function mpdHMIsSunrise(hour)   { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].sunr)?mpdData['HMflg'][hour].sunr:false; }
function mpdHMIsSunset(hour)    { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].suns)?mpdData['HMflg'][hour].suns:false; }
function mpdHMIsDayDiv(hour)    { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].dd)?mpdData['HMflg'][hour].dd:false; }
function mpdHMIsAMCommStr(hour) { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].cmsam)?mpdData['HMflg'][hour].cmsam:false; }
function mpdHMIsPMCommStr(hour) { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].cmspm)?mpdData['HMflg'][hour].cmspm:false; }
function mpdHMIsComm(hour)      { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].cm)?mpdData['HMflg'][hour].cm:false; }
function mpdHMIsCommEnd(hour)   { return (mpdData['HMflg'] && mpdData['HMflg'][hour] && mpdData['HMflg'][hour].cme)?mpdData['HMflg'][hour].cme:false; }
function mpdHMIsAMComm(hour)   { return (mpdData['HMhour'] && mpdData['HMhour'].hour[hour] && mpdData['HMhour'].hour[hour].tp && mpdData['HMhour'].hour[hour].tp.getAMPM().toLowerCase == 'am' )?true:false; }

// Hourly Link Objects
function mpdHMLOText(typenm)  { return (mpdHMPromoLnk(typenm) && mpdHMPromoLnk(typenm).tt)?mpdHMPromoLnk(typenm).tt:''; }
function mpdHMLOUrl(typenm)   { return (mpdHMPromoLnk(typenm) && mpdHMPromoLnk(typenm).tu)?mpdHMPromoLnk(typenm).tu:''; }
function mpdHMLOClass(typenm) { return (mpdHMPromoLnk(typenm) && mpdHMPromoLnk(typenm).tc)?mpdHMPromoLnk(typenm).tc:''; }
function mpdHMLOId(typenm)    { return (mpdHMPromoLnk(typenm) && mpdHMPromoLnk(typenm).tid)?mpdHMPromoLnk(typenm).tid:''; }
function mpdHMLOStyle(typenm) { return (mpdHMPromoLnk(typenm) && mpdHMPromoLnk(typenm).ts)?mpdHMPromoLnk(typenm).ts:''; }

// Messages
function mpdHMSRMsg()  { return (mpdData['HMMsg'] && mpdData['HMMsg'].srMsg)?mpdData['HMMsg'].srMsg:''; }
function mpdHMSSMsg()  { return (mpdData['HMMsg'] && mpdData['HMMsg'].ssMsg)?mpdData['HMMsg'].ssMsg:''; }
function mpdHMRHMsg()  { return (mpdData['HMMsg'] && mpdData['HMMsg'].rhMsg)?mpdData['HMMsg'].rhMsg:''; }
function mpdHMDDMsg()  { return (mpdData['HMMsg'] && mpdData['HMMsg'].ddMsg)?mpdData['HMMsg'].ddMsg:''; }

// Promo Link helper
function drawURL(text,url,cls,id,style) {
    if (text && text.length > 0) {
        if (url && url.length > 0) {
            if (!cls) { cls = '';}
            if (!id) {id = '';}
            if (!style) {style = '';}

            return '<a href="'+url+'" style="'+style+'" class="'+cls+'" id="'+id+'">'+text+'</a>';
        } else {
            return text;
        }
    } else {
        return '';
    }
}


// Object Definition for Day Part Forecast
function mpdFDPObj(dateObj,dayInd,hi,low,uvi,dicon,dt,dwinds,dwindd,dwindt,dppcp,dhmid,nicon,nt,nwinds,nwindd,nwindt,nppcp,nhmid) {
	this.dateObj = dateObj;
	this.dayInd = dayInd;
	this.hi = hi;
	this.low = low;
	this.uvi = uvi;
	this.dicon = dicon;
	this.dt = dt;
	this.dwinds = dwinds;
	this.dwindd = dwindd;
	this.dwindt = dwindt;
	this.dppcp = dppcp;
	this.dhmid = dhmid;
	this.nicon = nicon;
	this.nt = nt;
	this.nwinds = nwinds;
	this.nwindd = nwindd;
	this.nwindt = nwindt;
	this.nppcp = nppcp;
	this.nhmid = nhmid;
}

// Public API for day part forecast
function mpdDayPFLsup()            { return (mpdData['dayPartFcst'])?mpdData['dayPartFcst'].lsup:'N/A'; }
function mpdDayPFARoll()           { return (mpdData['dayPartFcst'])?mpdData['dayPartFcst'].afterRoll:false; }
function mpdDayPFDateObj(day)      { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dateObj:''; }
function mpdDayPFDayInd(day)       { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dayInd:''; }
function mpdDayPFHi(day)           { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].hi:'N/A'; }
function mpdDayPFLow(day)          { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].low:'N/A'; }
function mpdDayPFUVI(day)          { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].uvi:'N/A'; }
function mpdDayPFDayIcon(day)      { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dicon:'44'; }
function mpdDayPFDayT(day)         { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dt:'N/A'; }
function mpdDayPFDayWindS(day)     { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dwinds:'N/A'; }
function mpdDayPFDayWindD(day)     { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dwindd:'N/A'; }
function mpdDayPFDayWindT(day)     { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dwindt:'N/A'; }
function mpdDayPFDayPpcp(day)      { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dppcp:'N/A'; }
function mpdDayPFDayHmid(day)      { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].dhmid:'N/A'; }
function mpdDayPFNightIcon(day)    { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nicon:'44'; }
function mpdDayPFNightT(day)       { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nt:'N/A'; }
function mpdDayPFNightWindS(day)   { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nwinds:'N/A'; }
function mpdDayPFNightWindD(day)   { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nwindd:'N/A'; }
function mpdDayPFNightWindT(day)   { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nwindt:'N/A'; }
function mpdDayPFNightPpcp(day)    { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nppcp:'N/A'; }
function mpdDayPFNightHmid(day)    { return (mpdData['dayPartFcst']&&mpdData['dayPartFcst'].day[day])?mpdData['dayPartFcst'].day[day].nhmid:'N/A'; }


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for Location Map Region
// Map Region Object
function mpdLocMapRegObj(regSat,regRadar) {
    this.regSat = regSat;
    this.regRadar = regRadar;
}

// Public API for Location Map Region
// Location Map Region
function mpdLMRRegSat()   { return (mpdData['locMapReg'] && mpdData['locMapReg'].regSat)?mpdData['locMapReg'].regSat:'na'; }
function mpdLMRRegRadar() { return (mpdData['locMapReg'] && mpdData['locMapReg'].regRadar)?mpdData['locMapReg'].regRadar:'na'; }

// param helper
function paramHelper(par,value) {
    return (value)? par+'='+value : '';
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Private Object Definitions for generic local video data object
// generic local video data object
function mpdLocalVideoObj(haveLocVid, clipID, videoURL, linkLabel) {
    this.haveLocVid = haveLocVid;
    this.clipID = clipID;
    this.videoURL = videoURL;
    this.linkLabel = linkLabel;
}
// public API for local video data obj
function mpdLVHaveLocVid() {return mpdData['locvideo'].haveLocVid;}
function mpdLVClipID() {return mpdData['locvideo'].clipID;}
function mpdLVVideoURL() {return mpdData['locvideo'].videoURL;}
function mpdLVLinkLabel() {return mpdData['locvideo'].linkLabel;}

function _mpdIsContiguous(stcd) {
    if(contiguousStateObj[stcd] && contiguousStateObj[stcd] == "true") {
        return true;
    } else {
        return false;
    }
}
