// JavaScript Document
var pdTimer=null;

function pdShow() {
	hideSelect();
	if (pdTimer!=null) {
		clearTimeout(pdTimer);
		pdTimer=null;
	}
	$('programming_flyout').style.display="block";
}

function pdActuallyHide() {
	$('programming_flyout').style.display="none";
}

function pdHide() {
	showSelect();
	if (pdTimer==null) {
		pdTimer=setTimeout(pdActuallyHide, 300);
	}
}

function pdFilter(filter) {	
	// Set the current states for the links
	allAs=$('pf_search').getElementsByTagName("a");
	if ( (typeof allAs=="object") || (typeof allAs=="function") ){
		for (i=0; i<allAs.length; i++) {
			thisA=$(allAs[i]);
			pNode=$(thisA.parentNode);
			if (thisA.hasClassName(filter)) {
				pNode.addClassName("current");
			} else {
				pNode.removeClassName("current");
			}
		}
	}
	
	// Show or hide the entries
	allLis=$('pf_list').getElementsByTagName("li");
	if ( (typeof allLis=="object") || (typeof allLis=="function") ) {
		for (i=0; i<allLis.length; i++) {
			if ($(allLis[i]).hasClassName(filter)) {
				$(allLis[i]).style.display="block";
			} else {
				$(allLis[i]).style.display="none";
			}
		}
	}
}

function initProgrammingDrop() {
	// Set the current states for the links
        allAs=$('pf_search');
	if (allAs) {
	allAs=$('pf_search').getElementsByTagName("a");
	if ( (typeof allAs=="object") || (typeof allAs=="function") ) {
		for (i=0; i<allAs.length; i++) {
			allAs[i].onclick=function() {
				pdFilter(this.className.toString());
				return false;
			}
		}
	}
	pdFilter("series");
	
	progLi=$('hn_programming');
	if (progLi) {
		allAs=progLi.getElementsByTagName("a");
		if ( (typeof allAs == "object") || (typeof allAs == "function") ) {
			if (allAs[0]) {
				allAs[0].onmouseover=pdShow;
				allAs[0].onmouseout=pdHide;
			}
		}
	}
	
	$('programming_flyout').onmouseover=pdShow;
	$('programming_flyout').onmouseout=pdHide;
	
	pdHide();
	}
}






/* programming drop ie6 select bug fix */
function hideSelect() {
	if(navigator.appVersion.match('MSIE 6.0')) {
		if(document.getElementById('releasesSelect')) {
			var hideSelect = document.getElementById('releasesSelect');
			hideSelect.style.visibility = 'hidden';
		}
	}
}

function showSelect() {
	if(document.getElementById('releasesSelect')) {
		var hideSelect = document.getElementById('releasesSelect');
		hideSelect.style.visibility = 'visible';
	}
}
