
var root_url = 'http://www.' + location.host + '/';
var arr_pref = [
	'北海道','青森県','岩手県','宮城県','秋田県','山形県','福島県',
	'茨城県','栃木県','群馬県','埼玉県','千葉県','東京都','神奈川県',
	'新潟県','富山県','石川県','福井県','山梨県','長野県','岐阜県',
	'静岡県','愛知県','三重県','滋賀県','京都府','大阪府','兵庫県',
	'奈良県','和歌山県','鳥取県','島根県','岡山県','広島県','山口県',
	'徳島県','香川県','愛媛県','高知県','福岡県','佐賀県','長崎県',
	'熊本県','大分県','宮崎県','鹿児島県','沖縄県'
];

$(function(){

	// AJAXのキャッシュOFF
	$.ajaxSetup({ cache: false });

	// リンクの点線除去
	$('a').focus( function(){ if(this.blur)this.blur(); });

	$('a[href$=".pdf"]').addClass('blank');
	// 別窓
	$('a.blank').live('click', function(){ this.target = "_blank"; });

	// 画像ロールオーバー
	$('img.imgover').rollover('_on');
	// 画像ロールオーバー(点滅)
	$('img.imgfade').live('mouseover', function () {
		$(this).animate({opacity:'0.6'}, {duration: 500} );
		$(this).animate({opacity:'1.0'}, {duration: "normal"});
	});

	// メールアドレス inc/system.php->get_asciiとセットで使用
	$('a.mail_link').each(function(){
		var ascii = $(this).attr('href');
		var code = ascii.split(',');
		var mail = "";
		for (var cnt=0; cnt<code.length; cnt++) {
			mail += String.fromCharCode(code[cnt]);
		}
		$(this).attr('href', 'mailto:' + mail);
		$(this).text(mail);
	});

	$('select.number[max]').each(function(){
		var min = $(this).attr('min') == undefined ? 1 : $(this).attr('min');
		var max = $(this).attr('max') == undefined ? 10 : $(this).attr('max');
		var option = "";
		for (i=min; i<=max; i++) {
			option += '<option value="' + i + '">' + i + '</option>';
		}
		$(this).html(option);
	});
	$('select.prefecture').each(function(){
		var option = "";
		option += '<option value="">(選択)</option>';
		for (i=0; i<arr_pref.length; i++) {
			option += '<option value="' + arr_pref[i] + '">' + arr_pref[i] + '</option>';
		}
		$(this).html(option);
	});

//	$('input[type="image"][pdtcd]').click(function(){
//		var thisForm = $(this).closest('form');
//
//		var acttype = document.createElement('input');
//		var backurl = document.createElement('input');
//		var product_cd = document.createElement('input');
//
//		acttype.name = 'acttype';
//		backurl.name = 'backurl';
//		product_cd.name = 'product_cd';
//
//		acttype.value = 'add';
//		backurl.value = location.href;
//		product_cd.value = $(this).attr('pdtcd');
//
//		acttype.type = 'hidden';
//		backurl.type = 'hidden';
//		product_cd.type = 'hidden';
//
//		$(thisForm).append(acttype);
//		$(thisForm).append(backurl);
//		$(thisForm).append(product_cd);
//
//		$(thisForm).attr('method', 'post');
//		$(thisForm).attr('action', '/cart/basket.php');
//	});
//
//	$('a[pdtcd]').click(function(){
//		var link = '/cart/basket.php?a=add';
//		link += '&p=' + $(this).attr('pdtcd');
//		$(this).attr('href', link);
//	});

});


