
function createMinMax(thisid) {
    var value = $('#'+thisid).val();
    var exploded = value.split('-');

    if (typeof(exploded[0]) != 'undefined') {
        $('#lmn').val(exploded[0]);
    } else {
        $('#lmn').val('');
    }

    if (typeof(exploded[1]) != 'undefined') {
        $('#lmx').val(exploded[1]);
    } else {
        $('#lmx').val('');
    }
}

function hideHotel() {
             flights = false;
    //bindAjax('rgc');
    $('#i_departure').fadeOut();
    $('#i_lengthstay').fadeIn();
    $('#i_stc').fadeIn();
    $('#i_fot').fadeIn();
    $('#i_act').fadeIn();
    $('#i_htn').fadeIn();
    //$('#searchform').attr('action','http://online.ck-ecomm.sk/default.aspxResort.aspx?');
    $('#fdsr').attr('name','dsr');
    
    $("#whisper").autocomplete(regions, {
            minChars: 0,
            width: 190,
            autoFill: false,
            scrollHeight: 300,
            cacheLength: 0,
            scroll: true,
            max: 5,
            highlight : false,
            formatItem: function(row, i, max) {
                if(ie6===true) {
                    $('select').hide();
                }
                    return row.usename;
            },
            formatMatch: function(row, i, max) {
                    return row.name;
            },
            formatResult: function(row) {        
                    return row.usename;
            }
    });    
        
    createCustomCombo('');
        
    
}

function hideFlight() {
    flights = true;
    
    //bindAjax('rgc');
    $('#i_departure').fadeIn();
    $('#i_lengthstay').fadeOut();
    $('#i_stc').fadeOut();
    $('#i_fot').fadeOut();
    $('#i_act').fadeOut();
    $('#i_htn').fadeOut();
    //$('#searchform').attr('action','http://online.ck-ecomm.sk/default.aspxTermin.aspx?');
    $('#lmn').attr('value','7');
    $('#lmx').attr('value','14');
    $('#fdsr').attr('name','dsc');
    
    $("#whisper").autocomplete(flightregions, {
		minChars: 0,
		width: 190,
		autoFill: false,
		scrollHeight: 300,
                cacheLength: 0,
		scroll: true,
		max: 5,
                highlight : false,
		formatItem: function(row, i, max) {
                    if(ie6===true) {
                        $('select').hide();
                    }
			return row.usename;
		},
		formatMatch: function(row, i, max) {
			return row.name;
		},
		formatResult: function(row) {        
			return row.usename;
		}
	});    
        
        createCustomCombo('flight');
    
}

function showAll() {
                  flights = false;
                  
    //bindAjax('rgc');
    $('#i_departure').fadeIn();
    $('#i_lengthstay').fadeIn();
    $('#i_stc').fadeIn();
    $('#i_fot').fadeIn();
    $('#i_act').fadeIn();
    $('#i_htn').fadeIn();
    //$('#searchform').attr('action','http://online.ck-ecomm.sk/default.aspxResort.aspx?');
    $('#fdsr').attr('name','dsr');
    
    
    $("#whisper").autocomplete(regions, {
		minChars: 0,
		width: 190,
		autoFill: false,
		scrollHeight: 300,
                cacheLength: 0,
		scroll: true,
		max: 5,
                highlight : false,
		formatItem: function(row, i, max) {
                    if(ie6===true) {
                        $('select').hide();
                    }
			return row.usename;
		},
		formatMatch: function(row, i, max) {
			return row.name;
		},
		formatResult: function(row) {        
			return row.usename;
		}
	});      
        
        createCustomCombo('');

}

function preselectRegion() {

    var val = $('#region_value').val();
    if(val=='') {
        val2 = $('#uberregion').val();
        $('#rgn').val(val2);
    } else {
        $('#rgn').val(val);
    }
}

function createCustomCombo(type) {
        
  $.ajax({
      url: 'http://www.ck-ecomm.sk/ajax/getcombo.php',
      cache: false,
      type: "GET",
      data: ({
                type: type
          }),
      success: function(html){
          $('#customselect_holder').html(html).hide().fadeIn('slow');          
      }
  });
   
 
}
      
  
