﻿//<![CDATA[

//if (top.location.href != self.location.href)
  //top.location.href = self.location.href;

function getWidth(){
    var myWidth = 0;
    if (self.innerHeight){
        //Firefox
        if (document.getElementById('content').offsetHeight > document.documentElement.clientHeight){
            myWidth = self.innerWidth - 16;
        }
        else{
            myWidth = self.innerWidth ;
        }
    }
    else if (document.documentElement && document.documentElement.clientHeight){
        //IE
        myWidth = document.documentElement.clientWidth;
    }
    else if (document.body){
        if (document.getElementById('content').offsetHeight > document.documentElement.clientHeight){
             myWidth = document.body.clientWidth - 16;
        }
        else{
             myWidth = document.body.clientWidth;
        }
    }
    return myWidth
}
function showMainLoading(strLoading) {
    document.getElementById('bgLoading').style.left = (getWidth() - 990) / 2 + 'px'
    if (strLoading != null){
        document.getElementById('textLoading').innerHTML = strLoading;
    }
}
function showUploadLoading(strLoading) {
    document.getElementById('textLoading').innerHTML = strLoading;
    document.getElementById('bgLoading').style.display = 'inline';
}

function ddPositionChange(objId, index){
    var myArr = new Array();
    var myArr = objId.split("_");
    var splitId = "";
    
    for ( i = 0; i < myArr.length - 1; i++) {
        splitId += myArr[i] + "_";
    }

    if (index == 5){
        document.getElementById(splitId + 'shootsCatches').innerHTML = 'Mitaine'
    }
    else{
        document.getElementById(splitId + 'shootsCatches').innerHTML = 'Tir'
    }
}

function changeTextboxFocus(obj, nextObj){
    if (obj.value.length == 3){
        var objToFocus = obj.id.substring(0,obj.id.length-1) + nextObj
        document.getElementById(objToFocus).focus();
    }
}

function ChangeCalendarView(sender,args)
{
   sender._switchMode("years", true);           
}

var lastColorUsed; 
function tlgDg_changeBackColor(row, highlight, bgColor)
{
  if (highlight)
  {
    lastColorUsed = row.style.backgroundColor;
    row.style.backgroundColor = bgColor;
  }
  else
    row.style.backgroundColor = lastColorUsed;
}

function clickButton(e, buttonid){

      var evt = e ? e : window.event;

      var bt = document.getElementById(buttonid);

      if (bt){

          if (evt.keyCode == 13){

                bt.click();

                return false;

          }

      }

}

function showHideSection(id)
{
    switch(id)
    {
        case "sectionNewTeam":
            document.getElementById("sectionTeam").style.display = "none";
            document.getElementById("sectionPlayer").style.display = "none";
            break;
        case "sectionTeam":
            document.getElementById("sectionTeam").style.display = "inline";
            document.getElementById("sectionPlayer").style.display = "none";
            break;
        case "sectionPlayer":
            document.getElementById("sectionTeam").style.display = "none";
            document.getElementById("sectionPlayer").style.display = "inline";
            break;
    }
}

//]]>
