function addDOMLoadEvent(func) { if (!window.__load_events) { var init = function () { if (arguments.callee.done) return; arguments.callee.done = true; if (window.__load_timer) { clearInterval(window.__load_timer); window.__load_timer = null; } for (var i=0;i < window.__load_events.length;i++) { window.__load_events[i](); } window.__load_events = null; }; if (document.addEventListener) { document.addEventListener('DOMContentLoaded', init, false); } if (/WebKit/i.test(navigator.userAgent)) { window.__load_timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { init(); } }, 10); } window.onload = init; window.__load_events = []; } window.__load_events.push(func); }

var goudy = { src:'http://static.acponline.org.s3.amazonaws.com/swf/goudy.swf' };
// var goudy = { src:'/swf/goudy.swf' };
var goudy_bold = { src:'http://static.acponline.org.s3.amazonaws.com/swf/goudy_bold.swf' };
// var goudy_bold = { src:'/swf/goudy_bold.swf' };
var goudy_italic = { src:'http://static.acponline.org.s3.amazonaws.com/swf/goudy_italic.swf' };
// var goudy_italic = { src:'/swf/goudy_italic.swf' };

sIFR.activate(goudy, goudy_bold, goudy_italic);

sIFR.replace(goudy_italic, {
    selector: 'h3',
    css: [
        '.sIFR-root { color:#00675a; font-size:32px; letter-spacing:1; }',
        '.sIFR-root sup { display: inline; font-size:50px; vertical-align: 100%; }'
    ]
});

sIFR.replace(goudy, {
    selector: '.image_feature h4',
    css: [
        '.sIFR-root { color:#00344d; font-size:24px; }'
    ]
});

sIFR.replace(goudy, {
    selector: '#sub h4',
    css: [
        '.sIFR-root { color:#012638; font-size:18px; font-weight:bold; }'
    ],
    wmode: 'transparent'
});

sIFR.replace(goudy_bold, {
    selector: '#main h4',
    css: [
        '.sIFR-root { color:#00675a; font-size:20px; }'
    ]
});

sIFR.replace(goudy, {
    selector: '.heading_more',
    css: [
        '.sIFR-root { color:#00675a; font-size:16px; font-weight:normal; }'
    ]
});

sIFR.replace(goudy, {
    selector: '.practice_head',
    css: [
        '.sIFR-root { color:#00675a; font-size:18px; font-weight:normal; leading:5px; }'
    ]
});

function emailPage() {
	window.open('/shell-cgi/email.pl' + document.location.pathname ,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); 
}

function pop(link, width, height) {
    var photoWindow = window.open(link, 'photo', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width='+width+',height='+height);
    if (window.focus) { photoWindow.focus() }
}

addDOMLoadEvent(function() {
    if (!document.getElementById) return;
    if (!document.getElementById('tools')) return;
    
    var li = document.createElement('li');
    li.className = 'printTool';
    
    var a = document.createElement('a');
    li.appendChild(a);
    a.href = '#';
    a.onclick = function() { window.print(); return false; }
    a.appendChild(document.createTextNode('Print Page'));
    
    var tools = document.getElementById('tools');
    tools.insertBefore(li, tools.firstChild);

    if (location.hostname == 'wwwdev.acponline.org') {
        v_url = '<br /><ul><li><a href="http://ipdev.acponline.org/cgi-bin/checkhtml?url=';
        v_url += location.href;	
        v_url += '" target="validate">Validate XHTML</a></li>'
        v_url += '<li><a href="http://ipdev.acponline.org/cgi-bin/checklinks?show=bad&url='
        v_url += location.href;
        v_url += '" target="validate">Check Links</a></li>'
        v_url += '<li><a href="http://ipdev.acponline.org/cgi-bin/reptnav.pl" target="validate">Report Template Error</a></li>';
        v_url += '<li><a href="http://ipdev.acponline.org/cgi-bin/upload?path=';
        v_url += location.href;
	v_url += '" target="validate">Upload Page</a></li>';	
        v_url += '</ul>'
        document.getElementById('subnav').innerHTML += v_url
    }
});

addDOMLoadEvent(function() {
    if (!document.getElementById) return;

    var host = 'http://static.acponline.org.s3.amazonaws.com/';
    var dir = 'i/home_img/';
    var imgs = new Array('1', '2', '3', '4', '5');
    var now = new Date();
    var seed = now.getSeconds();
    var rand = Math.random(seed);
    var range = rand * imgs.length;
    var round = Math.round(range);
    if (round == imgs.length) round = 0;
    var img = host + dir + imgs[round] + '.png';

    if (document.getElementById('ie')) {
        var ie = document.getElementById('ie');
        ie.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + img + ')';
    }

    if (document.getElementById('ff')) {
        var ff = document.getElementById('ff');
        ff.style.background = 'url(' + img + ') no-repeat';
    }
});

