﻿// JScript File
//----------------------------------------------------------
function selIndexCB(CBobj, index){
	var tmSelDateE = document.getElementById(CBobj)
	tmSelDateE.selectedIndex = index;
}
//----------------------------------------------------------
function ClearCB(CBobj, allOptionText){
	var CBObj = document.getElementById(CBobj);
	CBObj.options.length = 0;

	var no = new Option();
	no.value = 0;
	no.text = allOptionText;
	CBObj.options[CBObj.options.length] = no;            
}
//----------------------------------------------------------
function RegionSel(allOptionText){
	selIndexCB("sel_typPod", 0);
	ClearCB("sel_Podujatie", allOptionText);
	
    var region = document.getElementById("sel_region_Q");
    document.body.style.cursor='wait';
    
    getData("/tools/ajax/hladaj.asp","region=" + region.value);
}
//----------------------------------------------------------
function TypPodujatiaSel(allOptionText){
	selIndexCB("sel_region_Q", 0);
	selIndexCB("sel_miestoPod", 0);
	ClearCB("sel_hala", allOptionText);
	
    var typ = document.getElementById("sel_typPod");
    document.body.style.cursor='wait';
    
    getData("/tools/ajax/hladaj.asp","typ=" + typ.value);
}
//----------------------------------------------------------
function MestoSel(allOptionText){
	selIndexCB("sel_typPod", 0);
	ClearCB("sel_Podujatie", allOptionText);
	
    var region = document.getElementById("sel_region_Q");
    document.body.style.cursor='wait';

	var mesto = document.getElementById("sel_miestoPod");
	document.body.style.cursor='wait';
    
    getData("/tools/ajax/hladaj.asp","region=" + region.value + "&mesto=" + mesto.value);
}
//----------------------------------------------------------
function HladiskoSel(allOptionText){
	selIndexCB("sel_typPod", 0);
	ClearCB("sel_Podujatie", allOptionText);
}
//----------------------------------------------------------
function PodujatieSel(allOptionText){
	selIndexCB("sel_region_Q", 0);
	selIndexCB("sel_miestoPod", 0);
	ClearCB("sel_hala", allOptionText);
}
//----------------------------------------------------------
function spracujPOLE_CB(objName, poleSTR, allOptionText, addAllIndex){
	var CBObj = document.getElementById(objName);
	CBObj.options.length = 0;
	
	if(addAllIndex){
		var no = new Option();
		no.value = 0;
		no.text = allOptionText;
		CBObj.options[CBObj.options.length] = no;            
	}
	
	if (poleSTR!=''){
		var pole = poleSTR.split('|');
		var vystupP = new Array();
		var loopIndex;
		for (var loopIndex = 0; loopIndex < pole.length;loopIndex++) {
			vystupP = pole[loopIndex].split('~');
			var no = new Option();
			no.value = vystupP[0];
			no.text = vystupP[1];

			CBObj.options[CBObj.options.length] = no;            
		}
	}
	document.body.style.cursor='';
	if(addAllIndex){selIndexCB(objName, 0)}
}  
//----------------------------------------------------------
