$(function(){
	$('ul.years').each(function(){
		var $list = $(this).find('li'),
			html = '<select name="years">';
		$list.each(function(){
			var $link = $(this).find('a');
			if($link.attr('class') !== 'selected') {
				pulldown = '<p class="years"><option value="'+ $link.attr('href') +'">'+ $link.text() +'</option>';
			} else {
				pulldown = '<option value="'+ $link.attr('href') +'" selected="selected">'+ $link.text() +'</option>';
			}
			html += pulldown;
		});
		html += '</select></p>';
		$(this).before(html);
		$('select[name="years"]').bind('change', function(){
			window.location = $(this).val();
		});
		$(this).remove();
	});
	
	// Google Map for iOS
	if((undefined !== window.defaultstatus && typeof CharacterData != 'function') && (navigator.platform.indexOf('iPhone') >= 0 || navigator.platform.indexOf('iPod') >= 0 || navigator.platform.indexOf('iPad') >= 0)) {
		var altMapURI = 'http://maps.google.co.jp/maps?f=q&source=s_q&hl=ja&geocode=&q=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E7%A5%9E%E7%94%B0%E5%B0%8F%E5%B7%9D%E7%94%BA3-9-2&aq=&sll=35.693787,139.766591&sspn=0.010805,0.023196&brcurrent=3,0x60188c101b28f7ed:0x48b72fd32186fd45,0,0x60188c10106b94d7:0x67533f0ec499b80c&ie=UTF8&hq=&hnear=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E7%A5%9E%E7%94%B0%E5%B0%8F%E5%B7%9D%E7%94%BA%EF%BC%93%E4%B8%81%E7%9B%AE%EF%BC%99%E2%88%92%EF%BC%92&view=map&z=16';
		$('.google-map').html('<p class="alternative"><a href="'+ altMapURI +'" target="_blank">Googleマップで地図を表示する</a></p>');
	}
});
