$(document).ready(function(){
    $.ifixpng('/images/spacer.gif');
    $('.entr, .inv, .partn, .ditem a').ifixpng();
    $('img[@src$=.png]').ifixpng();

    $("a[@rel$='external']").click(function(){
        this.target = "_blank";
    });
});

function checkAllCheckboxes(form, namePrefix, checkAll) {
    if(typeof checkAll == "undefined") checkAll = true;

    for (i = 0; i < form.elements.length; i++) {
        e = form.elements[i];

        if(e.name.slice(0, namePrefix.length) == namePrefix) {
            e.checked = checkAll;
        }
    }
}

jQuery.fn.extend({
    check: function() {
        return this.each(function() { this.checked = true; });
    },
    uncheck: function() {
        return this.each(function() { this.checked = false; });
    }
});

function submitFrm(form_id, btn) {
//    btn.value = 'Please wait..';
    btn.disabled = true;

    frm = document.getElementById(form_id);
    var el = document.createElement('input');
    el.type = 'hidden';
    el.name = btn.name;
    el.value = 1;
    frm.appendChild(el);
    frm.submit();

    return false;
}

Array.prototype.find = function (obj) {
    var i;
    for (var i=0; i < this.length; i++) {
        if (this[i] == obj) {
            return true;
        }
    }
    return false;
}

var Cookie = {
    set : function(name, val, expdays) { expdays = expdays||180
        var dat = new Date(); dat.setTime( dat.getTime()+(expdays*24*60*60*1000) )
        document.cookie = name + "=" + val + "; expires=" + dat.toGMTString() + "; domain=."+location.host+"; path=/"
    },
    get : function(name) {
        var ca = document.cookie.split(';'),i,c; name += '='
        for (i=0; i < ca.length; i++) {
            c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length)
            if (c.indexOf(name) == 0) return c.substring(name.length,c.length)
        }
        return ''
    },
    del : function(name) {
        if (this.get(name)) {
            document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"
        }
}}

