// linker init
ad = $.extend({
notOpenURL:'a[href^="http://www.municipal-hospital-sakai-osaka.jp/"]',
openURL:'a.blank',
extendLink:'#sample',
blankIcon:'<img src="/img/common/icon_blank.gif" alt="" class="blank" />',
PDFIcon:'<img src="/img/common/icon_pdf.gif" alt="" class="pdf" />',
WordIcon:'<img src="/img/common/icon_word.gif" alt="" class="word" />',
ExcelIcon:'<img src="/img/common/icon_excel.gif" alt="" class="excel" />',
IconSideSpace:'5px',
ieVerticalSpace:'0.5em',
IconHidden:'.button a'
});


// document ready
$(function(){
	
	
	//alert(location.href);
	
	//HOME main image
	
	if($('ul#sliderContent')[0]){
	$('ul#sliderContent li').show();
	$('ul#sliderContent').innerfade({
          speed: 2000,
          timeout: 5000,
          type: 'sequence',
          containerheight: '200px'
       });
	
	}

	if($('#fontSize')[0]){
	contentSwitchFontSize.main();
	};
	$("a.colorbox").colorbox();
	
	initRollOverImages();
	$('#globalNav').gnavActive();
	$('#localNav ul').snavActive();
	$('a[href^="#"]').not('#main .tab a','#main a.colorbox').slideScroll();

	$('a').filter('ad.extendLink').click(function(){
		return false;
	});
	$('#slideBtn').click(function(){
  		$('#slideNews').slideToggle(1000);
	});
	$('#main h3').not(':has("img"),h3.op1,.longs h3').wrapInner('<span />');


	
$('a[href^="http://"],a[href^="https://"],'+ad.extendLink).linker();
$('a[href^="http://"],a[href^="https://"]').not('a[href$=".pdf"],a[href$=".doc"],a[href$=".docx"],a[href$=".xls"],a[href$=".xlsx"],'+ad.IconHidden+','+ad.notOpenURL).add(ad.openURL).css('text-decoration','none').wrapInner('<span class="anchorIn"></span>').children('span').after(ad.blankIcon);
$('a[href$=".pdf"]').not(ad.IconHidden).wrapInner('<span class="anchorIn"></span>').children('span').after(ad.PDFIcon);
$('a[href$=".doc"],a[href$=".docx"]').not(ad.IconHidden).wrapInner('<span class="anchorIn"></span>').children('span').after(ad.WordIcon);
$('a[href$=".xls"],a[href$=".xlsx"]').not(ad.IconHidden).wrapInner('<span class="anchorIn"></span>').children('span').after(ad.ExcelIcon);
$('img.blank,img.pdf,img.word,img.excel').css({'border':'0','padding-right':ad.IconSideSpace,'padding-left':ad.IconSideSpace});
if($.browser.msie && parseInt($.browser.version, 10) < 7 ){
$('img.blank,img.pdf,img.word,img.excel').css({'padding-top':ad.ieVerticalSpace,'padding-bottom':ad.ieVerticalSpace});
}
$('a[href$=".pdf"],a[href$=".mpg"],a[href$=".doc"],a[href$=".docx"],a[href$=".xls"],a[href$=".xlsx"],a[href$=".wmv"]').css('text-decoration','none').not('a[href^="http://"],a[href^="https://"]').click(function(){
window.open(this.href, '_blank');
return false;
});

	
	//--------------------------------------------------------
	//template css
	//--------------------------------------------------------

	
	$('#main h4:first-child').not('#main h4.op1,#sitemap h4').css('margin-top','0px');
	$('#main .linkBox_col2 li:first-child,#main ul.linkList li:first-child,#main #topicsList dl:first-child,#sub div.cat ul li:first-child,#sub div.arc ul li:first-child').css('background-image','none');
	
	
	$('#main div.indexLink .longs:first-child').css('padding-top','0px');
	$('#contents #main > *:first-child').css('margin-top','0');
	$('#contents #main h3:first-child').not('#main .box .inner').css('margin-top','0');
	

	$('#main div.indexLink .inner').bugFix({'num':'2'});
	$('#main div.indexLink .longs ul li').bugFix({'num':'2'});
	
	$('div.links ul li,div.links_col4 ul li,div.links dl,ul.idnexList_l li').wrapInner('<span class="inner" />');
	$('#main h4.op1').wrapInner('<span class="inner" />');
	$('#main div.box,#main div.box_y').wrapInner('<div class="inner" />');
	
	
	
	$('#sub div.cat ul li:first-child,#sub div.arc ul li:first-child').addClass('first');
	$('#main div.indexLink .inner:nth-child(2n)').addClass('odd');
	$('#main .links ul li:nth-child(2n)').addClass('odd');
	$('#main .links dl:nth-child(2n)').addClass('odd');
	$('#main .linkBox_col2 dl:nth-child(2n)').addClass('odd');
	$('#main ul.linkList li:nth-child(2n)').addClass('odd');
	$('#main ul.stripe li:nth-child(2n)').addClass('odd');
	$('#main #topicsBox dl:nth-child(2n) dd').addClass('odd');
	$('#main div.box_col2_s dl:nth-child(2n)').addClass('odd');
	$('#main div.box_col2 dl:nth-child(2n)').addClass('odd');
	$('#other #main ul.idnexList_l li:nth-child(4n)').addClass('side');
	

	$('#assistNav li a').opacityOver();
	$('#langNav li a').opacityOver();
	$('#sub .banners a').opacityOver();
	$('#sub #localNav h3 a').opacityOver();
	$('#footNav li a').opacityOver();
	$('#bnrBox a').opacityOver();
	$('#mainBox li a').opacityOver();
	$('#main p.list a').opacityOver();
	$('#main p.tolist a').opacityOver();
	$('#topBanners li').opacityOver();
	
	
	

	$('#footNavInner > div').flatHeights();
	
	flatColumns('#main div.ttl_med','dl','2','null');
	flatColumns('#main div.indexLink .longs ul','li','2','null');
	flatColumns('#main .links_col4 ul','li','4','null');
	flatColumns('#main .links ul','li','2','null');
	flatColumns('#main .linkBox_col2','dl','2','null');
	flatColumns('#main .indexLink','div.inner','2','null');
	
	flatColumns('#main ul.index','li','2','null');
	flatColumns('#main ul.col2BoxY','li','2','null');
	flatColumns('#main ul.col2BoxW','li','2','null');
	flatColumns('#main ul.col3BoxY','li','3','null');
	flatColumns('#main ul.col3BoxW','li','3','null');
	flatColumns('#main ul.imgList','li','3','null');
	flatColumns('#main div.box_col2_s','dl','2','null');
	flatColumns('#main div.box_col2','dl','2','null');
	flatColumns('ul.idnexList_l','li','4','null');
	
	
	

	$(ad.extendLink).hover(function(){
		$(this).addClass('hover');
		$(this).find('dt img').animate({opacity:0.7},0);
	},function(){
		$(this).removeClass('hover');
		$(this).find('dt img').animate({opacity:1},0);
	});
	
	
	var notNum = '#topicPath,#pagenation ol';
	$("#main ol").not(notNum).addClass("numList").each(function(){
	$(this).children("li").each(function(i){
	i = i+1;
	if(i > 9){
	$(this).prepend('<span class="num">'+ i +'.'+'&nbsp;'+'</span>');
	}else{
	$(this).prepend('<span class="num">&nbsp;&nbsp;'+ i +'.'+'&nbsp;'+'</span>');
	}
	});
	});
	
//======================================================== topics	
	$('#topicsBox dt').hover(function(){
	$(this).add($(this).next('dd')).addClass('hover');
	},function(){
	$(this).add($(this).next('dd')).removeClass('hover');
	});
	
	$('#topicsBox dd').hover(function(){
	$(this).add($(this).prev('dt')).addClass('hover');
	},function(){
	$(this).add($(this).prev('dt')).removeClass('hover');
	});

	
	
	
	// capContain 
$("img.capContain").each(function(){
var icT = $(this).attr("title").split("｜").join("<br />").split('“').join('<em>').split('”').join('</em>'),
icW = $(this).width();
if($(this).parent('a').length){
$(this).parent('a').removeAttr("title").after('<span class="imgCap">'+ icT +'</span>');
$(this).parent('a').next("span.imgCap").width(icW).css("display","block");
}else{
$(this).removeAttr("title").after('<span class="imgCap">'+ icT +'</span>');
$(this).next("span.imgCap").width(icW).css("display","block");
}
});

// tab ----------------------------------------
if($(".tab").length){
	var tabs = ".tab";
	var tabNavActive = "active";
	var tabExtension = "gif";


	$(tabs).each(function(){
		var tabNav = $(this).children('li').children('a');
			
		$(tabNav).hover(function(){
			$(this).not('.'+tabNavActive).children("img").attr("src",$(this).children("img").attr("src").replace('.'+tabExtension,'_on.'+tabExtension));
		},function(){
			$(this).not('.'+tabNavActive).children("img").attr("src",$(this).children("img").attr("src").replace('_on',''));
		});
		
		

		$(tabNav).click(function(e){
			$(tabNav).not(this).each(function(){
				var tabBodyList = $(this).attr("href");
				$(tabBodyList).hide(0);
			});
			if($(tabNav).not(this).filter('.'+tabNavActive).length){
				$(tabNav).not(this).filter('.'+tabNavActive).children("img").attr("src",$(tabNav).filter('.'+tabNavActive).children("img").attr("src").replace('_on','')).parent().removeClass(tabNavActive);
			}
			$($(this).attr('href')).show(0);
			$(this).not('.'+tabNavActive).addClass(tabNavActive);

			return false;
		});
		if(location.hash.length != -1){var hashContains = $(tabs).html();}
		if(location.hash.length == 0){
			$(tabNav).filter(':first').addClass(tabNavActive).children("img").attr("src",$(tabNav).filter(':first').children("img").attr("src").replace('.'+tabExtension,'_on.'+tabExtension));
			var defaultTab = $(tabNav).not("#area a").filter(':first').attr('href');
			$(defaultTab).show(0);
		} else if(hashContains.indexOf(location.hash) != -1) {
			var thisHash = location.hash;
			$(tabNav).filter("a[href='"+thisHash+"']").addClass(tabNavActive).children("img").attr("src",$(tabNav).filter("a[href='"+thisHash+"']").children("img").attr("src").replace('.'+tabExtension,'_on.'+tabExtension));
			$(thisHash).show(0);
			var focusPos = $.support.boxModel ? navigator.appName.match(/Opera/) ? "html" : "html,body" : "body";
			var tabsOffset = $(tabs).offset().top-50;
			$(focusPos).animate({scrollTop: tabsOffset + 'px'},300,'swing');
		};
	});
	
	$($(tabs).children('li').children('a')).not('.'+tabNavActive).each(function(){
		var defaultHiddenTabs = $(this).attr("href");
		$(defaultHiddenTabs).hide(0);

	});
	
}


	//--------------------------------------------------------
	
		
	// pngfix function
	if(jQuery.browser.msie && parseInt(jQuery.browser.version) == 6){
		$('#container h2').not('#index,#feature h2').wrapInner('<span class="ttl" />');
		$("#container h2 img,#topBanners li a img").pngfix();
	}

	$('#main .imgAlignBox').each(function(){
		if($(this).children('.partsR,.partsL').length){
			var imgWidth = $(this).children('.partsR,.partsL').find('img').width();
			$(this).children('*').not('.partsR,.partsL').wrapAll('<div class="imgBoxInner"></div>');
			if($(this).children('.partsR').length){
				$(this).children('.imgBoxInner').css('padding-right',imgWidth+20);
			}else if($(this).children('.partsL').length){
				$(this).children('.imgBoxInner').css('padding-left',imgWidth+20);
			};
		}
	});

});

// SwitchFontsize
var contentSwitchFontSize = {
conf : {
fontSize     : ["140%","130%","117%"],
switchId     : ["switchFontSizeBig", "switchFontSizeMedium", "switchFontSizeSmall"],
defoSizeId   : "switchFontSizeSmall",
targetAreaId : ["main"],
cookieName   : "fontSize",
cookieLimit  : 30,
switchWriteArea : "fontSize",
switchHTML      : '<ul><li id="switchFontSizeSmall" style="text-indent:-9999px;">標準</li><li id="switchFontSizeMedium" style="text-indent:-9999px;">大</li><li id="switchFontSizeBig" style="text-indent:-9999px;">特大</li></ul>'
},
main : function(){
contentSwitchFontSize.setHTML();
contentSwitchFontSize.defo();
var i, j, switchItem = contentSwitchFontSize.conf.switchId;
for(i=0;i<switchItem.length;i++){
document.getElementById(switchItem[i]).onclick = contentSwitchFontSize.action;
}
},
setHTML : function(){
var fontsizeSwitch = document.createElement('div');
fontsizeSwitch.id  = "fontsizeControl";
fontsizeSwitch.innerHTML = contentSwitchFontSize.conf.switchHTML;
document.getElementById(contentSwitchFontSize.conf.switchWriteArea).appendChild(fontsizeSwitch);
},
defo : function(){
var i;
var switchId = contentSwitchFontSize.conf.switchId;
var targetAreaId = contentSwitchFontSize.conf.targetAreaId;
var fontSize = contentSwitchFontSize.conf.fontSize;
cookieValue = this.getCookie() || contentSwitchFontSize.conf.defoSizeId;
for(i = 0; i < switchId.length; i++){
if(cookieValue == switchId[i]){
document.getElementById(targetAreaId).style.fontSize = fontSize[i];
}
}
document.getElementById(cookieValue).className ="active";
},
action : function(){
var i;
var switchId = contentSwitchFontSize.conf.switchId;
var targetAreaId = contentSwitchFontSize.conf.targetAreaId
var fontSize = contentSwitchFontSize.conf.fontSize
for(i=0;i<switchId.length;i++){
var switchItem = document.getElementById(switchId[i]);
switchItem.className="";
if(this.id == switchId[i]){
document.getElementById(targetAreaId).style.fontSize = fontSize[i];
}
}
this.className ="active";
contentSwitchFontSize.setCookie(this.id);
},
setCookie: function(data) {
var today = new Date();
today.setTime(today.getTime() + (1000 * 60 * 60 * 24 * Number(this.conf.cookieLimit)));
document.cookie = this.conf.cookieName + '=' + encodeURIComponent(data) + '; path=/; expires=' + today.toGMTString();
},
getCookie: function(m) {
return (m = ('; ' + document.cookie + ';').match('; ' + this.conf.cookieName + '=(.*?);')) ? decodeURIComponent(m[1]) : null;
}
}


/*
flatheights.js---------------------------------------------------------------------------
Version: 2007-08-01
Copyright (c) 2007, KITAMURA Akatsuki
$.changeLetterSize.addHandler(func)
*/
$.changeLetterSize={handlers:[],interval:1000,currentSize:0};(function($){var self=$.changeLetterSize;var ins=$('<ins>M</ins>').css({display:'block',visibility:'hidden',position:'absolute',padding:'0',top:'0'});var isChanged=function(){ins.appendTo('#main');var size=ins[0].offsetHeight;ins.remove();if(self.currentSize==size)return false;self.currentSize=size;return true;};$(isChanged);var observer=function(){if(!isChanged())return;$.each(self.handlers,function(i,handler){handler();});};self.addHandler=function(func){self.handlers.push(func);if(self.handlers.length==1){setInterval(observer,self.interval);}};})(jQuery);(function($){var sets=[];var flatHeights=function(set){var maxHeight=0;set.each(function(){var height=this.offsetHeight;if(height>maxHeight)maxHeight=height;});set.css('height',maxHeight+'px');};$.fn.flatHeights=function(){if(this.length>1){flatHeights(this);sets.push(this);}
return this;};$.changeLetterSize.addHandler(function(){$.each(sets,function(){this.height('auto');flatHeights(this);});});})(jQuery);function flatColumns(flatParent,flatTarget,columNum,notElem){$(flatParent).each(function(){var sets=[],temp=[];if(columNum==2){$(this).find(flatTarget).not(notElem).each(function(i){temp.push(this);if((i+1)%2==0&&i!=0){sets.push(temp);temp=[];}});if(temp.length)sets.push(temp);}else if(columNum==3){$(this).find(flatTarget).not(notElem).each(function(i){temp.push(this);if(i%3==2){sets.push(temp);temp=[];}});if(temp.length)sets.push(temp);}else if(columNum==4){$(this).children(flatTarget).not(notElem).each(function(i){temp.push(this);if((i+1)/4>=1&&(i+1)%4==0){sets.push(temp);temp=[];}});if(temp.length)sets.push(temp);}else if(columNum==5){$(this).children(flatTarget).not(notElem).each(function(i){temp.push(this);if((i+1)/5>=1&&(i+1)%5==0){sets.push(temp);temp=[];}});if(temp.length)sets.push(temp);}
$.each(sets,function(){$(this).flatHeights();});});}


// Rollover

function initRollOverImages() {
	var image_cache = new Object();
	$("#globalNav li a img,#sub .button img,img.imgover,#pageTop a img,#pickupNav a img,#globalNav_l a img").each(function(i) {
	var imgsrc = this.src;
	var dot = this.src.lastIndexOf('.');
	var imgsrc_ro = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
	image_cache[this.src] = new Image();
	image_cache[this.src].src = imgsrc_ro;
	$(this).hover(
		function() {if(!$(this).hasClass("active")){this.src = imgsrc_ro;} },
		function() {if(!$(this).hasClass("active")){this.src = imgsrc; }})
	});
}


// opacityOver
$.fn.opacityOver = function(){
	return this.each(function(){
		$(this).hover(function(){
			$(this).animate({'opacity':0.6},{duration:0,queue:false});
		},function(){
			$(this).animate({'opacity':1},{duration:0,queue:false});
		});
	});
};


// slideScroll
$.fn.slideScroll = function(){
	return this.click(function(){
		var slidingTarget = $.support.boxModel ? navigator.appName.match(/Opera/) ? "html" : "html,body" : "body";
		var targetPos = $(this.hash).offset().top;
		$(slidingTarget).animate({scrollTop:targetPos},{duration:400,easing:'easeOutQuad',queue:false});
		return false;
	});
};




// gnavActive
$.fn.gnavActive = function(){
	//var pagePath = location.href.replace(ad.domain,'');
	return this.each(function(){	
		$(this).find('a').each(function(){
		if($("a.index").attr('href') != ('index.html')){
			if($(this).attr('href').replace('../','')=='index.html'){
				var image_cache = new Object();
				$(this).not($("a.index")).children('img').each(function(){
					var	imgsrc = this.src,
					dot = this.src.lastIndexOf('.'),
					imgsrc_ro = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
					image_cache[this.src] = new Image();
					image_cache[this.src].src = imgsrc_ro;
					this.src = imgsrc_ro;
					$(this).hover(function() {
					this.src = imgsrc_ro;
					});
				});
			}
		}
		
		});
	});
};


				

$.fn.snavActive = function(){
	var	pagePath = location.href.replace(ad.domain,'');
	return this.each(function(){
		$(this).find('a').each(function(){
			if(pagePath.search($(this).attr('href')) >=0 || $(this).attr('href').replace('../','')=='index.html'){
				$(this).addClass('active');
				if($(this).parent('li').parent('ul').parent('li').length){
					$(this).parent('li').parent('ul').parent('li').children('a').addClass('active');
				}
			}
		});
	});
};















(function($) {
	// linker
	$.fn.linker = function(){
		return this.click(function(e){
			e.preventDefault();

			if($(this).find("a").length){
				var targetAnc=$(this).find("a");
			}else if($(this).next("dd").find("a").length){
				var targetAnc=$(this).next("dd").find("a");
			}else if($(this).prev("dt").find("a").length){
				var targetAnc=$(this).prev("dt").find("a");
			}else{
				var targetAnc=$(this);
			};

			if($(targetAnc).attr("href")==undefined){
				$(this).css('cursor','auto');
				return false;
			}else if($(targetAnc).is('[href$=".pdf"],[href$=".doc"],[href$=".docx"],[href$=".xls"],[href$=".xlsx"]')){
				window.open($(targetAnc).attr("href"),"_blank");
			}else if($(targetAnc).is('a[href^="http://"]')==false && $(targetAnc).is('a[href^="https://"]')==false){
				window.location.href=$(targetAnc).attr("href");
			}else if($(targetAnc).filter(ad.notOpenURL).length && !$(targetAnc).is(ad.openURL)){
				window.location.href=$(targetAnc).attr("href");
			}else if($(targetAnc).is(ad.openURL)){
				window.open($(targetAnc).attr("href"),"_blank");
			}else{
				window.open($(targetAnc).attr("href"),"_blank");
			};
		});
	};
})(jQuery);

// stripe
$.fn.jStripe = function(option){
	var temp = 'odd';
	if(option){
		var temp = option;
	}
	return this.each(function(i){
		if(!((i+1)%2-1==0 || i==0)){
			$(this).addClass(temp);
		};
	});
};

// easing
$.extend($.easing,
	{
		def: 'easeOutQuad',
		swing: function (x, t, b, c, d) {
		return $.easing[$.easing.def](x, t, b, c, d);
	},
		easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
		easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
		easeInBack: function (x, t, b, c, d, s) {
			if (s == undefined) s = 1.70158;
			return c*(t/=d)*t*((s+1)*t - s) + b;
	},
		easeOutBack: function (x, t, b, c, d, s) {
			if (s == undefined) s = 1.70158;
			return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	}
});

(function($) {
// bugFix
$.fn.bugFix = function(options){
if((($.browser.msie && $.browser.version < 9) || ($.browser.mozilla && parseFloat($.browser.version.substr(2,3)) < 9.1)) && $(this).length){
if($(this).length>1){
var opt = [];
$(this).each(function(i){
opt[i] = new BugFix(this,options);
});
return opt;
}else{
return new BugFix(this,options);
}
};
};


var BugFix = function(_select, options){
this.temp = {
act : 'side', // or hover or stripe or first or last
num : null
};

$.extend(this.temp, options || {});
this.target = $(_select);

this.events();
};

BugFix.prototype = {
events:function(){
var action = this.temp.act;
if(action == 'side'){
this.side();
}else if(action == 'hover' && $.browser.msie && $.browser.version < 7){
this.hover();
}else if(action == 'stripe'){
this.stripe();
}else if(action == 'first'){
this.first();
}else if(action == 'last'){
this.last();
}
},
hover:function(){
this.target.hover(function(){
$(this).addClass('hover');
},function(){
$(this).removeClass('hover');
});
},
side:function(){
var num = this.temp.num+"n";
this.target.filter(':nth-child('+num+')').addClass('side');
},
stripe:function(){
varparent = this.target.parent(),
tag = this.target[0].tagName;
$(parent).children(tag).each(function(i){
if((i+1)%2-1==0 || i==0){
$(this).addClass('odd');
}
});
},
first:function(){
this.target.filter(':first-child').addClass('first');
},
last:function(){
this.target.filter(':last-child').addClass('last');
}
};})(jQuery) 


// linker

$.fn.linker = function(){
return this.click(function(e){
e.preventDefault();

if($(this).find("a").length){
var targetAnc=$(this).find("a");
}else if($(this).next("dd").find("a").length){
var targetAnc=$(this).next("dd").find("a");
}else if($(this).prev("dt").find("a").length){
var targetAnc=$(this).prev("dt").find("a");
}else{
var targetAnc=$(this);
};

if($(targetAnc).attr("href")==undefined){
$(this).css('cursor','auto');
return false;
}else if($(targetAnc).is('[href$=".pdf"],[href$=".doc"],[href$=".docx"],[href$=".xls"],[href$=".xlsx"]')){
window.open($(targetAnc).attr("href"),"_blank");
}else if($(targetAnc).is('a[href^="http://"]')==false && $(targetAnc).is('a[href^="https://"]')==false){
window.location.href=$(targetAnc).attr("href");
}else if($(targetAnc).filter(ad.notOpenURL).length && !$(targetAnc).is(ad.openURL)){
window.location.href=$(targetAnc).attr("href");
}else if($(targetAnc).is(ad.openURL)){
window.open($(targetAnc).attr("href"),"_blank");
}else{
window.open($(targetAnc).attr("href"),"_blank");
};
});
};


// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=D=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"このウィンドウを閉じる",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",E=b.browser.msie&&!b.support.opacity,X=E&&b.browser.version<7,P=i+"_IE6",x,j,A,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,B,C,y,z,l,g,a,u,D,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-B,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-C,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;A[0].style.width=A[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);D=c;A[0].style.width=a.w+z+C+"px";A[0].style.height=a.h+y+B+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-C;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-B;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g<l-1?"show":"hide"]().html(a.next);H[q||g?"show":"hide"]().html(a.previous);p=g?h[g-1]:h[l-1];m=g<l-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){c=b.data(m,r).href||m.href;f=b.data(p,r).href||p.href;c=b.isFunction(c)?c.call(m):c;f=b.isFunction(f)?f.call(p):f;if(U(c))b("<img/>")[0].src=c;if(U(f))b("<img/>")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:c}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==c}).css({visibility:c}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(e,0,function(){l(0)}):l(e)}};d.load=function(u){var n,c,s,q=d.prep;D=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-B:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-C:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];c.name=i+ +new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(E)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!D){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!D){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this);






/*
 * jQuery (PNG Fix) v1.2
 * Microsoft Internet Explorer 24bit PNG Fix
 *
 * The MIT License
 * 
 * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @param		Object
 * @return		Array*/

(function($) {$.fn.pngfix = function(options) {var elements = this;var settings = $.extend({imageFixSrc: false,sizingMethod: false }, options);if(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)) {return(elements);}function setFilter(el, path, mode) {var fs = el.attr("filters");var alpha = "DXImageTransform.Microsoft.AlphaImageLoader";if (fs[alpha]) {fs[alpha].enabled = true;fs[alpha].src = path; fs[alpha].sizingMethod = mode;} else {el.css("filter", 'progid:' + alpha + '(enabled="true", sizingMethod="' + mode + '", src="' + path + '")');}}function setDOMElementWidth(el) {if(el.css("width") == "auto" & el.css("height") == "auto") {el.css("width", el.attr("offsetWidth") + "px");}}return(elements.each(function() {var el = $(this);if(el.attr("tagName").toUpperCase() == "IMG" && (/\.png/i).test(el.attr("src"))) {if(!settings.imageFixSrc) {el.wrap("<span></span>");var par = el.parent();par.css({height: el.height(),width: el.width(),display: "inline-block"});setFilter(par, el.attr("src"), "scale");el.remove();} else if((/\.gif/i).test(settings.imageFixSrc)) {setDOMElementWidth(el);setFilter(el, el.attr("src"), "image");el.attr("src", settings.imageFixSrc);}} else {var bg = new String(el.css("backgroundImage"));var matches = bg.match(/^url\("(.*)"\)$/);if(matches && matches.length) {setDOMElementWidth(el);el.css("backgroundImage", "none");var sc = "crop";if(settings.sizingMethod) {sc = settings.sizingMethod;} setFilter(el, matches[1], sc);el.find("a").each(function() {$(this).css("position", "relative");});}}}));}})(jQuery) 


