/* Site Configurations */
var branding = {
	alertsLink : "/category/208527/weatheralerts",
	closingsLink : "/category/211161/snowbird-closings",
	logoLink : "/weather"
}

/* COMMON WEATHER */
var wxCache = {};
function fetchWxFeed(i, callback) {
  if (wxCache[i] !== undefined) {
    callback(wxCache[i], i);
    return;
  }

  var wxBase = 'http://data.wp.myweather.net/eWxII/?data=*{STATION}';
  var url = wxBase.replace('{STATION}', wxLocations[i].zipCode);
  WNHttpRequestManager.makeRequest(url, {
    onSuccess: function() {
      wxCache[i] = this.response.responseXML;
      callback(this.response.responseXML, i);
    },
    onError: function() {}
  });
}

var wxLocations = [
  {name: 'Nashville',   zipCode: '37202'},
  {name: 'Smyrna',      zipCode: '37167'},
  {name: 'Clarksville', zipCode: '37042'},
  {name: 'Crossville',  zipCode: '38572'}
];

// Old station list, for backwards compatibility
var wxStations = new Array();
wxStations[0] = new Array("http://data.wp.myweather.net/eWxII/?data=*37202", "Nashville");
wxStations[1] = new Array("http://data.wp.myweather.net/eWxII/?data=*37167", "Smyrna");
wxStations[2] = new Array("http://data.wp.myweather.net/eWxII/?data=*37042", "Clarksville");
wxStations[3] = new Array("http://data.wp.myweather.net/eWxII/?data=*38572", "Crossville");

/* Vibrant Ad Tags */
if(wng_pageInfo.containerType === 'S'){
	var vibSrc = "";
	if(wng_pageInfo.contentClassification === 'Auto'){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6990";
	}
	else if((wng_pageInfo.contentClassification === 'Community') || (wng_pageInfo.contentClassification === 'Community - Calendar') || (wng_pageInfo.contentClassification === 'Community - Events') || (wng_pageInfo.contentClassification === 'Education')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6999";
	}
	else if((wng_pageInfo.contentClassification === 'Entertainment') || (wng_pageInfo.contentClassification === 'Entertainment - Interview') || (wng_pageInfo.contentClassification === 'Entertainment - Music')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6991";
	}
	else if((wng_pageInfo.contentClassification === 'Food Recipe')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6992";
	}
	else if((wng_pageInfo.contentClassification === 'Health')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6994";
	}
	else if((wng_pageInfo.contentClassification === 'Sales - Home and Garden') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-New Home') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Plumbing') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Real Estate') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Remodeling') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Roofing') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Security') || (wng_pageInfo.contentClassification === 'Sales - Home Garden-Windows')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6995";
	}
	else if((wng_pageInfo.contentClassification === 'Sales - Finance')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6993";
	}
	else if((wng_pageInfo.contentClassification.indexOf('News') != -1) || (wng_pageInfo.contentClassification.indexOf('Political') != -1) || (wng_pageInfo.contentClassification.indexOf('Station') != -1) || (wng_pageInfo.contentClassification.indexOf('Weather') != -1)){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6989";
	}
	else if((wng_pageInfo.contentClassification.indexOf('Sport') != -1)){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6996";
	}
	else if((wng_pageInfo.contentClassification === 'Technology')){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6997";
	}
	else if((wng_pageInfo.contentClassification.indexOf('Traffic') != -1) || (wng_pageInfo.contentClassification.indexOf('Travel') != -1)){
		vibSrc = "http://meredithtv.us.intellitxt.com/intellitxt/front.asp?ipid=6998";
	}
}

/* DataSphere Ad Call: subpages */
/*
if (wng_pageInfo.containerType === "S"){
	PLATFORM.EventMan.registerToEvent(function(){
	
		OAS_url = 'http://oascentral.datasphere.com';
		OAS_sitepage = 'wsmv/article';
		OAS_pos = 'Frame1';
		try {
			OAS_query = 'community='+__dsns_.GetCookie('dsnscomm');
		} catch(e) {
			OAS_query = '';
		}
		var OAS_RN = new String (Math.random());
		var OAS_RNS = OAS_RN.substring (2,11);
		
		$wn("#WNCol4").append("<div id='dsnsevents'></div><div id='dsnscommunityevents'></div>");
		document.write('<scr' + 'ipt type="text/javascript" src="' + OAS_url + '/RealMedia/ads/adstream_jx.ads/' + OAS_sitepage + '/1' + OAS_RNS + '@' + OAS_pos + '?' + OAS_query + '"></scr' + 'ipt>');
	
	},'WNCol4done');
	$wn(document).ready(function(){
		if($wn("#dsnscommunityevents").length){
			$wn("#WNCol4 ~ a").insertAfter($("#WNAD100wrap"));
			$wn("#dsnscommunityevents").css("margin-top", "15px");
		}
		else {
			$wn("#WNCol4 ~ a").appendTo("#WNCol4");
		}
	});
}
*/

/* Meredith Shared Code */
document.write('<scr' + 'ipt type="text/javascript" src="http://ftpcontent.worldnow.com/meredith/custom/custom-master.js"><\/scr' + 'ipt>');
