site_root = location.hostname;	/*ドメインを取得 */

shop_name = 'takubokutei';	/* ドメインの後のショップ名*/
shop_name2= 'takuboku';		/*テンプレートフォルダ名等*/
ext_type  = '.jpg'			/*使用画像の拡張子*/
hover_code= 'a'				/*マウスオーバー画像に使用する文字*/

img_width = '194';			/*カテゴリメニュー画像の横幅*/
img_height= '28';			/*カテゴリメニュー画像の縦幅*/
sub_height= '24';			/*カテゴリメニューサブの縦幅*/

/*拡張子からマウスオーバー用のパス格納*/
ext_type_a= hover_code + ext_type;
/* カテゴリメニュー画像のパスを格納*/
img_pass  = 'http://'+ site_root +'/'+ shop_name +'/html/user_data/packages/'+ shop_name2 +'/img/side/cate';
subimg_pass  = 'http://'+ site_root +'/'+ shop_name +'/html/user_data/packages/'+ shop_name2 +'/img/side/sub_cate';
/* カテゴリIDのリンクパスを格納 */
cate_pass = 'http://'+ site_root +'/'+ shop_name +'/html/products/list.php?category_id=';
/**/
search_sw = 0;

/* ================={ メニュースライド } ===========*/

$(document).ready(function() {
	$("h3").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default"); 
		});
	$("div.subcate").css("display","none");
	$("h3.subcategory").click(function(){
		$(this).next().slideToggle("fast");
		//$(this).next().css("display","block");
    });
});

/* ====================================================*/

function creat_cate_menu_hiten(){
/*
		cate_menu('h01','ff','飛天取り扱い商品');
			sub_h_f('head');
			sub_cate_menu('h01','52','銘菓');
			sub_cate_menu('h02','53','雑貨');
			sub_cate_menu('h03','54','飲料・食品');
			sub_h_f('foot');
			
		cate_menu('hff','ff','','7');
		
		document.write('<br>');
*/
}

function creat_cate_menu(search_js){
		if(search_js == undefined){ 
			search_sw = 0;	//検索フォーム書き出しOFF
		} else {
			search_sw = 1;	//検索フォーム書き出しON
		};
	
		/*	カテゴリーメニュー生成
			
			メインメニュー
			cate_menu('タグにつけるID番号','サイトのカテゴリID、ff指定でリンクなし','オルト','画像の高さ(省略可)')
			サブメニューも同様の指定でＯＫです。
			sub_h_f('head 指定でサブカテ用ヘッダタグ書き込み。 foot でフッタ')
			
			タグID : 01～
			カテゴリID: 1～		ff指定でリンクなし
			画像の高さ：　省略で 28px
			sub_h_f：　'head'　サブカテの一番上に記述
						'foot' サブカテの一番下に記述
			
		*/
	
	
		cate_menu('01','38','巨大イカぬいぐるみ');
		
		cate_menu('02','ff_8','オリジナル商品');
			sub_h_f('head');
			sub_cate_menu('01','58','オリジナル食品・お菓子');
			sub_cate_menu('02','59','オリジナル雑貨・その他');
			sub_h_f('foot');
		
		cate_menu('03','ff_25','海産物');
			sub_h_f('head');
			sub_cate_menu('06','61','とろろ昆布');
			sub_cate_menu('03','64','イカ生鮮・加工品');
			sub_cate_menu('04','63','松前漬け');
			sub_cate_menu('05','62','昆布加工品');
			sub_cate_menu('24','49','海産物バンドルセール');
			sub_cate_menu('35','90','皮唐揚サクサク');
			sub_cate_menu('07','60','その他海産物');
			sub_h_f('foot');
		
		cate_menu('04','ff_28','農産物');
			sub_h_f('head');
			sub_cate_menu('08','67','農産物限定品');
			sub_cate_menu('09','66','旬の果物');
			sub_cate_menu('10','65','その他農産物');
			sub_h_f('foot');
		
		cate_menu('05','ff_6','北海道銘菓');
			sub_h_f('head');
			sub_cate_menu('11','18','白い恋人');
			sub_cate_menu('12','21','六花亭');
			sub_cate_menu('13','20','ROYCE');
			sub_cate_menu('14','72','カルビー');
			sub_cate_menu('15','71','ホリ');
			sub_cate_menu('16','70','北見ハッカ通商');
			sub_cate_menu('17','69','生チョコレート・その他');
			sub_cate_menu('34','86','生キャラメル・その他');			//last
			sub_cate_menu('18','68','その他北海道銘菓');
			sub_h_f('foot');
		
		cate_menu('06','27','北海道珍味');
		
		cate_menu('07','ff_29','北海道ラーメン・カレー');
			sub_h_f('head');
			sub_cate_menu('19','75','ラーメン');
			sub_cate_menu('20','74','札幌スープカリー');
			sub_cate_menu('21','73','五島軒カレー');
			sub_h_f('foot');
		
		cate_menu('08','22','レストラン人気メニュー');
		
		cate_menu('12','82','乳製品');
		
		cate_menu('09','ff_33','飲料・アイスクリーム');
			sub_h_f('head');
			sub_cate_menu('22','77','飲料');
			sub_cate_menu('23','76','アイスクリーム');
			sub_h_f('foot');
		
		cate_menu('10','13','美容入浴商品');
		
		/*===   ケツ  ===*/
		cate_menu('11','ff_14','北海道雑貨');
			sub_h_f('head');
			sub_cate_menu('30','41','Tシャツ');
			sub_cate_menu('25','80','携帯ストラップ');
			sub_cate_menu('26','17','日本ハムファイターズ');
			sub_cate_menu('27','79','ジャンクアート');
			sub_cate_menu('28','37','まりもっこり');
			sub_cate_menu('31','43','リラックマ');
			sub_cate_menu('32','84','ラベンダー製品');
			sub_cate_menu('29','78','その他北海道雑貨');
			sub_h_f('foot');
	
		/* 最後尾 */	
		cate_menu('ff','ff','','7');
		
		search_sw = 0; //検索フォームスイッチの初期化
};

function sub_h_f(i){
		if(i == 'head'){
			document.write('<div class="subcate">');
		} else if(i == 'foot'){
			document.write('</div>');	
		}
};

//サブカテゴリメニューの書き出し関数
function sub_cate_menu(id,cate_id,alt,g_height){
	
  if(search_sw == 0){
  
	
	var useCate_pass = cate_pass + cate_id;
	var useImg_pass = subimg_pass + id + ext_type;
	var useImgA_pass= subimg_pass + id + ext_type_a;
	
	if(g_height == undefined) g_height = sub_height;
	document.write('\
				<h4 id="sub_cate'+ id +'">\
				<a href="'+ useCate_pass +'">\
				<img src="'+ useImg_pass +'"\
				width="'+ img_width +'" height="'+ g_height +'" alt="'+ alt +'" /></a>\
				</h4>');
	document.getElementById('sub_cate'+ id).style.background = 'url("'+ useImgA_pass +'")';
	document.getElementById('sub_cate'+ id).style.backgroundRepeat = 'no-repeat';
  };
};

//メインカテゴリメニューの書き出し関数
function cate_menu(id,cate_id,alt,g_height){
	var useImg_pass = img_pass + id + ext_type;
	var useImgA_pass= img_pass + id + ext_type_a;
	var id_num = '';
	
	if(g_height == undefined) g_height = img_height;	//高さ指定されていない場合初期高さを指定;
	
  //検索フォームの処理か否かの判断;	
  if(search_sw == 1 && id != 'ff'){
	  
	  	//cate_idの冒頭3文字の比較
	  	if(cate_id.substring(0,3) == 'ff_'){
			var id_length = cate_id.length;				//cate_idの文字数を代入;
			id_num = cate_id.substring(3,id_length);	//id番号のみを抽出;
		} else {
			id_num = cate_id;							//サブカテゴリーがないメインの場合はそのまま代入;
		}
		//検索フォームメニューの書き出し;
	  	document.write('\
					   <option label="'+ alt +'" value="'+ id_num +'">\
					   '+ alt +'</option>');
		
　//カテゴリーメニューの書き出し;
  } else {
	
	//サブカテゴリの有無
	if(cate_id.substring(0,2) == 'ff') {
			//サブカテゴリー有の書き出し
			document.write('\
					<h3 id="cate'+ id +'" class="subcategory">\
					<img src="'+ useImg_pass +'"\
					width="'+ img_width +'" height="'+ g_height +'" alt="'+ alt +'" /></h3>');
	} else {
			//リンク有の書き出し
			document.write('\
				<h3 id="cate'+ id +'">\
				<a href="'+ cate_pass + cate_id +'">\
				<img src="'+ useImg_pass +'"\
				width="'+ img_width +'" height="'+ g_height +'" alt="'+ alt +'" /></a></h3>');
			
			//マウスオーバー用のCSSプロパティ書き出し
			document.getElementById('cate'+ id).style.background = 'url("'+ useImgA_pass +'")';
			document.getElementById('cate'+ id).style.backgroundRepeat = 'no-repeat';
	};
  };
};