// JavaScript Document
function newsJSCollection(){
  this.a = null;
  this.aa = new Object();
  this.astr='';
  this.firstPass=true;
  this.init=function(){
    this.astr=location.protocol+'//'+location.hostname;
    //alert(location.protocol+'//'+location.hostname);
    this.a = document.getElementsByTagName('a');  
  },
  this.add=function(k,v){
    this.aa[k]=v;
  },
  this.makeIcon=function(o,sa){
    if(typeof(this.aa[sa])!='string')return false;
    var txt=this.aa[sa];
    var a=new Obj('img',{src:'/img/new.gif',alt:txt,title:txt,cursor:'help'});
    a.getIn(document.body);
    this.aa[sa]=a;
    this.placeIcon(o,sa);
  },
  this.placeIcon=function(o,sa){
    if(typeof(this.aa[sa])!='object')return false;
    var xyp=new xyPos(o);
    var a=this.aa[sa].ob;
    a.style.position='absolute';
    a.style.left=(xyp.x-2)+'px';
    a.style.top=(xyp.y-16)+'px';
    a.src='/img/new-24x24.png';
    if(xyp.h<10){
      a.style.height='12px';
      a.style.left=(xyp.x-5)+'px';
      a.style.top=(xyp.y-10)+'px';
      a.src='/img/new-12x12.png';
    }  
    else if(xyp.h<20){
      a.src='/img/new-24x24.png';
      a.style.left=(xyp.x-2)+'px';
      a.style.top=(xyp.y-16)+'px';
    }  
  },
  this.addResizeEvent=function(func){
    var oldonresize=window.onresize;
    if(typeof(window.onresize)!='function'){
      window.onresize=func;
    }else{
      window.onresize=function(){
        if(oldonresize){
          oldonresize();
        };
        func();
      }
    }
  },
  this.render=function(){
    var x=0;
    var lpa=location.pathname;
    this.a = document.getElementsByTagName('A');
    if(!this.a)return false;
    for(var i=0;i<this.a.length;i++){
      if(this.a[i].href){
        var sa=this.a[i].href;
        sa=sa.replace(this.astr,'');
        if(sa!=lpa){
          if(this.aa[sa]){
            if(typeof(this.aa[sa])=='string')
              this.makeIcon(this.a[i],sa);
            else if(typeof(this.aa[sa])=='object')
              this.placeIcon(this.a[i],sa);
          }
        }  
      }
    }
    var that=this;
    if(this.firstPass)this.addResizeEvent(function(){that.render();});
    this.firstPass=false;  
  }
  this.init();
}