$(document).ready(function(){
$('#brum ul li:last').addClass('end');
var str = $("body").attr("id");
if (str=='home'){
	randomtip();
};
//End
});


/* local navigation */
$(function($) {
//var href = location.href.split('#')[0];
var href = (location.href.split('#')[0]).replace(/\/$/ig,'/index.html');
$('#menuCol dd a').each(function() {
var thishref = (this.href);
var thishref = (thishref).replace(/\/$/ig,'/index.html');
if (href == thishref)$(this).addClass('on');
});
});



/*  ================================================================================
・blank
・IE クリックライン消
・イメージロールオーバー　テキスト＆背景画像用
================================================================================  */
$(document).ready(function () {
$('.blank').click(function(){window.open(this.href, '_blank');return false;});
$("a").focus(function(){$(this).blur();});
$('a img.rollover,a.rollover').mouseover(function(){$(this).animate({opacity: 0.65}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
$('ul li:last,#cont dl.bond_list:last,').addClass('end');
$('.item:odd').addClass('even');
$("#menuCol dl").each(function(){$(this).find('dd:last').addClass('end');});
$(".item ul.disp").each(function(){$(this).parent().addClass('admin');});
$('.wareki').each(function(){
var seireki = $(this).text().toDatetime().format("yyyy年M月d日");
$(this).text(seireki);
});

});


/*  ================================================================================
マーケットメーカー 
================================================================================  */
$(document).ready(function () {
$('#marketmaker #cont div.marketmakerIndex dl').each(function(){
$(this).mouseover(function(){
	$(this).addClass('hover');
	}).mouseout(function(){
	$(this).removeClass('hover');
	});
$(this).click(function(){
	var link = $(this).find('a').attr('href');
	window.open(link, '_blank');
	return false;
});
	
	
});
});


/*  ================================================================================
FAQ 
================================================================================  */
$(document).ready(function () {
$('#cont ul.pageUnq li:last').addClass('end');
$('dl.faqList dd').hide();
$('dl.faqList dt').mouseover(function(){$(this).css('text-decoration','none');}).mouseout(function(){$(this).css('text-decoration','underline');});
$('dl.faqList dt').each(function(){
$(this).click(function(){
if ($(this).hasClass("open")){
$(this).removeClass("open");
$(this).next('dd').hide();
}else{
$(this).next('dd').fadeIn();
$(this).addClass("open");
};
//$(this).next('dd').toggle();
});
});
});


/*  ================================================================================
ホーム ランダム
================================================================================  */
this.randomtip = function(){
var pause = 3000; //表示時間(ミリ秒)
var list = "#home #cont div.half ul li";
var length = $(list).length;
var temp = -1;
this.getRan = function(){var ran = Math.floor(Math.random()*length)+1;return ran;
};
this.show = function(){
var ran = getRan();
while (ran == temp){ran = getRan();}; 
temp = ran;$(list).hide();$(list+":nth-child("+ran+")").fadeIn("slow");
};
show();setInterval(show,pause);
};



/*  ================================================================================
イメージロールオーバー スワップ
================================================================================  */
this.randomtip = function(){
var pause = 3000; //表示時間(ミリ秒)
var list = "#home #cont div.half ul li";
var length = $(list).length;
var i = 1; //初期位置
this.show = function(){$(list).hide();$(list+":nth-child("+i+")").fadeIn("slow");
if(i==length){i=1;}else{i++;}
};
show();setInterval(show,pause);
};



/*-----------------------------------------------------
スムーズスクロール
-----------------------------------------------------*/
jQuery.fn.extend({
scrollTo : function(speed, easing) {
if(!$(this)[0].hash || $(this)[0].hash == "#") {
return false;
}
return this.each(function() {
var targetOffset = $($(this)[0].hash).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
});

$(document).ready(function(){
$('#pageTop a,ul.pageUnq li a,#menuCol dd a[href*="#a"]').click(function() {
$(this).scrollTo(1000);
return false;
});
});

/*  ================================================================================
ポップアップ
================================================================================  */
(function($) {
$.fn.openwin = function(settings) {
settings = jQuery.extend({
option		: {
width		: false,
height		: false,
top			: false,
left		: false,
menubar		: "no",
toolbar		: "no",
location	: "no",
status		: "no",
resizable	: "no",
scrollbars	: "no",
directories	: "no",
titlebar	: "yes",
fullscreen	: "no"
},
target		: "_blank",
blur		: false,
focus		: false
}, settings);

this.click(function() {
var options = [];
if($(this).attr("rel")) {
var rel = $(this).attr("rel").split(",");
var reloption = {};
for(var i in rel) {
var a = rel[i].split("=");
reloption[a[0]] = a[1];
}
}
for(var k in settings.option) {
var v = settings.option[k];
if(reloption) {
if(reloption[k]) {
v = reloption[k];
}
}
if(v != false) {
options.push(k + "=" + v);
}
}
var target = settings.target;
if(reloption) {
if(reloption["target"]) {
target = reloption["target"];
}
}
var win = window.open($(this).attr("href"), target, options.join(","));
if(settings.blur == true) {
win.blur();
}
if(settings.focus == true) {
win.focus();
}
return false;
});
}
})(jQuery);

$(document).ready(function() {
$('a.popup').openwin({option:{width:673,height:500,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
/*if ($.browser.msie ){
$('a.shop_popup').openwin({option:{width:673,height:500,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
}else{
$('a.shop_popup').openwin({option:{width:673,height:500,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
};
*/
});


/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

/*
Google Map
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
$(function(){
$('#boxID').gmap('43.0550852','141.3412251');
});
*/
(function($){
  $.fn.gmap = function(lat, lng) {
    var mapdiv = $(this).get(0);
    var myOptions = {
      zoom: 17,
      center: new google.maps.LatLng(lat,lng),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      scaleControl: true,
      mapTypeControl: true
    };
    var map = new google.maps.Map(mapdiv, myOptions);
    var marker = new google.maps.Marker({
      position: myOptions.center,
      map: map
    });
  };
})(jQuery);


/*

画像順次表示

$(function(){
//ページ上の画像をすべて隠す
$('#cont img').hide();
});
// 初期化
var i = 0;
// IEは固定
var int=0;
$(window).bind("load", function() {
// ページが完全に読み込まれたときにロードイベント発生
// 画像を0.5秒間隔でフェードイン表示
var int=setInterval("doThis(i)",100);
});
function doThis() {
// 画像数
var imgs = $('#cont img').length;
if (i >= imgs) {
// 最後の画像でタイマークリア
clearInterval(int);
}
// 0.5秒間隔で隠していた画像をフェードイン表示
$('#cont img:hidden').eq(0).fadeIn(100);
i++;
}
*/


