function remapViralLinks(tryCnt) { if (null == vlm) { // initial construction may not complete in initVL prior to call to this function - in such // case, the reference to vlm will be null...remapping should still be done, but only after // allowing the browser a bit more time to create the vlm object. if ('undefined' == tryCnt) tryCnt = 0; // for first attempt, initialize counter tryCnt++; // increment counter if (9 < tryCnt) return; // abandon after 10th attempt setTimeout('remapViralLinks('+ tryCnt +');', 250); // try again after brief wait return; // exit immediately, since manager instance not yet created } var isIE6 = -1 != navigator.userAgent.indexOf('MSIE 6'); if (isIE6) { get(vlm.getVlTarget()).style.height = '1%'; // trigger has-layout for the idiot browser } } ; var vlm = null; // put into page-global scope // initialize and attach viral links to page function initVL() { // arguments: target, imgDir, rows, showAdvice, adviceType (, styles) var vlDiv = get('vlTarget'); vlm = new ViralLinkManager('','/view/images/viralLinking/',1,false,'inline'); remapViralLinks(); } ; // in case other onresize handling is required, add this to the list of handlers if(window.addEventListener) window.addEventListener('resize', remapViralLinks, false); else window.attachEvent('onresize', remapViralLinks); // in case other onload handling is required, add this to the list of handlers if(window.addEventListener) window.addEventListener('load', initVL, false); // for compliant (non-IE) browsers else window.attachEvent('onload', initVL); // for IE