/*
* CustomCategory - http://hkdesign.blog91.fc2.com/
*
* Licensed GPL
*
* Date: 2011-11-29
*
* Ver: 1.00
* Ver: 1.01
* 2011-12-01 カテゴリー名が2行になった場合の処理
* 2011-12-06 animationの設定追加
* 2011-12-08 ソート後にclass名付与
* 2011-12-12 CC_tateLineBoxの高さ設定修正
* 2011-12-15 各ImageURLの設定修正
*/
(function(){jQuery.fn.CustomCategory=function(s){s=jQuery.extend({sort_oya:"koariTop_down",sort_ko:"down",tateLineImageURL:"http://blog-imgs-47.fc2.com/h/k/d/hkdesign/image_tateLine_dot01.gif",yokoLineImageURL:"http://blog-imgs-47.fc2.com/h/k/d/hkdesign/image_yokoLine_dot01.gif",openIconImageURL:"http://blog-imgs-47.fc2.com/h/k/d/hkdesign/image_toggleOpen_arrow01.gif",closeIconImageURL:"http://blog-imgs-47.fc2.com/h/k/d/hkdesign/image_toggleClose_arrow01.gif",animation:{scroll:"on",popup:"on"},easing:"easeInOutCirc",duration:0.7,closeCategory:"",cookieMode:"on",cookieConfig:{expires:365}},s);s.duration=s.duration*1000;var u=this;var p=new Array();var f="";var q='';var e='';var r="";var l="";var o=$(u).attr("id");if($.cookie(o)==null||s.cookieMode=="off"){r=""}else{r=$.cookie(o)}if(s.closeCategory!=""){var k=new Array();k=s.closeCategory.split(",");l=",CC_P"+k.join(",CC_P")}if(s.sort_oya=="koariTop_up"||s.sort_oya=="koariTop_down"||s.sort_oya=="konashiTop_up"||s.sort_oya=="konashiTop_down"){var b=new Array();var d=new Array();$(u).children().each(function(v){if($(this).attr("class")=="CC_parentC"){var w=new Array();$(this).next().children().each(function(x){var y="";var y='
'+$(this).html()+"
";w.push({html:y,count:parseInt($(".CC_entNum",this).text())})});switch(s.sort_ko){case"up":w.sort(function(y,x){return y.count>x.count?1:-1});break;case"down":w.sort(function(y,x){return y.count'+t($(this).attr("id"))+''+$(this).html()+'
',count:parseInt($(".CC_entNum",this).text()),ko:w,id:$(this).attr("id")})}if($(this).attr("class")=="CC_noSubC"){d.push({html:''+$(this).html()+"
",count:parseInt($(".CC_entNum",this).text())})}});switch(s.sort_oya){case"koariTop_up":b.sort(function(w,v){return w.count>v.count?1:-1});d.sort(function(w,v){return w.count>v.count?1:-1});p=b.concat(d);break;case"koariTop_down":b.sort(function(w,v){return w.countv.count?1:-1});d.sort(function(w,v){return w.count>v.count?1:-1});p=d.concat(b);break;case"konashiTop_down":b.sort(function(w,v){return w.count";w.push({html:y,count:parseInt($(".CC_entNum",this).text())})});switch(s.sort_ko){case"up":w.sort(function(y,x){return y.count>x.count?1:-1});break;case"down":w.sort(function(y,x){return y.count'+t($(this).attr("id"))+''+$(this).html()+'
',count:parseInt($(".CC_entNum",this).text()),ko:w,id:$(this).attr("id")})}if($(this).attr("class")=="CC_noSubC"){p.push({html:''+$(this).html()+"
",count:parseInt($(".CC_entNum",this).text())})}});switch(s.sort_oya){case"up":p.sort(function(w,v){return w.count>v.count?1:-1});break;case"down":p.sort(function(w,v){return w.count";var n=p[a].ko.length;for(var i=0;i"}}$(u).html(f);m();j();$(".CC_icon_close",u).live("click",function(){var v=$(this);if(s.cookieMode=="on"){if($.cookie(o)==null){var w=","+$(v).parent().attr("id")}else{var w=$.cookie(o)+","+$(v).parent().attr("id")}$.cookie(o,w,s.cookieConfig)}if(s.animation.scroll=="on"&&s.animation.popup=="on"){$(v).parent().next().animate({height:"hide",opacity:"hide"},s.duration,s.easing);$(v).next().next().animate({opacity:"hide"},s.duration,s.easing)}else{if(s.animation.scroll=="on"&&s.animation.popup=="off"){$(v).parent().next().animate({height:"hide"},s.duration,s.easing)}else{if(s.animation.scroll=="off"&&s.animation.popup=="on"){$(v).parent().next().animate({opacity:"hide"},s.duration,s.easing);$(v).next().next().animate({opacity:"hide"},s.duration,s.easing)}else{if(s.animation.scroll=="off"&&s.animation.popup=="off"){$(v).parent().next().css("display","none");$(v).next().next().css("display","none")}else{}}}}$(v).replaceWith(q)});$(".CC_icon_open",u).live("click",function(){var v=$(this);var x=new RegExp(","+$(v).parent().attr("id"),"g");var w=String($.cookie(o)).replace(x,"");$.cookie(o,w,s.cookieConfig);if(s.animation.scroll=="on"&&s.animation.popup=="on"){$(v).parent().next().animate({height:"show",opacity:"show"},s.duration,s.easing);$(v).next().next().animate({opacity:"show"},s.duration,s.easing)}else{if(s.animation.scroll=="on"&&s.animation.popup=="off"){$(v).parent().next().animate({height:"show"},s.duration,s.easing)}else{if(s.animation.scroll=="off"&&s.animation.popup=="on"){$(v).parent().next().animate({opacity:"show"},s.duration,s.easing);$(v).next().next().animate({opacity:"show"},s.duration,s.easing)}else{if(s.animation.scroll=="off"&&s.animation.popup=="off"){$(v).parent().next().css("display","block");$(v).next().next().css("display","block")}else{}}}}$(v).replaceWith(e)});function g(v){if(r.indexOf(v)!=-1||l.indexOf(v)!=-1){return' style="display:none"'}else{return""}}function t(v){if(r.indexOf(v)!=-1||l.indexOf(v)!=-1){return q}else{return e}}function m(){var v=$(u).append('h
').find("#CC_hei");var w=parseFloat($(v).css("height"));$(v).empty();$(".CC_parentC",u).each(function(x){if(parseFloat($(this).height())>w){var y=parseFloat($(this).height())-w;$(".CC_tateLineBox",this).css("height",y+"px")}else{$(".CC_tateLineBox",this).remove()}if($(this).next().css("display")=="none"){$(".CC_tateLineBox",this).css("display","none")}})}function j(){$(".CC_subC_hasnext",u).css("background-image",'url("'+s.tateLineImageURL+'")');$(".CC_subC_end",u).css("background-image",'url("'+s.tateLineImageURL+'")');$(".CC_subC",u).css("background-image",'url("'+s.yokoLineImageURL+'")');$(".CC_tateLineBox",u).css("background-image",'url("'+s.tateLineImageURL+'")')}function h(w){var x=w.length;for(var v=0;v1&&String(e)!=="[object Object]"){b=jQuery.extend({},b);if(e===null||e===undefined){b.expires=-1}if(typeof b.expires==="number"){var g=b.expires,c=b.expires=new Date();c.setDate(c.getDate()+g)}e=String(e);return(document.cookie=[encodeURIComponent(d),"=",b.raw?e:cookie_encode(e),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join(""))}b=e||{};var a,f=b.raw?function(h){return h}:decodeURIComponent;return(a=new RegExp("(?:^|; )"+encodeURIComponent(d)+"=([^;]*)").exec(document.cookie))?f(a[1]):null};function cookie_encode(b){var a=encodeURIComponent(b);var c=a.replace(/(%7B|%7D|%3A|%22|%23|%5B|%5D)/g,function(d){return decodeURIComponent(d)});return c};