function homeFeature(id){
    $('#feature1').hide();
    $('#feature2').hide();
    $('#feature3').hide();
    $('#feature'+id).show();
}
function closeGeo(id){
    $("#"+id).slideUp();
}
function show_tab(mode)
{
    $('#div_north').hide();
    $('#div_central').hide();
    $('#div_south').hide();

    var north  = document.getElementById('north');
    var central = document.getElementById('central');
    var south  = document.getElementById('south');

    north.className = '';
    central.className = '';
    south.className = '';

    switch(mode)
    {
        case 1 :
            north.className = 'active';
            $('#div_north').show();
            break;
        case 2 :
            central.className = 'active';
            $('#div_central').show();
            break;
        case 3 :
            south.className = 'active';
            $('#div_south').show();
            break;
    }
}
function set_session_geo(value,url){

    $.ajax({
        url: AJAX_PROCESS_URL+'set_session_geo/'+value,
        type: 'GET',
        data: "",
        error: function(){
        //alert('error!');

        },
        success: function(data){

            if(url!=""){
                window.location.href=url;
            }else{
                window.location.reload();
            }

        }
    });
}

function change_tab_street(id){
    if(id=='div_street_hcm'){
        $('#div_street_hn').hide();
        $('#div_street_hcm').show();
        $('#tab_street_hn').removeClass('current');
        $('#tab_street_hcm').addClass('current');
    }else{
        $('#div_street_hn').show();
        $('#div_street_hcm').hide();
        $('#tab_street_hn').addClass('current');
        $('#tab_street_hcm').removeClass('current');
    }
}
function changeTab(id){
    if(id=='tabNewsHome1'){
        $('#tabNewsHome').hide();
        $('#tabNewsHome1').show();
        $('#tabCat').removeClass('current');
        $('#tabCat1').addClass('current');
    }else{
        $('#tabNewsHome').show();
        $('#tabNewsHome1').hide();
        $('#tabCat').addClass('current');
        $('#tabCat1').removeClass('current');
    }
}

/*
$(document).ready(function(){
    $('.slideshow').each(function(){
        $(this).after('<div class="rotatorcontrol"></div>');
        $(this).cycle({
         fx: 'fade',
         timeout: 3000,
            pager:$(this).next()
        });
    });
});
*/

$(document).ready(function (){
    $('#city').change(function(){
        var geo_id = this.value;
        if(geo_id>0){
            $.ajax({
                url: AJAX_PROCESS_URL+'getdistrict/'+geo_id,
                error: function(){
                    alert('Error loading tags infomation!');
                },
                success: function(data){
                    $("#district").html('<option value="-1">Quận / Huyện...</option>'+data);
                }
            });
        }else{
            $("#district").html('<option value="-1">Quận / Huyện...</option>');
            $("#street").html('<option value="-1">Đường...</option>');
        }
    });

    $('#district').change(function(){
        var district_id = this.value;
        if(district_id>0){
            $.ajax({
                url: AJAX_PROCESS_URL+'getstreet/'+district_id,
                type: 'POST',
                data: 'district_id='+district_id,
                error: function(){
                    alert('Error loading tags infomation!');
                },
                success: function(data){
                    $("#street").html('<option value="-1">Đường...</option>'+data);
                }
            });
        }else{
            $("#street").html('<option value="-1">Đường...</option>');
        }
    });
});
