function updateCouponSearch(a_namespace, a_params){
    var namespace = (a_namespace? a_namespace + "_": "");

    var tdfCode;
    var tyukanCode;
    var iAreaCode;
    var areaSelector = $(namespace + "couponSearchPref");

    if(a_params.type == "top"){
        tdfCode = areaSelector.value;
        tyukanAreaCode = '';
        iAreaCode = '';
    }
    else{
        tdfCode = a_params["tdfCode"];

        if(a_params.type == "tdfTop"){
            if(a_params.hasTyukanArea){
                tyukanAreaCode = areaSelector.value;
                iAreaCode = '';
            }
            else{
                tyukanAreaCode = '';
                iAreaCode = areaSelector.value;
            }
        }
        else{
            tyukanAreaCode = a_params.tyukanAreaCode;
            iAreaCode = areaSelector.value;
        }
    }

    var conditions = $(namespace + "couponTagCond").getElementsByTagName("INPUT");
    var extraParams = "";

    for(var i = 0; i < conditions.length; i++){
        var checkBox = conditions[i];

        if(checkBox.checked){
            var couponCond = checkBox.id.match(/[0-9]+$/);

            extraParams += ((extraParams == "")? "?": "&");
            extraParams += "coupon_cond[]=" + couponCond;
        }
    }

    var links = $(namespace + "couponTagType").getElementsByTagName("A");

    for(var i = 0; i < links.length; i++){
        var a = links[i];
        var couponType = a.id.match(/[0-9]+$/);

        var url = "/search/p" + tdfCode
            + "_t" + tyukanAreaCode
            + "_a" + iAreaCode
            + "_gb_gc_y_sk_r_icoupon";

        if(couponType){
            url += "_ct" + couponType;
        }

        url += extraParams;

        a.href = url;
    }
}
