Array.prototype.contains = function(val) {
  for (var x=0;x<this.length;x++) {
    if (this[x] == val) return true;
  }
  return false;
}
function PopUp(sURL, sWindowName) {
    var nWidth = 640;
    var nHeight = 500;
    openWin = window.open(sURL,sWindowName,"height=" + nHeight + ",width=" + nWidth + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0,top=100,left=100");
        if (openWin.opener == null){
            openWin.opener = self;
            openWin.focus();
        }
}
function InitAnalyticsFileTracking() {
    var regex = /\.pdf$/i;
    
    $("#content-wrapper a").each(function(idx) {
        var href = $(this).attr('href');

        if (regex.test(href) && (href.indexOf('http://' + location.hostname) == 0 || href.indexOf('http://') == -1)) {
            $(this).click(function() {
                //alert('Track PDF -- ' + $(this).attr('href'));
                pageTracker._trackPageview($(this).attr('href'));
            });
        };
    }); 
}
$(document).ready(function() {
    InitAnalyticsFileTracking();
    $("a.pdf,a.new-window").each(function() {
        $(this).click(function() {
            window.open(this.href);
            return false;
        });
    });

    $("form#search a.submit").click(function() {
        $("form#search").submit();
    });
});
