// !!!!!!!!!!!!!!!!!!!!		ATTENTION		!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
//	the functions in this script depend on the following scripts
//
//		MBF_ObjectSrcParsing.js
//
//		MBF_CookieHandling.js
//
//	they should be loaded into the page before this script
//
// !!!!!!!!!!!!!!!!!!!!		END ATTENTION	!!!!!!!!!!!!!!!!!!!!!!!!!!!!



function getNonButtonImageLang(obj){
	
	var lang = '';
	if(obj.src.search('-EN') != -1){
		//alert('gLFO: found EN');
		lang = '-EN';
	}
	else if(obj.src.search('-CZ') != -1){
		//alert('gLFO: found CZ');
		lang = '-CZ';
	}
	else {
		//alert('gLFO: no language component');
		lang = '';
	}
	
	//alert('MBF_LS gNBIL: language is' + lang);
	
	return lang;
}

function switchLanguageSensitiveImages(lang){
	
	var images = document.images;
	
	for (var i = 0; i < images.length; i++){
		
		//alert('MBF_LS sLSIs: image src is ' + images[i].src);
		
		var imageLang = '-';
		
		if(images[i].className.search('button') != -1){
			
			//alert('MBF_LS sLSIs: img is a button');
			
			imageLang = getLangForObj(images[i]);
		
			//alert('MBF_LS sLSIs: img lang is ' + imageLang);
		
			if(imageLang != '-'){
			
				var imageName = getNameForObj(images[i]);
				images[i].setAttribute('src', imageName + '-' + lang + '-default.png');
			}
		}
		else {
			
			//alert('MBF_LS sLSIs: img is not a button');
			
			imageLang = getNonButtonImageLang(images[i]);
			
			if(imageLang != ''){
				var imageName = getNameForObj(images[i]);
				images[i].setAttribute('src', imageName + '-' + lang + '.png');
			}
		}
	}
}

