// JavaScript Document



function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0

  if(window.screen)if(isCenter)if(isCenter=="true"){

    var myLeft = (screen.width-myWidth)/2;

    var myTop = (screen.height-myHeight)/2;

    features+=(features!='')?',':'';

    features+=',left='+myLeft+',top='+myTop;

  }

  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);

}



function MM_jumpMenuGo(selName,targ,restore){ //v3.0

  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

// ***************************************************

//  	BEGIN WEEKEND NEWS RELATED JAVASCRIPT 

//		MHW Time Based Reveal Script v0.4

//  	Contact:  Malte Wendlandt for help

//    For Detailed Information see the wiki at https://wiki.nm.cbc.ca/nm/MHW_Time_Based_Reveal_Script_%28mTBRS%29

// ***************************************************



function revealItem (revealThis, revealStart, revealEnd, currentTime) {   



	var longDays = new Array(

		'sunday',

		'monday',

		'tuesday',

		'wednesday',

		'thursday',

		'friday',

		'saturday'

	);

	

	revealStart 	= revealStart.split(', ');

	revealEnd 		= revealEnd.split(', ');

	currentTime		= currentTime.split(', ');





	

	var thisDayStr = currentTime[0].toLowerCase();

	var thisHour 	= eval(currentTime[1]);



	for ( var counter = 0; counter < longDays.length; counter++ ) {

		if ( longDays[counter] == thisDayStr ) {

			thisDay = counter;	

		}

	}





	if ( thisHour <= 0) {		//  Adjust Day and Time for those instances when the timezone adjustment sets the hour below the valid range of 1 - 24

		thisHour = thisHour + 24;

		thisDay = thisDay - 1;

		if ( thisDay < 0 ) {

			thisDay = 6;	

		}

		thisDayStr = longDays[thisDay];

	}





	if ( thisHour > 24) {		//  Adjust Day and Time for those instances when the timezone adjustment sets the hour above the valid range of 1 - 24

		thisHour = thisHour - 24;

		thisDay = thisDay + 1;

		if ( thisDay > 6 ) {

			thisDay = 0;	

		}

		thisDayStr = longDays[thisDay];

	}



	for ( var counter = 0; counter <= 6; counter++ ){		//	Find the numeric value of the Start and End days



		if ( revealStart[0].toLowerCase() == longDays[counter] ) {

			revealStart[2] = counter;

		} else if ( revealEnd[0].toLowerCase() == longDays[counter] ) {

			revealEnd[2] = counter;

		}	



	}



	if ( thisHour >= revealStart[1] && longDays[thisDay] == revealStart[0].toLowerCase() ) {

		document.getElementById(revealThis).style.display = 'block';

	}





	if ( thisHour < revealEnd[1] && longDays[thisDay] == revealEnd[0].toLowerCase() ) {

		document.getElementById(revealThis).style.display = 'block';

	}



	if ( revealStart[2] < revealEnd[2] ) {			//	The Start Day is before the End Day in the sequence sun - sat



		if ( (thisDay > revealStart[2]) && (thisDay < revealEnd[2]) ) {

				document.getElementById(revealThis).style.display = 'block';

		} 

	

	} else if ( revealStart[2] > revealEnd[2] ) {		//	The End Day is before the Start Day, ie next week.



		if ( thisDay > revealStart[2] && thisDay <= 6 ) {

				document.getElementById(revealThis).style.display = 'block';

		} else if ( thisDay >= 0 && thisDay < revealEnd[2] ) {

				document.getElementById(revealThis).style.display = 'block';

		}

	

	}



}



//  END WEEKEND NEWS RELATED JAVASCRIPT 



<!--//--><![CDATA[//><!--



sfHover = function() {

//	var menuClasses = new Array('topmenu', 'regionalMenu');		//  Might as well make it flexible enough to deal with other menus too

	var menuClasses = new Array('regionalMenu');		//  Might as well make it flexible enough to deal with other menus too

	for (var j=0; j<menuClasses.length; j++) {



		if(sfEls = document.getElementById(menuClasses[j]).getElementsByTagName("LI")){		//	Make sure the menu exists before trying to fiddle with it



			for (var i=0; i<sfEls.length; i++) {

				sfEls[i].onmouseover=function() {

					this.className+=" hover";

				}

				sfEls[i].onmouseout=function() {

					this.className=this.className.replace(new RegExp(" hover\\b"), "");

				}

			}



		}



	}

}





function addEvent(elm, evType, fn, useCapture) {

	if (elm.addEventListener) {

		elm.addEventListener(evType, fn, useCapture);

		return true;

	}

	else if (elm.attachEvent) {

		var r = elm.attachEvent('on' + evType, fn);

		return r;

	}

	else {

		elm['on' + evType] = fn;

	}

}



cPage = function () {



	var region = 'calgary';

	var path = window.location.pathname;



	if ((path.indexOf('features') > 0) || path.indexOf('cgi-bin') > 0)  {

		element = document.getElementById('features');

	} else

	if (path.indexOf('programs') > 0)  {

		element = document.getElementById('programs');

	} else

	if (path.indexOf('community') > 0) {

		element = document.getElementById('community');

	} else 

	if (path.indexOf('story') > 0) {

		element = null;

	} else 

	if (path.indexOf('weather') > 0)  {

		element = document.getElementById('weather');

	} else 

	if (path.indexOf('audio') > 0)  {

		element = document.getElementById('audio');

	} else

	if (path.indexOf('contact') > 0)  {

		element = document.getElementById('contact');

	} else 

	

	if (path == '/' + region + '/' || path == '/' + region + '/index.html')  {

		element = document.getElementById('main');

	} else { 

			element = document.getElementById('programs');

	}

	if(element) {
	element.childNodes[0].style.color = "#E7D603";

	}

}



addEvent(window,'load',cPage,false);

if (window.attachEvent) window.attachEvent("onload", sfHover);


// ***************************************************

//  	Experiment to turn on ads for all Calgary pages

// ***************************************************



// <![CDATA[
		advertising_zone = 'calgary';
// ]]>




//--><!]]>
