BOOL = {}

/**
 * Changes color of the select box
 *
 * @param   Object - parent
 * @return  void
 */
BOOL.changeColor = function (parent) {
    // trigger everytime someone clicks the option
    $(parent.selector+' option:gt(0)').click(function () {
        $(parent).css('color', '#3232FF');
        
        //var text = $(this).text().trim();
		//$(this).text(text);
    });
    

    // reset the color, when user clicks the top (default) option
    $(parent.selector+' option.default').click(function () {
        $(parent.selector).css('color', '#000033');
    });
}


/**
 * Deletes implicit text in #txtHledanyText input element
 *
 * @param Object - parent
 * @param String - defaultText
 * @return void
 */


$(document).ready(function () {
    
    // triger everytime someone changes the select box
    $('#lokalita').change(function () {
        // save the parent object
        var parent = $('#lokalita');
        BOOL.changeColor(parent);
    });
    
    $('#nahradnidil').change(function () {
        // save the parent object
        var parent = $('#nahradnidil');
        BOOL.changeColor(parent);
    });
    
    $('#model').change(function () {
        // save the parent object
        var parent = $('#model');
        BOOL.changeColor(parent);
    });
    
    $('#hledano').click(function () {
		var parent = $('#hledano','Hledaný text');
		BOOL.deleteText(parent);
	});
    
});



/**
 * Delete implicit text in #txtHledanyText input element
 *
 * @param String - implicit
 * @return void
 */
 
 function vymazTxt(implicit) {
	var hledano = document.getElementById('hledano');
	
	if (hledano.value == implicit) hledano.value = '';
 }
 
 
 /**
 * Add implicit text in #txtHledanyText input element
 *
 * @param String - implicit
 * @return void
 */
 
 function pridejTxt(implicit) {
	var hledano = document.getElementById('hledano');
	 
	if (hledano.value == '') hledano.value = implicit;
 }
 
 
 
 
 

