/* カテゴリー部分の制御 */
$(document).ready(function(){
    $(c).show();
    // 大カテゴリーがクリックされたら<div class="cate">
    $("div.cate_img img").click(function(){
        var alt = $(this).attr("alt");
        switch(alt){
            case"ショッピング":   d = "ul#b1"; d2 = "ul#b2"; d3 = "ul#b3"; break;
            case"食べる・飲む":   d = "ul#b2"; d2 = "ul#b1"; d3 = "ul#b3"; break;
            case"暮らしに役立つ": d = "ul#b3"; d2 = "ul#b1"; d3 = "ul#b2"; break;
        }
        $(d).slideToggle('fast');
        $(d2).slideUp('fast');
        $(d3).slideUp('fast');
    });
});
function opencate(id) {$(".smallC:visible").slideUp("slow");$(id).slideDown("slow");}

function encodeURL(str) {
    var character = "";
    var unicode   = "";
    var string    = "";
    var i         = 0;
    
    for (i = 0; i < str.length; i++) {
        character = str.charAt(i);
        unicode   = str.charCodeAt(i);
        
        if (character == " ") {
            string += "+";
        } else {
            if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) {
                string = string + character;
            } else {
                if ((unicode >= 0x0) && (unicode <= 0x7f)) {
                    character   = "0" + unicode.toString(16);
                    string += "%" + character.substr(character.length - 2);
                } else if (unicode > 0x1fffff) {
                    string += "%" + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16);
                    string += "%" + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16);
                    string += "%" + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
                    string += "%" + (0x80 + (unicode & 0x3f)).toString(16);
                } else if (unicode > 0x7ff) {
                    string += "%" + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16);
                    string += "%" + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
                    string += "%" + (0x80 + (unicode & 0x3f)).toString(16);
                } else {
                    string += "%" + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16);
                    string += "%" + (0x80 + (unicode & 0x3f)).toString(16);
                }
            }
        }
    }

  return string;
}


function inspection() {
	
	var data = $("input[name='word']").val();
	
	rObj = new RegExp("カテゴリー：.+");
	if (data.match(rObj)) {
		//c   = "#b1";
		if( c != "" ) {
			v = "ul" + c;
			$(v).slideDown('fast');
		} else {
			$("ul#b1").slideDown('fast');
		}
        //alert("[カテゴリー：]を含んでいます。");
    }else{
		$("ul#b1").slideUp('fast');
        $("ul#b2").slideUp('fast');
        $("ul#b3").slideUp('fast');
        //alert("マッチしません。");
    }
}



