$(document).ready(function(){
    //$("#selectionresult").hide(); 
    $("#selection").change( function() {
        $("#selectionresult").hide();
        $("#result").html('<select class="selectInput"><option>Loading...</option></select>');
        $.ajax({
            type: "POST",
            data: "data=" + $(this).val(),
            url: "http://www.klickrentals.com/includes/retrieve-location.php",
            success: function(msg){
                if (msg != ''){
                    $("#selectionresult").html(msg).show();
                    $("#result").html('');
                }
                else{
                    $("#result").html('<em><select class="selectInput"><option>No city found</option></select></em>'); 
                }
            }
        });
    });
	
	$("#selection_c").change( function() {
        $("#selectionresult_c").hide();
        $("#result_c").html('<select class="adInfoSelect"><option>Loading...</option></select>');
        $.ajax({
            type: "POST",
            data: "data_c=" + $(this).val(),
            url: "includes/retrieve-location.php",
            success: function(msg){
                if (msg != ''){
                    $("#selectionresult_c").html(msg).show();
                    $("#result_c").html('');
                }
                else{
                    $("#result_c").html('<em><select class="adInfoSelect"><option>No city found</option></select></em>'); 
                }
            }
        });
    });
});
