var has_research = true; var balloon_intv = null; var balloon_wait = 250; var balloon_node = null; var balloon_chkNode = null; function init_research() { var tables = document.getElementsByTagName("TABLE"); var i, len = tables.length; var tags, x, xlen; var y, ylen; var init_balloon = false, sort_columns; // apply onclick event to pdf links and mouseover events to 'report' // links for balloon popup text tags = document.getElementsByTagName("A"); xlen = tags.length; for (x = 0; x < xlen; x++) if ( tags[x].getAttribute("href").indexOf("pdf_download.php") > -1 ) tags[x].onclick = click_research; // do not sort columns on "/research/index.php" sort_columns = Boolean( has_research || ( /research[\/]?/i.test(location.href) || /research\/index\.php$/i.test(location.href) )); // apply mouse over effects to research tables for (i = 0; i < len; i++) { if ( tables[i].className.indexOf("research") > -1 ) { if ( !init_balloon ) { // if there is a 'research' table, we should have "balloon text" to show initialize_balloon_text(); init_balloon = true; } // do not sort columns on "/research/index.php" if ( !sort_columns ) return; tags = document.getElementsByTagName("TR"); // all rows in the table xlen = tags.length; for (x = 0; x < xlen; x++) { if ( tags[x].className.indexOf("header") > -1 ) { ylen = tags[x].childNodes.length; for (y = 0; y < ylen; y++) { if ( tags[x].childNodes[y].nodeType == 1 // looking for the "TH" tags && tags[x].childNodes[y].className.indexOf("headercol_inactive") == -1 ) { if ( isDOM ) { tags[x].childNodes[y].addEventListener("mouseover", headercol_over, false); tags[x].childNodes[y].addEventListener("mouseout", headercol_out, false); tags[x].childNodes[y].addEventListener("click", headercol_click, false); } else { tags[x].childNodes[y].attachEvent("onmouseover", headercol_over); tags[x].childNodes[y].attachEvent("onmouseout", headercol_out); tags[x].childNodes[y].attachEvent("onclick", headercol_click); } } } } } } } } function click_research(e) { window.open(this.getAttribute("href"), "_blank"); return( false ); } function headercol_over(e) { var target; e = getCommonEvent(e || event); target = e.target; if ( target.tagName == "A" ) target = e.target.parentNode; target.className = target.className.replace(/headercol/, "headercol_over"); } function headercol_out(e) { var target; e = getCommonEvent(e || event); target = e.target; if ( target.tagName == "A" ) target = e.target.parentNode; target.className = target.className.replace(/headercol_over/, "headercol"); } function headercol_click(e) { var target, index = 0; e = getCommonEvent(e || event); target = e.target; if ( target.tagName == "A" ) target = e.target.parentNode; while ( target.childNodes[index].nodeType != 1 ) // looking for the anchor inside the 'TR.Header TH' index += 1; target.childNodes[index].onclick = function() { return( false ); } location.href = target.childNodes[index].href; } function initialize_balloon_text() { var tags = document.getElementsByTagName("A"); var i, len = tags.length; for (i = 0; i < len; i++) { if ( tags[i].className.indexOf("report") > -1 ) { if ( isDOM ) { tags[i].addEventListener("mouseover", load_balloon_text, false); tags[i].addEventListener("mouseout", clear_balloon_text, false); } else { tags[i].attachEvent("onmouseover", load_balloon_text); tags[i].attachEvent("onmouseout", clear_balloon_text); } } } } function clear_balloon_text(e) { hide_balloon_text(); balloon_chkNode = null; } function load_balloon_text(e) { hide_balloon_text(); e = getCommonEvent(e || event); balloon_chkNode = e.target; balloon_intv = setTimeout(show_balloon_text, balloon_wait); } function show_balloon_text() { if ( balloon_chkNode != null ) { if ( balloon_node ) hide_balloon_text(); if ( ( balloon_node = document.getElementById( "balloon_"+ balloon_chkNode.getAttribute("id") ) ) ) { var info = getNodeInfo(balloon_chkNode); balloon_node.style.top = (info.y - 70) +"px"; //(info.y - 200) +"px"; balloon_node.style.left = balloon_chkNode.offsetWidth - 10 +"px"; // 10px right padding from the end balloon_node.style.display = "block"; } balloon_chkNode = null; } if ( balloon_intv ) { clearTimeout( balloon_intv ); balloon_intv = null; } } function hide_balloon_text() { if ( balloon_node != null ) { balloon_node.style.display = "none"; balloon_node = null; } clearTimeout( balloon_intv ); balloon_intv = null; } if ( isDOM ) window.addEventListener("load", init_research, false); else window.attachEvent("onload", init_research);