﻿function AddEvent( obj, type, fn ) 
{
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}

function initWeatherSlideshow() {
	var container = document.getElementById("WorldClockAndWeather");
    container.style.display = "block";
	container.parentNode.parentNode.align = "left";

    var tableListParent = document.getElementById("ctl00_wcw_g_fd500c44_178e_491b_bfcc_bc05faafd087");

	var children = tableListParent.childNodes;
	var slidesTable;
	for (var i=0, n=children.length; i<n; i++) {
		if (children[i].tagName == "TABLE") {
			slidesTable = children[i];
			break;
		}
	}
	if (slidesTable) {
		var slides = slidesTable.rows[0].cells;
		for (var i=1, n=slides.length; i<n; i++) {
			slides[i].style.display = "none";
		}
		
		// slidesTable.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=0.5)";

		//AddEvent(slidesTable, 'click', gotoWeatherPage);
		
		StartSlideShow(slidesTable, slides, 2000, HidePrevShowCurrSlide);
	}
}
AddEvent(window, 'load', initWeatherSlideshow);

function gotoWeatherPage() {
	location.pathname = "/AboutNiagara/Pages/WeatherClimate.aspx";
}
