// JavaScript Document


 function atr(id)
    {
       
        //var expD = "league_list_" + id;
        var tempAr = id.split("_");
        var expD = "league_list_" + tempAr[1];
        var atrD = $(expD).getAttribute("visible");
       
	
        if(atrD == "1")
        {
            $(expD).style.display = "none";
            $(expD).setAttribute("visible",null);
			           
        }else{
           
            $(expD).style.display = "block";
            $(expD).setAttribute("visible","1");
        
        }
    }
    


 function getSelected(opt) 
	 {
		 
				var selected = new Array();
				var index = 0;
				
		
				
				if(opt.length == undefined)
				{
					selected[0] = new Object();
					selected[0].value = opt.value;
					selected[0].index = 1;
					
				}else{
				
					for (var intLoop = 0; intLoop < opt.length; intLoop++) 
					{
						
					   if (opt[intLoop].checked) 
					   {
						 index = selected.length;
						 selected[index] = new Object();
						 selected[index].value = opt[intLoop].value;
						 selected[index].index = intLoop;
					   }
					   
					}
				
				}
				
				return selected;
	 }


   var gameList = new Array();

   function os(opt,langID) 
   {
		          
              var leagueID = opt.id.split("_");
              var lid = leagueID[0];
              var ld = "";
              $('loadPriceImage').show();
              
              if(gameList.length==0)
              {
                gameList.push(lid);
                ld = "sp/load_odds.aspx?lang="+langID + "&lid="+lid;
			    
				//alert('I m getter');
                getPrice(ld);
                
              }else{
              
                      if(arFinder(gameList,lid)==true)
                      {
                       
                        //gameList.pop(lid);
                        gameList.remove(lid);
                        delleagues(lid);
                        $('loadPriceImage').hide();
                           
                      }else{
                            
                        gameList.push(lid);
                        ld = "sp/load_odds.aspx?lang="+langID + "&lid="+lid;
				        //ajx2(ld,'2');
                        getPrice(ld);

                    }


        
              
              }
              
              if(gameList.length==0)
              {
                    $("content").show();
                
              }else{
              
                    $("content").hide();
              }
              
          
               
    }
    
  // Next games  function   
  function nextgames(lid,langID) 
   {
		          
             // var leagueID = opt.id.split("_");
             // var lid = leagueID[0];
              var ld = "";
              
              $('loadPriceImage').show();
              
              if(gameList.length==0)
              {
                gameList.push(lid);
                ld = "sp/load_odds.aspx?lang="+langID + "&lid="+lid;
			    
				//alert('I m getter');
                getPrice(ld);
                
              }else{
              
                      if(arFinder(gameList,lid)==true)
                      {
                       
                        gameList.remove(lid);
                        delleagues(lid);
                        $('loadPriceImage').hide();
                           
                      }else{
                            
                        gameList.push(lid);
                        ld = "sp/load_odds.aspx?lang="+langID + "&lid="+lid;
				        getPrice(ld);
				        
                      }
              
              }
              
              if(gameList.length==0)
              {
                    $("content").show();
                
              }else{
              
                    $("content").hide();
              }



          }



         
    	
    	
    Array.prototype.remove=function(s){
            for(i=0;i<this .length;i++){
            if(s==this[i]) this.splice(i, 1);
      }
    }

   
   
   
   
   
   function arFinder(ar,ob)
   {
        var isIn = false;
    
        for(var i=0; i<ar.length;i++)
        {
            if(ar[i]==ob)
            {
                isIn = true;
                
            }
        }
   
        return isIn;
   }
   
  
  Array.prototype.find = function(searchStr) {
  var returnArray = false;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
}

   
   	

function selectALL()
        {
    
            window.location = "coefs.aspx?id=all";
			
		}

function resetALL() 
{

			alert("now reseting");	
}
		

function sho(id,ob)
{

  var leagueTeamsID = "a" + id;
  var el = document.getElementById(leagueTeamsID);

  
  var atrb = el.getAttribute("visible");
        
        if(atrb == "1" )
        {
            el.style.display = "none";
            el.setAttribute("visible",null);
                        
        }else{
        
            el.style.display = "block";
            el.setAttribute("visible","1");
        
        }
  
}

// Left  menu atributes 

function ov(id)
{
	document.getElementById(id).className = "over";
}

function ov1(id)
{
	document.getElementById(id).className = "country";
}

 
		
