﻿////////////////    chooseCountry Selection ///////////////////
var currentDDL;


function displayDefaultMap()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 0';
    $('.locationList').hide();    
}

function displayAS()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -204px';
    $('.locationList').hide();
}

function displaySA()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -408px';
    $('.locationList').hide();
}

function displayOC()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -612px';
    $('.locationList').hide();
}

function displayNA()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -816px';
    $('.locationList').hide();
}


function displayEU()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -1020px';
    $('.locationList').hide();
    
          
}

function displayME()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -1224px';
    $('.locationList').hide();
}

function displayAF()
{
    var mapWord = document.getElementById(divWorldMap);
    mapWord.style.backgroundPosition = '0 -1428px';
    $('.locationList').hide();
}

// print a menu relative to the image
function printLocationMenu(parent,idMenu,topOffSet, leftOffset)
{    
   var menu = document.getElementById(idMenu);
   var top = parent.offsetParent.offsetTop + parent.offsetTop + topOffSet;
   menu.style.top = top + "px";
   var left = parent.offsetLeft + leftOffset;
   menu.style.left = left + "px";
   printElem(idMenu);

}


function DDListCountry_ShowCountry(elem)
{
        
    DDListCountry_HideAllCountry();
    currentDDL = null;
    
    switch (elem.options[elem.selectedIndex].value)
    {
        case "EU":
            currentDDL = document.getElementById(divddListEU);
            break;
        case "NA":
            currentDDL = document.getElementById(divddListNA);
            break;
        case "SA":
            currentDDL = document.getElementById(divddListSA);
            break;
        case "AS":
            currentDDL = document.getElementById(divddListAS);
            break;
        case "AF":
            currentDDL = document.getElementById(divddListAF);
            break;
        case "OC":
            currentDDL = document.getElementById(divddListOC);
            break;
        case "ME":
            currentDDL = document.getElementById(divddListME);
            break;
    }
    if (currentDDL !=null)
        currentDDL.style.display = "inline";
}

function DDListCountry_HideAllCountry()
{
    document.getElementById(divddListEU).style.display = "none";
    document.getElementById(divddListNA).style.display = "none";
    document.getElementById(divddListSA).style.display = "none";
    document.getElementById(divddListAF).style.display = "none";
    document.getElementById(divddListAS).style.display = "none";
    document.getElementById(divddListOC).style.display = "none";
    document.getElementById(divddListME).style.display = "none";
}

function updateChosenCountry(elem) {

    $('.chosenCountry').hide();
    $('.chosenCountry').html(elem.innerHTML);
    $('.chosenCountry').STshow("slow");

    document.getElementById(hiddenChosenCountryID).value = elem.innerHTML;
    
    if ($('.chosenSport').html() != '')
        $('.goTribeArea').STshow("slow");

}

$(document).ready(function () {
    $('.linkCountry').hover(function () {
        $(this).css('cursor', 'pointer');
        $(this).css('text-decoration', 'underline');
        $(this).css('background-color', '#CCCCCC');
    }, function () {
        $(this).css('cursor', 'auto');
        $(this).css('text-decoration', 'none');
        $(this).css('background-color', '#FFF');
    });

    $('.linkCountry').click(function () {
        updateChosenCountry(this);
    });
});


