window.onload = function () {
	//	initialize the fontSizer code
	dw_fontSizerDX.setDefaults('px', 12, 8, 24, ['div#content *']);
	dw_fontSizerDX.set(10, 8, 24, ['div#footer *']);
	dw_fontSizerDX.init();

	var leftNav = document.getElementById('navigation');
	for (var i = 0; i < leftNav.getElementsByTagName('a').length; i++) {
		if (window.location == leftNav.getElementsByTagName('a')[i].href && leftNav.getElementsByTagName('a')[i].parentNode.className.indexOf('sublink') != -1) {
			var linkText = leftNav.getElementsByTagName('a')[i].innerHTML;
			var parentLI = leftNav.getElementsByTagName('a')[i].parentNode;
			var txtNode = document.createTextNode(linkText);
			parentLI.replaceChild(txtNode, leftNav.getElementsByTagName('a')[i]);
			setStyle(parentLI, 'font-weight: bold; color: black;');
			break;
		}
	}
}

function isCrappIE() {
//	determines if browser is Internet Explorer
	if (navigator.appName.substring(0,4) == "Micr")
		return true;
	else
		return false;
}
function setStyle(elem, styleText) {
//	IE bug/workaround #2
//	you cannot set the style attribute of an element with setAttribute('style','STYLE_ELEMENTS')
//	as you can in all standards-based browsers
	if (isCrappIE())
		elem.style.setAttribute('cssText',styleText, 0);
	else
		elem.setAttribute('style',styleText);
}

function changeGraphic(e) {
	//	find # before '.gif'
	
	if (e.tagName == 'DIV') {
		
		if( e.id.indexOf('1') == -1 )
			e.id = e.id + "1";
		else
			e.id = e.id.replace("1", "");
	}
	else {
		dotGif = e.src.indexOf('.gif');

		if (e.src.substr(dotGif-1,1) == '1')
			e.src = e.src.replace('1.gif', '0.gif');
		else
			e.src = e.src.replace('0.gif', '1.gif');
	}
}

function openAedTVPlayer(contentID, parentCategoryID, categoryID) {
    var mainPage = "Frames.aspx";
    var urlParams = "?";
    var windowParams = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=700,height=580";
    if (contentID != null) {
        urlParams += "&contentID=" + contentID;
    }
    if (parentCategoryID != null) {
        urlParams += "&parentCategoryID=" + parentCategoryID;
    }
    if (categoryID != null) {
        urlParams += "&categoryID=" + categoryID;
    }
    // Open the window.
    window.open("http://www.jetstreammedia.com/aedtv/Viewer/" + mainPage + urlParams, "aedtv", windowParams);
}