	site_root = location.hostname;	/*ドメインを取得 */

shop_name = 'choyotei';	/* ドメインの後のショップ名*/
shop_name2= 'choyo';		/*テンプレートフォルダ名等*/
ext_type  = '.jpg'			/*使用画像の拡張子*/
hover_code= 'a'				/*マウスオーバー画像に使用する文字*/

img_width = '194';			/*カテゴリメニュー画像の横幅*/
img_height= '28';			/*カテゴリメニュー画像の縦幅*/
sub_height= '28';			/*カテゴリメニューサブの縦幅*/

/*拡張子からマウスオーバー用のパス格納*/
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(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','1','送料込み');
		
		cate_menu('14','67','野口北湯沢ファーム');
		
		cate_menu('02','ff_6','生鮮朝市送料込み');
			sub_h_f('head');
			sub_cate_menu('01','21','農産物','25');
			sub_cate_menu('02','20','エビ・ホタテ');
			sub_cate_menu('03','19','毛ガニ');
			sub_cate_menu('04','18','タラバガニ');
			sub_cate_menu('05','22','ズワイガニ');
			sub_cate_menu('34','59','鮭');
			sub_cate_menu('06','23','旭川ラーメン');
			sub_cate_menu('07','24','牛肉・ジンギスカン');
			sub_cate_menu('35','25','お買い得!!3点1万円セット','25');
			sub_h_f('foot');			
		
		cate_menu('03','ff_7','北海道銘菓');
			sub_h_f('head');
			sub_cate_menu('09','26','石屋製菓','25');
			sub_cate_menu('10','27','六花亭');
			sub_cate_menu('11','28','ロイズ');
			sub_cate_menu('12','29','ホリ');
			sub_cate_menu('13','30','カルビー');
			sub_cate_menu('14','31','北見ハッカ通商');
			sub_cate_menu('30','71','ノースプレインファーム');
			sub_cate_menu('15','32','生キャラメル・生チョコレート');
			sub_cate_menu('08','33','その他','25');
			sub_h_f('foot');	
		
		cate_menu('04','ff_8','旭川・層雲峡名産');
			sub_h_f('head');
			sub_cate_menu('16','35','菓子・食料品','25');
			sub_cate_menu('17','34','雑貨','25');
			sub_h_f('foot');
		
		cate_menu('05','ff_9','朝陽亭オリジナル');
			sub_h_f('head');
			sub_cate_menu('18','37','菓子・食料品','25');
			sub_cate_menu('17','36','雑貨','25');
			sub_h_f('foot');
		
		cate_menu('06','ff_10','海産物・農畜産物');
			sub_h_f('head');
			sub_cate_menu('19','40','昆布、塩、だし');
			sub_cate_menu('20','38','ご飯のお供');
			sub_cate_menu('37','56','珍味','25');
			sub_cate_menu('41','65','農産物','25');
			sub_cate_menu('66','66','お肉、その他','25');
			sub_h_f('foot');
		
		cate_menu('07','ff_11','麺類・米・スープ');
			sub_h_f('head');
			sub_cate_menu('38','72','麺類');
			sub_cate_menu('39','73','米');
			sub_cate_menu('40','74','スープ・その他');
			sub_h_f('foot');
		
		cate_menu('08','ff_12','旭山動物園');
			sub_h_f('head');
			sub_cate_menu('21','42','菓子・食品','25');
			sub_cate_menu('33','57','ハンカチ・靴下・コースター');
			sub_cate_menu('17','41','雑貨','25');
			sub_h_f('foot');
		
		cate_menu('09','13','清涼飲料水・飲料');
		
		cate_menu('13','62','健康食品');
		
		cate_menu('10','14','日本ハムファイターズ');
		
		cate_menu('11','ff_43','美容・入浴商品');
			sub_h_f('head');
			sub_cate_menu('22','45','馬油','25');
			sub_cate_menu('23','45','美容');
			sub_cate_menu('24','46','入浴剤');
			sub_cate_menu('25','47','石鹸・シャンプー','25');
			sub_h_f('foot');
		
		cate_menu('12','ff_48','北海道雑貨','29');
			sub_h_f('head');
			sub_cate_menu('36','60','木彫品');
			sub_cate_menu('26','49','まりもっこり');
			sub_cate_menu('27','50','キューピー');
			sub_cate_menu('28','51','ハローキティ');
			sub_cate_menu('29','52','リラックマ');
			sub_cate_menu('31','54','ジャンクアート');
			sub_cate_menu('32','55','その他');
			sub_h_f('foot');
			
		/* 最後尾 */	
		
		search_sw = 0; //検索フォームスイッチの初期化
};


//サブカテゴリーのヘッダーフッター判定;
function sub_h_f(i){
		if(i == 'head'){
			document.write('<div class="subcate">\n');
		} 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';
	};
  };
};