// JavaScript Document


	/* --------------------------------------------------------------------*/
	/*  this.javascript.made.by tsuyoshi higuchi	 __wpe__
	/*  Copyright 2009
	/* --------------------------------------------------------------------*/
	

	/* call functions from here    */
	$(document).ready(function(){
		
		/* mac color set */
		var os, ua = navigator.userAgent;
		if (ua.match(/Mac|PPC/)) 
		{
			$('#bottommenu').css('background','#DCDCDC');
			$('#bottomblk').css('background','#D0D0D0 url(../img/interface/bg_bottom.jpg) repeat-x 0 0');
		}


		more(0, 'profilemore');
			
		/* lightbox use */
		$('a[@rel*=lightbox]').lightBox();
		
		/* smoothclick use */
		smoothclick();
		if(location.href.match(/\#([\w]+)/)){
			var te = "#"+RegExp.$1;
			smooth(te);
		}
		
		/* othertag */
		if( $("div#othertag").html() )
		{
			$("div#others").html( $("div#othertag").html() );
			$("div#others").attr("class","cb8px");
			$("div#othertag").remove();
		}
		
		/* search */
		if( $("div#othersearch").html() )
		{
			$("div#others").html( $("div#othersearch").html() );
			$("div#others").attr("class","cb8px");
			$("div#othersearch").remove();
			
		}
		
		/* corner 8px curve box use */
		settings_8px = {
			tl: { radius: 8 },
			tr: { radius: 8 },
			bl: { radius: 8 },
			br: { radius: 8 },
			antiAlias: true, autoPad: true, validTags: ["div"]
		}
		var myBoxObject8 = new curvyCorners(settings_8px, "cb8px");
		myBoxObject8.applyCornersToAll();
		
		
		/* corner 4px curve box use */
		settings_4px = {
			tl: { radius: 4 },
			tr: { radius: 4 },
			bl: { radius: 4 },
			br: { radius: 4 },
			antiAlias: true, autoPad: true, validTags: ["div"]
		}
		var myBoxObject4 = new curvyCorners(settings_4px, "cb4px");
		myBoxObject4.applyCornersToAll();
		/*
		contentslist();
		*/
		centerput();
		sizefit();	
	});
	
	
	function more( atc, trg )
	{
		$('a[@rel*=moreopen]').html("続きをみる");
		if( atc == 0 )	//init
		{
			$('a[@rel*=moreopen]').attr('href','javascript:more(1, "'+trg+'")');
			$('div[@class*='+trg+']').slideUp("first");
		}
		if( atc == 1 )	//open
		{
			$('a[@rel*=moreopen]').attr('href','javascript:more(2, "'+trg+'")');
			$('a[@rel*=moreopen]').html("閉じる");
			$('div[@class*='+trg+']').slideDown("first");
		}
		if( atc == 2 )	//close
		{
			$('a[@rel*=moreopen]').attr('href','javascript:more(1, "'+trg+'")');
			$('div[@class*='+trg+']').slideUp("first");
		}
	}
	
	$("body").load(
		function()
		{
			contentslist();
			centerput();
			sizefit();	
		}
	);
	
	function sizefit()
	{
		$(window).resize
		(
			function()
			{
				centerput();
			}
		);
	}
		
	function centerput()
	{
		var isMSIE = /*@cc_on!@*/false;
		if (!isMSIE)
		{
			w = $("html").width();
			ws = w % 2;
			if( ws > 0 ) window.resizeBy(-1, 0);
			$("#searchblk").attr("class","cb4px");
		}else{
			$("#others").attr("class","");
		}
	}
	
	/*
	function contentslist()
	{
		var listobj = new Object();
		var view = '<li id="sel_a"></li>';		
		if( $("#selectcontents").html() )
		{
			var select_element = document.getElementById("selectcontents");
			for ( var i = 0; i < select_element.options.length; i++ )
			{
				inde = select_element.options[i].value;
				listobj [ inde ] = select_element.options[i].text;
				vie = '<li id="sel_'+inde+'">'+listobj [ inde ]+'</li>';
				view += vie;
			}
			$("#selectcontentslist").append("<ul></ul>");
			$("#selectcontentslist > ul").html(view);
			$("#others .hidden").hide();
			$("#selectcontentslist > ul > li").hide();
			$("#selectcontentslist > ul > li:first").show();
			
			$("#selectcontentslist > ul > li#sel_a").html($("#selectcontentslist > ul > li:eq(1)").html());
			
			$("#selectcontentslist > ul > li").click
			(
				function()
				{
					blg = $( this ).attr("id");
					$("#selectcontentslist > ul > li#sel_a").html($("#selectcontentslist > ul > li#"+blg).html());
					
					bid = blg.split("_");
					$("#includeblog").attr("value",bid[1]);
					$("#selectcontentslist > ul > li").hide();
					$("#selectcontentslist > ul > li:first").show();
				}
			);
			
			$("#selectcontentslist > ul > li").mouseover
			(
				function ()
				{
					$(this).css("backgroundColor","#00abe3");
					$(this).css("color","#fff");
				}
			);
			$("#selectcontentslist > ul > li").mouseout
			(
				function ()
				{
					$(this).css("backgroundColor","#fff");
					$(this).css("color","#666");
				}
			);
			
			$("#selectcontentslist > ul").hover
			(
				function ()
				{
					$("#selectcontentslist > ul > li").show();
					$("#selectcontentslist > ul > li:first").hide();
				},
				function ()
				{
					$("#selectcontentslist > ul > li").hide();
					$("#selectcontentslist > ul > li:first").show();
				}
			);
			
			$("#searchkeyform").submit
			(
				function()
				{
					if( !$("#searchkey").attr("value") || $("#searchkey").attr("value") == " " || $("#searchkey").attr("value") == null )
					{
						alert( "検索キーを入力してください。" );
						return false;
					}
				}
			);
		}		
	}
	*/
	
	function callflash( file, fid, id, na, ws, hs,  v, me, wm, aca, bg, vars, sa, sc, al )
	{
		$(id).html('このコンテンツを表示するにはFlashPlayer'+v+'以上をインストールしてください。');
		
		if( aca == null ) aca = "allowScriptAccess";
		if( bg == null ) aca = "null";
		if( vars == null ) flashvars = "null";
		else flashvars = vars;

		var params = {
				menu: me,
				wmode: wm,
				scale: sc,
				salign: sa,
				align: al
		};
		var attributes = {
				id: na,
				name: na
		};
						
		var isMSIE = /*@cc_on!@*/false;
		if (isMSIE)
			{
				vv = v.split(".");
				var tmp = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").match(/([0-9]+)/);
				vsn = tmp[0];
				if( Number ( vsn ) >= Number( vv[0] ) )
				{
					ieflash =  '<embed src="'+file+'" quality="high" width="'+ws+'" height="'+hs+'" name="'+na+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" wmode="'+wm+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" salign="'+sa+'" scale="'+sc+'" align="'+al+'" />';
					$("#"+fid).empty();
					$("#"+fid).html(ieflash);
				}
			}else{
				swfobject.embedSWF(file, id, ws, hs, v, null , flashvars, params, attributes);
			}
	}
	
	
	
	
	
	
	
	
	
	

	
	function smooth( h )
	{
		
		var $target = $(h);
		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
		
		if ($target.length)
		{
			var targetOffset = $target.offset().top - 200;
			$('html,body').animate({scrollTop: targetOffset}, 1000);
			return false;
		}
		
	}
	
	function smoothclick()
	{

		$('a[href*=#]').click(function() {
			
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname)
			{
				
				var $target = $(this.hash);
				$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				if ($target.length)
				{
					
					var targetOffset = $target.offset().top - 200;
					if (typeof document.body.style.maxHeight != "undefined") $('html,body').animate({scrollTop: targetOffset}, 1000);
					else $('html,body').animate({scrollTop: targetOffset}, 1000);
					return false;
				}
			}
		});
	
	}
	
	
	function wopen(url,wnam,wsize,hsize,scrollflg,resizeflg) {
		if(!scrollflg) scrollflg = 'yes';
		if(!resizeflg) resizeflg = 'yes';
		
		if (url) {
			this.wstate = "width="+wsize+",height="+hsize+",scrollbars="+scrollflg+",resizable="+resizeflg;
			opwin = window.open(url,wnam,this.wstate);
			opwin.focus();
		}
	}
	
	
	function print_out() {
		if (navigator.userAgent.match(/msie (¥d)/i)) v = (eval(RegExp.$1) >= 5) ? 1 : 0;
		else if (self.innerWidth) v = (eval(navigator.appVersion.charAt(0)) >= 4) ? 1 : 0;
		else v = 0;
		
		if (v) self.print();
		else alert("Sorry! This Browser do not use print out...");
	}


