// Fix PNG transparency
// Set class = fixpng for correct transparency in IE6
/* OLD
window.onload = function () {
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters))  {
        for(var i=0; i<document.images.length; i++) {
            if(document.images[i].className == 'fixpng') {
                var img = document.images[i];
                var imgName = img.src.toUpperCase();
                if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
                    var imgID = (img.id) ? "id='" + img.id + "' " : ""
                    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                    var imgStyle = "display:inline-block;" + img.style.cssText 
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle
                    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle
                    + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                    + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
                    img.outerHTML = strNewHTML
                    i = i-1
                }
            }
        }
    }
}
*/


var blank = new Image();
blank.src = '/images/spacer.gif';
 
$(document).ready(function() {

    // FIX PNG
    var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
    if (badBrowser) {
        // get all pngs on page
        $('img[src$=.png]').each(function() {
           if (!this.complete) {
              this.onload = function() {
                fixPng(this)
            };
           } else {
              fixPng(this);
           }
        });
    }
    
    // MODIFY LINKS
    // OPEN ALL EXTERNAL/DOC LINKS IN NEW WINDOW
    //$('a').attr("href:contains('/dyn/'").bind('click',function(e) {
    /*
    $("a[@href *= '/dyn/']").bind('click',function(e) {
        window.open(this.href);
        return false;
    });
    */
    $('a').each(function() {
        var href = $(this).attr('href');
        if(!href.match(/^\/dyn\//)) {
            $(this).bind('click',function(e) {
                window.open(href);
                return false;
            });
        }
    });
    
});
