/* ------------------------------------
*
*Since: 2007-10-27
*Editor: BBmedia Inc. D_sasaki
*modified: 2007-12-25 D_sasaki
*
-------------------------------------*/

jQuery(document).ready(function() {
								
								
	/* >>> archives <<<-----------*/
	jQuery("#date dd").hide(); //デフォルトで、全てを隠す
	jQuery(".dateArchives #date #dateHeading").addClass('minus').next("dd").show();//月別アーカイブのみ、表示
	
	var year = jQuery("#wrapper").attr("class");//月別アーカイブの、#wrapperのクラスを取得
	
	jQuery("#date dd dl dt").each(function(){//月別アーカイブのみ、その月の見出し（年）にクラスを与え、月を表示
		if(this.className == year) {
			jQuery(this).addClass('minus')
			.next("dd").show();
		}
	});
	
	jQuery('#date #dateHeading').toggle(function() {
		if(!(jQuery(this).next("dd").css("display") == "block")) {				
			jQuery(this).addClass('minus').next('dd').slideDown('fast')
		} else {
			jQuery(this).next('dd').slideUp('fast', function(){jQuery('#date dt').removeClass('minus')})
		}
	},
	function() {
		if(jQuery(this).next("dd").css("display") == "block") {
			jQuery(this).next('dd').slideUp('fast', function(){jQuery('#date dt').removeClass('minus')})
		} else {
			jQuery(this).addClass('minus').next('dd').slideDown('fast')
		}
	});
	
	
	jQuery('#date dd dl dt').toggle(function() {
		if(!(jQuery(this).next("dd").css("display") == "block")) {
			jQuery(this).addClass('minus')
			.next('dd').slideDown('fast')
		} else {
			jQuery(this).next('dd').slideUp('fast', function(){jQuery(this).prev('dt').removeClass('minus');})
		}
	},
	function() {
		if(jQuery(this).next("dd").css("display") == "block") {
			jQuery(this).next('dd').slideUp('fast', function(){jQuery(this).prev('dt').removeClass('minus');})
		} else {
			jQuery(this).addClass('minus')
			.next('dd').slideDown('fast')
		}
	});

	
	/* >>> ifixpng <<<-----------*/
	jQuery('#newsArea p.more img, #vi img, #categories dt img, #recent dt img, #contentBottomArea ul li a, #date dt img, #nextEntry li img, #premiumHeader img, #PremiumMovieArea li img').ifixpng();
	
	
	/* >>> YOUTUBE Write <<<-----------*/
	writeYT();
	//VideoArchivesのYOUTUBE書き出しはreflection.jsで
	
	
	/* >>> thisConnection <<<-----------*/
	jQuery('.thisConnection dd ul li').hover(function() {
		jQuery(this).addClass('over');
	},
	function() {
		jQuery(this).removeClass('over');
	});
	
	jQuery("dl.toggle dt").toggle(
	function(){
		jQuery(this)
		.addClass("close")
		.next("dd")
		.slideUp('fast');							  
	},
	function(){
		jQuery(this)
		.removeClass("close")
		.next("dd")
		.slideDown('fast');		
		
	});
	
	/* >>> search <<<-----------*/
	jQuery("#search").val("SEARCH");
	var swapValues = jQuery("#search").val();
    jQuery("#search").focus(function(){
            if (jQuery(this).val() == swapValues) {
                jQuery(this).val("");
            }
        }).blur(function(){
            if (jQuery.trim(jQuery(this).val()) == "") {
                jQuery(this).val(swapValues);
            }
    });
	
	var tfb={};tfb.allowedLabels=["follow-me","follow-us","follow","my-twitter"];tfb.defaultTop=78;tfb.defaultColor="#35ccff";tfb.isInArray=function(str,ar){if(ar.length<1)return;for(var i=0;i<ar.length;i++){if(ar[i]==str){return true;break;}}
	return false;}
	tfb.showbadge=function(){if(!window.XMLHttpRequest){return;}
	if(document.getElementById('twitterFollowBadge')){document.body.removeChild(document.getElementById('twitterFollowBadge'));}
	if(tfb.top<0||tfb.top>1000||isNaN(tfb.top)){tfb.top=tfb.defaultTop;}
	if(!tfb.isInArray(tfb.label,tfb.allowedLabels)){tfb.label=tfb.allowedLabels[0];}
	var validColorPattern=/^#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$/;if(!validColorPattern.test(tfb.color)||(tfb.color.length!=4&&tfb.color.length!=7)){tfb.color=tfb.defaultColor;};if(tfb.side!='l'){tfb.side='r';}
	tfb.tabStyleCode='position:fixed;'+'top:'+tfb.top+'px;'+'width:30px;'+'height:119px;'+'z-index:8765;'+'cursor:pointer;'+'background:'+tfb.color+' url(http://files.go2web20.net/twitterbadge/1.0/bg-badge/'+tfb.label+'.png);'+'background-repeat:no-repeat;';tfb.aboutStyleCode='position:absolute;'+'top:'+(parseInt(tfb.top)+107)+'px;'+'width:10px;'+'height:11px;'+'z-index:9876;'+'cursor:pointer;'+'background:url(http://files.go2web20.net/twitterbadge/1.0/icon-about.png);'+'background-repeat:no-repeat;';if(tfb.side=='l'){tfb.tabStyleCode+='left:0; background-position:right top;';tfb.aboutStyleCode+='left:0;';}else{tfb.tabStyleCode+='right:0; background-position:left top;';tfb.aboutStyleCode+='right:0;';}
	tfbMainDiv=document.createElement('div');tfbMainDiv.setAttribute('id','twitterFollowBadge');document.body.appendChild(tfbMainDiv);tfbMainDiv.innerHTML='<div id="tfbTab" style="'+tfb.tabStyleCode+'"></div><div id="tfbAbout" style="'+tfb.aboutStyleCode+'"></div>'+'<style>#tfbAbout{visibility:hidden;} #twitterFollowBadge:hover #tfbAbout{visibility:visible;}</style>';document.getElementById('tfbTab').onclick=function(){window.open('http://www.go2web20.net/twitterfollowbadge/redir.htm?'+tfb.account);}
	document.getElementById('tfbAbout').onclick=function(){window.open('http://www.go2web20.net/twitterFollowBadge/');}}
	
	tfb.account = 'SYE_Official';
	tfb.label = 'my-twitter';
	tfb.color = '#1B1F23';
	tfb.side = 'r';
	tfb.top = 136;
	tfb.showbadge();	
});







