














	

	// Home page blanket
	function updateHomepage() {
		homepageUtil.updateHomeWindows();
		//homepageUtil.updateHomeTopics();
		homepageUtil.updateHomeOnNow();
		wrapUtil.htmlUpdateFanword();
	}	
	
/* HOME PAGE FUNCTIONS
   ---------------------------------------------- */
   var homepageUtil   = {
   
   
		// Updates home window images
		updateHomeWindows:function(disableHtml) {
				var a_order = ["a","b","c"];
				var windowA = {"pos":"a","date":"01/01/2000"};
				var windowB = {"pos":"b","date":"01/01/2000"};
				var windowC = {"pos":"c","date":"01/01/2000"};
				var thisWindow;
				
				for (a=0; a < a_order.length; a++) { 
					var windowId = a_order[a];
					
					switch (windowId) {
						case "a": thisWindow = windowA; break;
						case "b": thisWindow = windowB; break;
						case "c": thisWindow = windowC; break;
						default:break;
					}	
				
					for (i=0; i < this.homePlaylist.length; i++) {
						var item = this.homePlaylist[i];
						var dt_pre  = new Date(item["date"]);
						var dt_this = new Date(item["date"]);
						
						
						if (item["pos"] == windowId) {
							if (dt_this <= servertime) {
								switch (windowId) {
									case "a": windowA = item; break;
									case "b": windowB = item; break;
									case "c": windowC = item; break;
									default:break;
								}
							}
						}
					} // END pick loop
					
					switch (windowId) {
						case "a": thisWindow = windowA; this.windowA = windowA; break;
						case "b": thisWindow = windowB; this.windowB = windowB; break;
						case "c": thisWindow = windowC; this.windowC = windowC; break;
						default:break;
					}	
					
					// Update matching window elements
					if (!disableHtml) {
						var windowImage    = "window"+windowId;
						var windowHeadline = "headline"+windowId;
						var windowSummary  = "summary"+windowId;
						
						$(windowImage).src                = siteUrl+"/images_1460thefan/homepage/"+thisWindow["image"];
						$(windowImage).parentNode.href    = thisWindow["link"];
						$(windowHeadline).innerHTML       = thisWindow["headline"];
						$(windowHeadline).parentNode.href = thisWindow["link"];
						$(windowSummary).innerHTML        = thisWindow["summary"];
					}
				}
		},
		
		// Updates show topics
		
		updateHomeTopics:function() {
			/*
			for (i=0; i < this.showTopics.length; i++) {
				var item     = this.showTopics[i];
				var dt_item  = new Date(item["date"]);
				var timeCopy = new Date(serverTime);
				var dt_now   = new Date(timeCopy.format("M/d/y")+" 00:00")+"_";
				var dt_check = new Date(dt_item.format("M/d/y")+" 00:00")+"_";
			
				if (dt_now == dt_check) {
					$(item["pos"]).innerHTML = item["summary"];
				}
			}
			*/
		},
		
		
		// Updates on now elements
		updateHomeOnNow:function() {
			/* Home page on now*/
			a_fmnow  = wrapUtil.psGetFmNow();
		
			$("nowtext").innerHTML       = a_fmnow["text"];
			if (a_fmnow["link"]) { $("nowtext").parentNode.href = a_fmnow["link"]; }
		
			// Display top image
			$("listen").src = siteUrl+"/images_1460thefan/homepage/"+a_fmnow["image"];
		}
	} // END homepageUtil






