var results_data = function() { 
this.compareCount= 0;
this.tickerList = [];

}




results_data.prototype.addTicker = function(ticker,elm){
   var el = Element.get(elm);
  
     var index = -1;   
    for (i = 0; i< this.tickerList.length; i++){
        if (this.tickerList[i] == ticker)
            index = i;
    }   
   
    if ( index == -1)
    {
	
        this.tickerList.push(ticker);
	el.innerHTML = '<img src="../../common/img/backgrounds/checked.png" onclick="results.addTicker(\''+ticker+'\',\''+elm+'\');" >';
     	  
    }
    if (index != -1)
    {
        this.tickerList.splice(index,1);
	el.innerHTML = '<img src="../../common/img/backgrounds/unchecked.png" onclick="results.addTicker(\''+ticker+'\',\''+elm+'\');" >';
    }

   if (this.tickerList.length > 1 && this.tickerList.length < 6)
   {
        
        
            Element.setStyle('compareButton','background: url(../../common/img/screeners/buttonbg.png) bottom; color: #605a45; ');
            var myEvent = Events.add(Element.get('compareButton'),'click',function() { document.location.href = "../compare/summary.asp?funds="+results.tickerList.join(','); }
            );
        
       
    }
    else
    {
        Element.setStyle('compareButton','background: url(../../common/img/screeners/buttonbgBW.png) bottom; cursor: pointer; color: #c8c8c8;');
        Events.remove(Element.get('compareButton'));
    }
            

}


   
results = new results_data();

