/* ============================================================
National Geographic Global Helpers JavaScript
* Created by Brian Talbot on 2008-08-05.
* Copyright (c) 2008 National Geographic. All rights reserved.

Notes:
================
* 2008-08-05 - Began list of global helpers
* 2008-08-07 - Added current Video Player Popups

In This File:
================
+addLoadEvent
+getElementsByClassName
+addClassName
+removeClassName
+popUp
+popUp_kvp (Kids Video Player)
+popUp_vp (Video Player)

============================================================ */

NGS.onload(function(){

if (document.getElementById("timeSpan")) {
	var timeInterval = setInterval(updateTime, 1000)
}

});

function updateTime() {
	var nowDate = new Date();
	var Hours = nowDate.getUTCHours();
	var Minutes = nowDate.getMinutes();
	var Seconds = nowDate.getSeconds();
	var amPm = "PM";
	
	Hours = Hours + 2;
	if (Hours > 24) { Hours = Hours - 24 }

	if (Hours < 0) {Hours = 24 - Hours}
	if (Hours < 12) {amPm = "AM"}
	
	Hours = Hours - (12 * (Hours > 12));
		
	if (Hours == 0) {Hours = 12}
	if (Minutes < 10) {Minutes = "0" + Minutes}
	if (Seconds < 10) {Seconds = "0" + Seconds}
			
	document.getElementById("timeSpan").innerHTML=Hours + ":" + Minutes + ":" + Seconds + " " + amPm;

}