function brand_search_action(base,search){
    var item =document.searchform.select_item.value;
    var brand =document.searchform.select_brand.value;
    var brand_action = base + brand + "/";
    var item_action = search + item + "/";
    
    if(item.length == 0 && brand.length == 0){
        alert("アイテムまたはブランドを選択してください");
        return false; 
    }else if(item.length > 0  && brand.length == 0){
        document.searchform.action = item_action;
    }else if(brand.length > 0){
        document.searchform.action = brand_action;
    }
}

/*--------------------------------------------------------------------------*
 *  Genre GrayOut
 *--------------------------------------------------------------------------*/
function genreGrayOut(areaVal){
    if(areaVal == "00"){
        document.forms['search_submit'].genre.disabled = true;
    }else{
        document.forms['search_submit'].genre.disabled = false;
    }
    return;
}

//[見比べリストに追加]ボタン押下処理
function add_item(datas,domain,j_no){
    
    var cookie_path ='/';
    var cookie_domain =domain
    sep_datas = datas.split(":");
     
    var objdate = new Date();
    var item_limit = objdate.getTime();
    
    // 追加する商品IDを取得
    add_id = sep_datas[0];
    
    // 見比べリストの[商品ID・index]を取得(cookie)
    wc_CompareItem = $.cookie('wc_CompareItem');
    var string_list = '';
    // ',' 区切り
    if (wc_CompareItem) {
        string_list = wc_CompareItem.split(",");
    }
    
    // 商品IDがクッキーに存在するかチェック
    regist_flg = 0;
    for (var i = 0; i < string_list.length; i++) {
        string_list2 = string_list[i].split(":");
       
        if (sep_datas==string_list2) {
            regist_flg = 1;
            break;
        }
    }

    // 商品IDをクッキーに登録
    if (regist_flg == 0) {
        // 見比べリスト件数を判定
        if (string_list.length < 10) {
            
            var string_item_id = '';
            // 新しい商品IDを先頭に連結
            if (wc_CompareItem) {
                string_item_id = add_id + ':' + item_limit + ',' + wc_CompareItem;
            } else {
                string_item_id = add_id + ':' + item_limit;
            }

            // cookie更新
            $.cookie('wc_CompareItem', string_item_id, {expires:30,path:cookie_path,domain:cookie_domain});
            
            // ボタン表示変更
            document.getElementById('image_' + sep_datas[0]).style.display="none";
            document.getElementById('registed_' + sep_datas[0]).style.display="";
            
        } else {

            flag = confirm("この商品を見比べリストへ登録すると、最初に登録された見比べリスト商品が1つ削除されます。\n宜しいですか？（見比べリストは10件まで登録可能です。）");
            
            if (flag) {

                for (var i = 0, length = string_list.length; i < length - 1; i++) {    // -1部分だけ異なる
                    if (string_item_id) {
                        string_item_id = string_item_id + ',' + string_list[i];
                    } else {
                        string_item_id = string_list[i];
                    }
                }

                string_item_id = add_id + ':' + item_limit + ',' + string_item_id;

                // cookie更新
                $.cookie('wc_CompareItem', string_item_id, {expires:30,path:cookie_path,domain:cookie_domain});

                // ボタン表示変更
                document.getElementById('image_' + sep_datas[0]).style.display="none";
                document.getElementById('registed_' + sep_datas[0]).style.display="";
            }
        }
    // 商品ID登録済み
    } else {
        // すでに登録済みなので処理は行わず、表示のみ変更
        document.getElementById('image_' + add_id).style.display="none";
        document.getElementById('registed_' + add_id).style.display="";
    }
}

function move_compare_item(id,mode){
    document.move_item.move_list.value = id;
    document.move_item.move_mode.value = mode;
    document.move_item.submit();
}
