//---- zapnuti podpory ajax v skriptu ---- 
function ajax_start(source) {
	
	// odmazeme stary skript, pokud existoval
	var hlavicka = document.getElementsByTagName('head')[0];
	var dataLoader = document.getElementById('scriptLoader');
	if(dataLoader) hlavicka.removeChild(dataLoader);
	
	// vytvorime novy element script
	script = document.createElement('script');
	script.id = 'scriptLoader';
	script.src = source;
	
	// POZOR, DULEZITE!! Skript musime vlozit do stranky pomoci DOM - appendChild()
	// Ihned po vlozeni prohlizec stahne skript a spusti jej
	x = document.getElementsByTagName('head')[0];
	x.appendChild(script);
	
	return false;
}

//---------------------------------------------------------
//---- podbarveni radku v tabulce ----
function setRow(theRow, theAction, theChangeColor){
	//    row -> exits
	if (typeof(theRow.style) == 'undefined') {
        return false;
    }
	// change color
    if (theAction == 'over'){
		theRow.style.backgroundColor =  theChangeColor; 
	}
	else if (theAction == 'out'){
		 if (theChangeColor != ''){
		 	 theRow.style.backgroundColor =  theChangeColor;
		 }
		else {
		 	theRow.style.backgroundColor = '';
		 }
	}
    return true;
}

//---------------------------------------------------------
//---- skryti/odkryti elementu ----
function roll (id){
	var element = document.getElementById(id);
	if (element != undefined){
		if(element.style.display=="block" || element.style.display==""){
			element.style.display="none";
		}
		else{
			element.style.display="block";
		}
	}
	return true;
}

//---------------------------------------------------------
//---- skryti/odkryti elementu ----
function show_hide (id, display){
	var element = document.getElementById(id);
	if (element != undefined){
		element.style.display = display;
	}
	return true;
}

//---------------------------------------------------------
//---- change of img of color  ----
function change_color_img (img_name, img_alt, elt_id){
	var element = document.getElementById('image-'+elt_id);
	element.src = img_name;
	element.alt = img_alt;
	element.title = img_alt;
}


function color_img_ajax (lang, elt_id){
	var element = document.getElementById('select-'+elt_id);
	var id_color = element.value;
	ajax_start('common/function_ajax/ajax_color.php?lang='+lang+'&img_id='+id_color+'&elt_id='+elt_id);
}