var $jq = jQuery.noConflict();
$jq(document).ready(function() {
    onChangeCity();
    onChangeHotel();
});

function onChangeCity(){

    $jq('#city').change(function(){
        var lang = $jq('#lang').val();
        $jq('#hotel').removeOption(/(.?)/);
        var params = {};
        params['id_ciudad'] = $jq('#city').val();
        params['lang']= lang;
        if($jq('#city').val()==''){
            if(lang == 'spanish'){
                $jq("<option>Seleccione una ciudad</option>").appendTo('#hotel');
            }else{
                $jq("<option>Select a City</option>").appendTo('#hotel');
            }
            $jq('#redirect').attr('onclick',"");
        }else{
            $jq.ajax({
            url : 'index.php?id=67',
            type : 'POST',
            dataType: 'text',
            async : false,
            data : params,
            success : function(response){
                if(response) {
                    $jq(response).appendTo('#hotel');
                }
            }
        });
        }
        //$jq('#redirect').attr('onclick',"");
        $jq('#hotel').find("option[index='0']").attr("selected","selected");
        $jq('#hotel').change();
        
    });
}

function onChangeHotel(){
    $jq('#hotel').change(function(){
        var url_reserva = $jq('#hotel').val();
        $jq('#redirect').attr('onclick',"window.location.href='"+url_reserva+"'");
    });
}

function change_list(url_list){
        
        var params = {};
        params['url_list'] = url_list;
        
        $jq.ajax({
            url : 'index.php?id=67',
            type : 'POST',
            dataType: 'text',
            data : params,
            success : function(response){
                if(response) {
                    $jq('#pane1').html(response);
                    change_vide($jq('#actv_').val());
                }
            }
        });
}
