﻿// JScript File
var CountryList;
var LanguageList;
function SaveRegionOptions(Country,Language)
{    
    Centix.Pages.KWXMaster.SetCountry(Country);
    Centix.Pages.KWXMaster.SetLanguage(Language);
    //ShowContent(1000);
    //document.forms[0].submit();
    createCookie("DefaultCountry",Country,999);
    createCookie("DefaultLanguage",Language,999);
    
    window.location.href = './content1000.aspx';
}

function SaveLanguageOptions(Language)
{    
    Centix.Pages.KWXMaster.SetLanguage(Language);
    createCookie("DefaultLanguage",Language,999);    
    window.location.href = './content1000.aspx';
}

function SelectDropDownValue(control,value)
{
    
    var List = control;    
    
    for (var i = 1; i < List.options.length; i = i + 1)
    {    
        if (List.options[i-1].value == value)
        {        
            List.selectedIndex =i-1;
            return;
        }
        
    }
}

function SetDefaultLanguage(control,Country)
{
    var result = Centix.Pages.KWXMaster.GetCountryDefaultLanguage(Country).value;
    
    SelectDropDownValue(control,result);    
}

function FillDropDown(Control, Values)
{
    var List = Control;
    List.options.length = 0;    
    for (var i = 0; i < Values.length; i = i + 2)
    {
        List.options[List.options.length] = new Option(Values[i+1], Values[i]);
    }
}

function SetCountryList(control,continent)
{   
    CountryList = control; 
    var values = Centix.Pages.KWXMaster.GetCountries(continent);
    FillDropDown(control, values.value);
}
function SetLanguageList(control)
{
    LanguageList = control; 
    var values = Centix.Pages.KWXMaster.GetLanguages();
    FillDropDown(control, values.value);
}
function SelectContinent(Continent)
{
    Centix.Pages.KWXMaster.SetContinent(Continent);
    SwapIn(0);    
    if (Continent == 2 ) { SwapIn(0);}
    if (Continent == 1 ) { SwapIn(1);}
    if (Continent == 3 ) { SwapIn(2);}
    if (Continent == 4 ) { SwapIn(3);}
    if (Continent == 5 ) { SwapIn(4);}
    if (Continent == 6 ) { SwapIn(5);}    
    SetCountryList(CountryList, Continent);
    
    SetDefaultLanguage(LanguageList,CountryList.options[CountryList.selectedIndex].value);
}

function SwapIn(imgNum)
		{
		document.getElementById('region_selector_0').style.fontWeight='normal';
		document.getElementById('region_selector_1').style.fontWeight='normal';
		document.getElementById('region_selector_2').style.fontWeight='normal';
		document.getElementById('region_selector_3').style.fontWeight='normal';
		document.getElementById('region_selector_4').style.fontWeight='normal';
		document.getElementById('region_selector_5').style.fontWeight='normal';
		document.getElementById('region_selector_6').style.fontWeight='normal';
		
		var Continent = Centix.Pages.KWXMaster.GetContinent().value.toString();
			var ImgArray = new Array(6);

            //var Continent = 1;
			if (Continent == 0)
			{
						    document.getElementById('region_selector_0').style.fontWeight='bold';
			}
			
				if (Continent == 2){
						    document.getElementById('region_selector_2').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/asia_selected_.gif';
					ImgArray[1] = './worldwide/images/asia_select_euro_roll_.gif';
					ImgArray[2] = './worldwide/images/asia_select_afr_roll_.gif';
					ImgArray[3] = './worldwide/images/asia_select_na_roll_.gif';
					ImgArray[4] = './worldwide/images/asia_select_sa_roll_.gif';
					ImgArray[5] = './worldwide/images/asia_select_aus_roll_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				if (Continent == 1){
				document.getElementById('region_selector_1').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/euro_select_asia_roll_.gif';
					ImgArray[1] = './worldwide/images/euro_selected_.gif';
					ImgArray[2] = './worldwide/images/euro_select_afr_roll_.gif';
					ImgArray[3] = './worldwide/images/euro_select_na_roll_.gif';
					ImgArray[4] = './worldwide/images/euro_select_sa_roll_.gif';
					ImgArray[5] = './worldwide/images/euro_select_aus_roll_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				if (Continent == 3){
				document.getElementById('region_selector_3').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/afr_select_asia_roll_.gif';
					ImgArray[1] = './worldwide/images/afr_select_euro_roll_.gif';
					ImgArray[2] = './worldwide/images/afr_selected_.gif';
					ImgArray[3] = './worldwide/images/afr_select_na_roll_.gif';
					ImgArray[4] = './worldwide/images/afr_select_sa_roll_.gif';
					ImgArray[5] = './worldwide/images/afr_select_aus_roll_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				if (Continent == 4){
				document.getElementById('region_selector_4').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/na_select_asia_roll_.gif';
					ImgArray[1] = './worldwide/images/na_select_euro_roll_.gif';
					ImgArray[2] = './worldwide/images/na_select_afr_roll_.gif';
					ImgArray[3] = './worldwide/images/na_selected_.gif';
					ImgArray[4] = './worldwide/images/na_select_sa_roll_.gif';
					ImgArray[5] = './worldwide/images/na_select_aus_roll_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				if (Continent == 5){
				document.getElementById('region_selector_5').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/sa_select_asia_roll_.gif';
					ImgArray[1] = './worldwide/images/sa_select_euro_roll_.gif';
					ImgArray[2] = './worldwide/images/sa_select_afr_roll_.gif';
					ImgArray[3] = './worldwide/images/sa_select_na_roll_.gif';
					ImgArray[4] = './worldwide/images/sa_selected_.gif';
					ImgArray[5] = './worldwide/images/sa_select_aus_roll_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				if (Continent == 6){
				document.getElementById('region_selector_6').style.fontWeight='bold';
					ImgArray[0] = './worldwide/images/aus_select_asia_roll_.gif';
					ImgArray[1] = './worldwide/images/aus_select_euro_roll_.gif';
					ImgArray[2] = './worldwide/images/aus_select_afr_roll_.gif';
					ImgArray[3] = './worldwide/images/aus_select_na_roll_.gif';
					ImgArray[4] = './worldwide/images/aus_select_sa_roll_.gif';
					ImgArray[5] = './worldwide/images/aus_selected_.gif';
				
					document.wwimage.src = ImgArray[imgNum];
					return;}
				
					document.wwimage.src = './worldwide/images/ww_basemap_.gif';
					
			
		}
		function SwapOut()
		{
			var Continent = Centix.Pages.KWXMaster.GetContinent().value;
            
            //var Continent = "1";
			
				if (Continent == 2){
					document.wwimage.src = './worldwide/images/asia_selected_.gif';
					return;
					}
				if (Continent == 1){
					document.wwimage.src = './worldwide/images/euro_selected_.gif';
					return;
					}
				if (Continent == 3){
					document.wwimage.src = './worldwide/images/afr_selected_.gif';
					return;
					}
				if (Continent == 4){
					document.wwimage.src = './worldwide/images/na_selected_.gif';
					return;
				}
				if (Continent == 5){
					document.wwimage.src = './worldwide/images/sa_selected_.gif';
					return;
				}
				if (Continent == 6){
					document.wwimage.src = './worldwide/images/aus_selected_.gif';
					return;
				}
				
					document.wwimage.src = './worldwide/images/ww_basemap_.gif';
				
			
		}

function GetRegionStatusString()
{

    var value = Centix.Pages.KWXMaster.GetRegionStatus().value;
    return value;
}
function SetRegionStatus()
{

    var value = GetRegionStatusString();
    document.getElementById('RegionStatus').innerHTML = value;    
}