
try{
document.execCommand('BackgroundImageCache', false, true);
}catch(e){}

var module = {};


if(window.attachEvent){
if (typeof document.documentElement.style.msInterpolationMode == "undefined") module.oldIE = true;
module.IE = true;
}

var lh = location.href;



	


(function($){

//----------------------------------------------------------//
// IE PNGAROUNDBORDER
//----------------------------------------------------------//
if(module.oldIE) $('head').append('<scr'+'ipt src="/bus/shitamachi/common/script/DD_belatedPNG_0.0.8a-min.js"></scr'+'ipt>');

$(function(){
if(module.oldIE) DD_belatedPNG.fix('div.innerArea,div.innerSub');
});



//----------------------------------------------------------//
//@imgover
//----------------------------------------------------------//

module.ImgOverSetting = {
	Class  : '.imover',
	imgfileNamePlus : '_o',
	imgfileNameStay : '_o'
}

module.ImgOver = {
		
	overfunc : function (){
		
		var bodyid = document.getElementsByTagName('body');
		
		$(module.ImgOverSetting.Class).each(function(index,obj){
					if(obj.src.indexOf(module.ImgOverSetting.imgfileNameStay) == -1) new Image().src =  module.Imgsrc.add(obj.src, module.ImgOverSetting.imgfileNamePlus);
	
					$(this).mouseover(module.ImgOver.imgOverFunc);
					$(this).mouseout(module.ImgOver.imgOutFunc);
					$(this).bind("beforeunload",module.ImgOver.imgOutFunc);
		
		});
	},
	
	imgOverFunc : function (e){
		if(this.className.indexOf('gnvstay') != -1) return;
		this.src = module.Imgsrc.add(this.src, module.ImgOverSetting.imgfileNamePlus);
	},
	imgOutFunc : function (e){
	if(this.className.indexOf('gnvstay') != -1) return;
		this.src = module.Imgsrc.del(this.src, module.ImgOverSetting.imgfileNamePlus);
	}
	
}
module.Imgsrc = {

	add : function (objsrc,plusnm){
		if(objsrc.indexOf(plusnm) != -1) return objsrc;
		var ftype = objsrc.substring(objsrc.lastIndexOf('.'), objsrc.length);
		var presrc = objsrc.replace(ftype, plusnm + ftype);
		return presrc;
	},
	
	del : function (objsrc,plusnm){
		if(objsrc.indexOf(plusnm) == -1) return objsrc;
		var ftype = objsrc.substring(objsrc.lastIndexOf('.'), objsrc.length);
		var presrc = objsrc.replace(plusnm + ftype, ftype);
		return presrc;
	}
}

$(function(){
	module.ImgOver.overfunc();						
});
//----------------------------------------------------------//

//----------------------------------------------------------//
//@global navi
//----------------------------------------------------------//
module.gnv = function(){
		
	var bodyClass = $('body').attr('id');
	if(bodyClass == '') return;
	
	$('#globalNavi a').each(function(){
	
	if($(this).attr('href').indexOf(bodyClass) != -1){
	$(this).find('img').addClass('gnvstay');
	$(this).find('img').attr('src',module.Imgsrc.add($(this).find('img').attr('src'), module.ImgOverSetting.imgfileNameStay));
	}
	
	})	
	
}

$(function(){
module.gnv();
});
//----------------------------------------------------------//


//----------------------------------------------------------//
//@waku
//----------------------------------------------------------//
module.waku = {
	
	tag : $('<img src="/bus/shitamachi/common/i/zoom_icon_01.gif" class="wicon">'),
	
	init : function(){
	
	$.each($('a.imgbox'),function(){
	module.waku.tag.clone().appendTo($(this));
	});
	
	
	$('ul.linkSet li a').mouseover(function(){
	$(this).parents('ul.linkSet').addClass('linkOver');
	});
	
	$('ul.linkSet li a').mouseout(function(){
	$(this).parents('ul.linkSet').removeClass('linkOver');
	});
	
	}
	
}

$(function(){
module.waku.init();
});
//----------------------------------------------------------//





//----------------------------------------------------------//
// scroll TOP
//----------------------------------------------------------//

$(window).load(function(){
							   
	$('a[href^=#pageTop], a[href$=#pageTop],').click(function(){
	$.scrollTo($('#pageTop'),250 ,{easing:'swing'});
	return false;
 	});
 	
	$('a[href^=#anc_]').click(function(){
	$.scrollTo($(this).attr('href'),250 ,{easing:'swing'});
	return false;
 	});
});


//----------------------------------------------------------//
// BOX LINE
//----------------------------------------------------------//

module.boxline = function(){
	
$('div.col3','#contentsArea').each(function(){

var heightA = 0;
var heightB = 0;


	$(this).find('div.box').each(function(){
	
	var elmh = $(this).find('div.inner').height();
	var h3h = $(this).find('h3').height();
	
	if(elmh > heightA){
	heightA = elmh;
	}
	if(h3h > heightB){
	heightB = h3h;
	}
	
	
	});


	$(this).find('div.box').each(function(){
	
	if(module.IE){
	 $(this).find('div.inner').css('height',heightA);
	 $(this).find('h3').css('height',heightB);
	}else{
	 $(this).find('div.inner').css('minHeight',heightA);
	 $(this).find('h3').css('minHeight',heightB);
	}



	});
});


$('div.spotBox','#contentsArea').each(function(){

var heightA = 0;
var ind = [];

$(this).find('li.txt').each(function(index){

var elmh = $(this).height();

if(elmh > heightA){
heightA = elmh;
}
if((index+1)%3==0 && index !=0){
ind.push(heightA);
heightA=0;
}


});

var ii=0;
$(this).find('li.txt').each(function(index){
if((index+1)%3==0 && index !=0){
ii++;
}
if(module.IE){
 $(this).css('height',ind[ii]);
}else{
 $(this).css('minHeight',ind[ii]);
}

});



var heightA = 0;
var ind = [];

$(this).find('ol > li').each(function(index){

var elmh = $(this).height();

if(elmh > heightA){
heightA = elmh;
}
if((index+1)%3==0 && index !=0){
ind.push(heightA);
heightA=0;
}


});

var ii=0;
$(this).find('ol >li').each(function(index){

if(module.IE){
 $(this).css('height',ind[ii]);
}else{
 $(this).css('minHeight',ind[ii]+1);
}
if((index+1)%3==0 && index !=0){
ii++;
}
});





});


}

$(function(){
module.boxline();
});


//----------------------------------------------------------//
// FAQ
//----------------------------------------------------------//

module.faq = function(){
	
	$('ul.faqSet ul').css('display','none');
	$('ul.faqSet a[href^="#faq_"]').toggle(function(){
								  $(this).addClass('clickon');
								  $($(this).attr('href')).slideDown("fast");

							//	 $($(this).attr('href')).css('display','block');
								  
								  return false;
								  },
						function(){
								  $(this).removeClass('clickon');
								  $($(this).attr('href')).slideUp("fast");

							//	 $($(this).attr('href')).css('display','block');
								  
								  return false;
								  }	  
								)}



$(function(){
module.faq();
});

//----------------------------------------------------------//
// blogparts
//----------------------------------------------------------//

$(function(){
$('#blog_parts textarea').click(function(){
										 
	$(this).select();
	
										 
});
});


//----------------------------------------------------------//
// top
//----------------------------------------------------------//

$(function(){


if(document.getElementById('sitetop')){
	
	var contentbox = document.getElementById('content');

	
	$(window).resize(function(){
								  
	var size = module.getViewSize();
	
	var h = parseInt(size['height'],10);
	
	if(h < 601) contentbox.style.height = '600px';
	else contentbox.style.height = '100%';
	
	});
	//window.bind("scroll",module.ImgOver.imgOutFunc);
	
	
	
	
	
	
}




});

module.getViewSize = function(){
		
	var scrollsize = document.body.scrollTop || document.documentElement.scrollTop;
	var sizeset = {};
	
	if (window.innerWidth && window.innerHeight) {
            var bwidth = window.innerWidth;
            var bheight = window.innerHeight;
            sctop = document.body.scrollTop;
        }else if (document.documentElement && document.documentElement.clientWidth != 0) {
            var bwidth = document.documentElement.clientWidth;
            var bheight = document.documentElement.clientHeight;
            sctop = document.documentElement.scrollTop;
        }else if (document.body) {
            var bwidth = document.body.clientWidth;
            var bheight = document.body.clientHeight;
            sctop = document.body.scrollTop;
        }
	
	return sizeset = {'height' : bheight,'width':bwidth,'scrolls':scrollsize};
	
}


})(jQuery);




