
	/* --------------------------------------------------------------------*/
	/*  this.javascript.made.by tsuyoshi higuchi	 __wpe__
	/*  Copyright 2009
	/* --------------------------------------------------------------------*/
	
	var isMSIE = /*@cc_on!@*/false;
	if (isMSIE)
	{
		jQuery(
			function($j)
			{
				$j('#global').positionFixed();
				$j('#overlayer').positionFixed();
			}
		);
	}
	
	/* call functions from here    */
	$(document).ready(function(){
		
		
		/* home */
		if( $('#home').html() ) homemain();
	
		/* works */
		if( $('#worksblk').html() )
		{
			$('a[rel*=worksslider]').each
			(
				function(i)
				{
					hrf = $(this).attr('href').split('#').join('')
					$(this).attr("href","javascript:worksset('"+String(hrf)+"')");
				}
			);
		}
		if( $('#worksblk').html() ) worksset('w1',0);
		
		/* implementation */
		if( $('#implementation').html() || $('#works').html() ) impoverlayinit();
		
		/* inquiryformframe */
		inquiryformframe()
		
		/* last no border */
		lastnoborder()
		
		/* homeframe */
		homeframe()
		
		/* accessframe */
		accessframe()
		
		/* outline line */
		outlineline()
		
		/* buyinfo */
		buyinfo()
		
		/* carlayoutbset */
		carbset()
		
		/* exhibision */
		exhibision();
		
		/* imgborder */
		//imgborder()
		
		/* logoclick */
		$('h1').click(	function(){	location.href = "/";	}	);
		
		/* target blank rel use */
		$('a[rel*=blank]').attr("target","_blank");
		
		/* lightbox use */
		$('a[rel*=lightbox]').lightBox();
		
		/* smoothclick use */
		smoothclick();
		if(location.href.match(/\#([\w]+)/)){
			var te = "#"+RegExp.$1;
			smooth(te);
		}
		
	});
	
	
	function impoverlaycall(p)
	{
		if( p && p != undefined && p != "" && p != null )
		{
			var ti = 0;
			var pid = '';
			var ptag ='';
			var mypid ='';
			
			smooth('#headerblk');
			
			$('#implementationentry #wearout').text('');
			$('#implementationentry #greenout').text('');
			
			$('#implementationentry #mainmonitor img:first').show();
			
			$('#overlayer').fadeIn();
			$('#implementationentry').fadeIn();
			
			pid = '#'+p.id;
			ptag = p.tagName;
			pidmax = $('#entries '+ptag).length;
			mypid = Number( p.id.split('e')[1] );
			$('#entries ul li').each(
				function(i)
				{
					if( '#'+$(this).attr('id') == pid )
					{
						mynum = i;
						return false;
					}
				}
			);
			
			
			/* view */
			$('#implementationentry h6').text($(pid+' dl dt').text());
			if( $(pid+' dl dd.date').text() && $(pid+' dl dd.date').text() != undefined && $(pid+' dl dd.date').text() != "" && $(pid+' dl dd.wear').text() != null ) $('#implementationentry .date').text($(pid+' dl dd.date').text());
			
			if( $(pid+' dl dd.green').text() && $(pid+' dl dd.green').text() != undefined && $(pid+' dl dd.green').text() != "" && $(pid+' dl dd.wear').text() != null ) $('#implementationentry #greenout').text($(pid+' dl dd.green').text());
			
			if( $(pid+' dl dd.wear').text() && $(pid+' dl dd.wear').text() != undefined && $(pid+' dl dd.wear').text() != "" && $(pid+' dl dd.wear').text() != null ) $('#implementationentry #wearout').text($(pid+' dl dd.wear').text());
			if( $(pid+' dl dd.comment').text() && $(pid+' dl dd.comment').text() != undefined && $(pid+' dl dd.comment').text() != "" && $(pid+' dl dd.wear').text() != null ) $('#implementationentry .comment').html($(pid+' dl dd.comment').html());
			
			
			$('#implementationentry #mainmonitor').html('<img src="/img/interface/ajax-loader.gif" alt="" /><img src="'+$(pid+' a[rel=overlay]').attr('href')+'" alt="" id="loadimg" />');
			$('img#loadimg').css('position','absolute');
			$('img#loadimg').css('top','-9999px');
			$('img#loadimg').css('left','-9999px');
			
			$('#implementationentry #mainmonitor img#loadimg').load(
				function()
				{
					$('#implementationentry .comment').html();
					click_pflg = click_nflg = true;
					$('#implementationentry #mainmonitor img:first').hide();
					$('#implementationentry #mainmonitor').css('padding','0');
					$('img#loadimg').css('position','static');
					ih = $('img#loadimg').height();
					$('#implementationentry #mainmonitor').animate(
						{	height: ih	},
						{	duration: 'slow' }
					);
					
					
					/* next prev */
					if( pidmax > 1 )
					{
						
						if( mynum > 0 )
						{
							$('#lyrprev').fadeTo('slow',1);
							$('#lyrprev').one('click',
								function()
								{
									ti = mynum - 1;
									if( click_pflg ) impoverlaycall($('#entries ul li:eq('+ti+')').get(0));
									click_pflg = click_nflg = false;
									impoveyreset();
								}
							);
						}else{
							$('#lyrprev').fadeTo('slow',0.2);
						}
						if( mynum < pidmax - 1 )
						{
							$('#lyrnext').fadeTo('slow',1);
							$('#lyrnext').one('click',
								function()
								{
									ti = mynum + 1;
									if( click_nflg ) impoverlaycall( $('#entries ul li:eq('+ti+')').get(0) );
									click_pflg = click_nflg = false;
									impoveyreset();
								}
							);
						}else{
							$('#lyrnext').fadeTo('slow',0.2);
						}
					}else{
						$('#lyrprev').fadeTo('slow',0.2);
						$('#lyrnext').fadeTo('slow',0.2);
					}		
				}
			);
			
			/* close */
			$('#lyrclose').click(	function(){ impoverlayclose()	});
			$('#overlayer').click(	function(){ impoverlayclose()	});
		}
	}
	function impoveyreset()
	{
		$('#implementationentry #mainmonitor img:first').show();
		$('#implementationentry #mainmonitor').css('padding','150px 0 0 0');
		$('#implementationentry #mainmonitor').css('height','200px');
	}
	function impoverlayclose()
	{
		$('#implementationentry #mainmonitor img#loadimg').remove();
		$('#overlayer').fadeOut();
		$('#implementationentry #mainmonitor img:first').show();
		$('#implementationentry').fadeOut();
		$('#implementationentry #mainmonitor').css('padding','150px 0 0 0');
		$('#implementationentry #mainmonitor').css('height','200px');
	}
	function impoverlayinit()
	{
		windowherf($('#implementationentry'));
		$('#overlayer').hide();
		$('#implementationentry').hide();
		$('a[rel*=overlay]').click(
			function()
			{
				impoverlaycall($(this).parent().parent().parent().get(0));
				return false;
			}
		);
	}
	function windowherf(t)
	{
		ww = $(window).width() / 2;
		mypos = ww - t.width()/2;
		t.css('left', mypos+'px');
		$(window).resize(
			function()
			{
				ww = $(window).width() / 2;
				mypos = ww - t.width()/2;
				t.css('left', mypos+'px');
			}
		);
	}
	
	
	function homemain()
	{
		/* img put */
		var dat = $('#data ul li');
		var igs = $('#imgscrollblk');
		var ig = '';
		
		dat.each(	function(i){	ig += $(this).html()	});
		ig += ig;
		ig += ig;
		igs.html( ig );
		/* /img put */
		
		/* grade put */
		$('#monitor').after('<div id="grade_l">&nbsp;</div><div id="grade_r">&nbsp;</div>');
		
		
		/* a: id put */
		var igsa = $('#imgscrollblk a');
		igsa.each(	function(i){	$(this).attr('id','im'+i)	})
		/* /a: id put */
		
		
		var widths = 0;
		var mmv = 0;
		var igsai = $('#imgscrollblk a img');
		igsai.each(
			function(i)
			{
				$(this).hide();
				$(this).load(
					function()
					{
						$(this).fadeIn(2000);
						widths += $(this).width();
						if( igsai.length <= i+1 )
						{
							sd = 1000;
							$('#main').css('opacity','0');
							$('#main').animate({opacity: '1'},{duration: sd, easing: 'easeOutCubic'});
							
							igs.css('width',widths+'px');
							
							/* centering */
							widths = 600 * igsai.length;
							var mv = mmv = ( $(window).width() / 2 ) - ( widths / igsai.length ) / 2;
							//cent = ( widths / igsai.length ) * -3;
							//$('#monitor').css('left',cent+'px');
							cent = -600;
							$('#monitor').css('left',cent+'px');
							igs.css('left',mv+'px');
							
							$(window).resize(
								function()
								{
									igs.css('left','0px');
									mv = mmv = ( $(window).width() / 2 ) - ( widths / igsai.length ) / 2;
									igs.css('left',mmv+'px');
								}
							);
							
							
							
							/* loop */
							var ct = 0;
							var step = 600;
							var eflg = false;
							var lg = dat.length;
							stm = setInterval
							(
								function()
								{
									ct++;
									if( eflg )
									{
										mv = mmv;
										igs.css('left',mv+'px');
										eflg = false;
									}
				
									mv -= step;
				
									igs.animate(
										{	left: mv	},
										{
											duration: 2000,
											easing: 'easeOutExpo',
											complete: function()
											{
												if( lg <= ct )
												{
													eflg = true;
													ct = 0;
												}
											}
										}
									);
								},8000
							)	
						}
					}
				);
			}
		);

	}
	
	
	
	
	function worksshowhide( t )
	{
		var copycatch = $('.copycatch');
		copycatch.hide("slow");
		$(t).show("slow");
	}
	function worksset( tg, time )
	{
		if( $('.copycatch') )
		{
			var copycatch = $('.copycatch');
			copycatch.css("display","none");
			$('.copycatch:eq(0)').fadeIn("slow");
			$("a[rel*=workschanger]").each
			(
				function( i )
				{
					hrefs = $(this).attr("href");
					$(this).attr('href','javascript:worksshowhide("'+hrefs+'")');
				}
			);
		}
		if( $('#worksblk .data').html() )
		{
			if( time != 0 ) clearInterval( st )
			$('#monitor').fadeOut(
				"slow",
				function()
				{
					works(tg)
				}
			)
		}
	}
	
	function works( tg )
	{
		/* init */
		var tgs = '';
		var igs = $('#imgscrollblk img');
		var ig = $('#imgscrollblk');
		ig.empty();
		ig.css('left','0');
		
		tgi = $('#'+tg+' p').html();
		for ( var i = 0; i < 3; i++ ) tgs += tgi;
		ig.html(tgs);
		$('#works #titleblk h4').attr('id',tg+'_h');
		$('#works #titleblk h4').html( $('#'+tg+' h4 a').html() );
		myhref = $('#'+tg+' h4 a').attr('href');
		$('#works #titleblk #link').html( '<a href="'+myhref+'">実施画像をみる</a>' );
		$('#monitor').fadeIn("slow")
		
		
		var wigs = $('#'+tg+' img');
		var lg = wigs.length;
		var ct = 0;
		var mv = 0;
		var eflg = false;
		var step = 425;
		/* /init */
		
		
		
		/* loop */
		st = setInterval
		(
			function()
			{
				ct++;
				if( eflg )
				{
					mv = 0;
					$(ig).css('left',mv+'px');
					eflg = false;
				}
				mv -= step;
				$(ig).animate(
					{	left: mv },
					{
						complete: function()
						{
							if( lg <= ct )
							{
								eflg = true;
								ct = 0;
							}
						}
					}
				);
			},4000
		)
	}
	
		
	function exhibision()
	{
		var places = $('#ex_place');
		$('td.date_cell h6').remove();
		init_select_id_ = 'date_'+places.children('option:selected').attr('id')+'s';
		exhibision_selectplacer(init_select_id_);
		tokyotransfers(init_select_id_);
		
		places.change
		(
			function()
			{
				select_id_ = 'date_'+$(this).children('option:selected').attr('id')+'s';
				exhibision_selectplacer(select_id_);
				tokyotransfers(select_id_);
			}
		);
	}
	function tokyotransfers( t )
	{
		var tokyo_trsf = $('#tokyo_transfers');
		var inpt = $('.transfer_radios input');
		var label_place_ = $('label[for*=place]');
		
		inpt.eq(0).removeAttr('checked');
		inpt.eq(1).removeAttr('checked');
		$('#place_tokyo').remove();
		
		
		if( t == 'date_tokyos' )
		{
			tokyo_trsf.animate({
				opacity: 1
			}, 1500);
			inpt.removeAttr("disabled");
			inpt.eq(0).attr('checked','checked');
			label_place_.after('<p id="place_tokyo" style="font-size:80%; color:#006699; padding:10px 0 0 0;">※送迎の有無を選んで下さい。</p>');
		}else{
			tokyo_trsf.animate({
				opacity: 0.2
			}, 1500);
			inpt.attr("disabled","disabled");
			inpt.eq(1).attr('checked','checked');
			label_place_.after('<p id="place_tokyo" style="font-size:80%; color:#006699; padding:10px 0 0 0;">※送迎は東京会場のみです。</p>');
		}
		
	}
	function exhibision_selectplacer( t )
	{
		var place_ary_ = new Array('date_tokyos','date_sapporos','date_fukuokas','date_kansais');
		for( i = 0; i < place_ary_.length; i++ )
		{
			if( place_ary_[i] == t )
			{
				$('#'+place_ary_[i]).show('slow');
				if( $('#'+place_ary_[i]+' option:eq(0)').html() == '----' ) $('#'+place_ary_[i]+' option:eq(0)').remove();
			}else{
				$('#'+place_ary_[i]).hide(0);
				if( $('#'+place_ary_[i]+' option:eq(0)').html() == '----' ) $('#'+place_ary_[i]+' option:eq(0)').remove();
				$('#'+place_ary_[i]+' option:eq(0)').before('<option selected="selected">----</option>');
			}
		};
	}
	
	function formsend()
	{
		$('.error').remove();
		var sp = '';
		var er = 0;
		var fm = $('#form');
		var lb = $('#form label');
		
		$('#form:text').css('border','1px solid #ccc');
		
		for( var i = 0; i < lb.length; i++ )
		{
			/* init */
			sp = $(lb[i]).children().attr('class');
			flg = $(lb[i]).children().html();
			this.id = $(lb[i]).attr('for');
			//$('#'+this.id+':text').css('border','1px solid #ccc');
			/* /init */
			
			
			if( sp != null || sp != '' )
			{
				if( flg == '*' )
				{
					/* null Check */
					if( $('#'+this.id).attr('value') == null || $('#'+this.id).attr('value') == '' || $('#'+this.id).attr('value') == 'undefined' )
					{
						if( sp != 'c2a' ) $('#'+this.id).after('<p class="error">未入力です</p>');
						else $('#'+this.id).parent().after('<p class="error">未入力です</p>');
						
						$('#'+this.id).css('border','3px solid #cc3300');
						er += 1;
					}
					if( $('#'+this.id).tagName == 'textarea' )
					{
						if( $('#'+this.id).html() == null || $('#'+this.id).html() == '' || $('#'+this.id).html() == 'undefined' )
						{
							if( sp != 'c2a' ) $('#'+this.id).after('<p class="error">未入力です</p>');
							else $('#'+this.id).parent().after('<p class="error">未入力です</p>');
							
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					}
				}
				
				switch( sp )
				{
					case 'c1':
						/* KANA CHECK */
						if( !katakana( $('#'+this.id).attr('value') ) && ( $('#'+this.id).attr('value') != null || $('#'+this.id).attr('value') != undefined || $('#'+this.id).attr('value') != '' ) )
						{
							$('#'+this.id).after('<p class="error">カタカナを入力してください</p>');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c2':
						/* NUM CHECK */
						if( !numcheck( $('#'+this.id).attr('value') ) )
						{
							$('#'+this.id).after('<p class="error">数字を入力してください</p>');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c2a':
						/* NUM CHECK */
						if( !numcheck( $('#'+this.id).attr('value') ) )
						{
							$('#'+this.id).parent().after('<p class="error">数字を入力してください</p>');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c3':
						/* TEL CHECK */
						if( !telcheck( $('#'+this.id).attr('value') ) )
						{
							$('#'+this.id).after('<p class="error">電話番号の形式が違います</p>');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c4':
						/* Mail CHECK */
						if( !mailcheck( $('#'+this.id).attr('value') ) )
						{
							$('#'+this.id).after('<p class="error">メールアドレスを入力してください</p>');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
				}

			}
		}
		
		if( er <= 0 )
		{
			/*
			an = $('lastname').attr('value')+' '+$('firstname').attr('value');
			$('#mail_author').attr('value',an);
			*/
			document.linerform.submit()
		}else{
			
		}
		
	}
	
	function mailcheck(str)
	{
		var Seiki=/[!#-9A-~]+@+[a-z0-9]+.+[^.]$/i;
		return str.match(Seiki)
    }
	function katakana(str)
	{
		return str.match(/^[ァ-ヶー]*$/);
	}
	function numcheck(str)
	{
		return str.match(/^[0-9]*$/);
	}
	function telcheck(str)
	{
		
		flg1 = str.match(/^[0-9-]{6,9}$|^[0-9-]{12}$/);
		flg2 = str.match(/^\d{1,4}-\d{4}$|^\d{2,5}-\d{1,4}-\d{4}$/);
		if( !flg1 && !flg2 ) flg = false;
		else flg = true;
		
		if( str == null || str == undefined || str == '' ) flg = true;
		
		return flg
	}
	
	
	function inquiryformframe()
	{
		
		if( $('#inquiryformframe').html() )
		{
			var otherrequest = $('#otherrequest');
			var reqth_ = $('#requests th label').html();
			if( otherrequest.attr('checked') ) $('#requests th label').html(reqth_+'<em>*</em>');
			else $('#requests th label').html(reqth_);
			
			otherrequest.click
			(
				function()
				{
					if( $(this).attr('checked') ) $('#requests th label').html(reqth_+'<em>*</em>');
					else $('#requests th label').html(reqth_);
				}
			);
			$('#inquiryformframe').before('<div class="header">&nbsp;</div>');
			$('#inquiryformframe').after('<div class="bottomer">&nbsp;</div>');
			var sr = $('#senderreal').html();
			$('#senderreal').css('display','none');
			$('#formblk').after('<div id="sender"><a href="javascript:formsend();"><span>送信する</span></a></div>');
		}
		
	}
	
	function lastnoborder()
	{
		if( $('.last').html() )
		{
			$('.last ul li:last').css('border','none');
		}
	}
	
	function homeframe()
	{
		if( $('#home').html() )
		{
			$('#headerblk').css('margin-bottom',0)
		}
		if( $('#home #newstopics').html() )
		{
			$('#home #newstopics .topicsframe').before('<div class="carbheader">&nbsp;</div>');
			//$('#home #newstopics .topicsframe').after('<div class="carbbottomer">&nbsp;</div>');
		}
	}
	
	function accessframe()
	{
		if( $('.locations').html() )
		{
			$('.locations > dl').before('<div class="locateheader">&nbsp;</div>');
			$('.locations > dl').after('<div class="locatebottomer">&nbsp;</div>');
		}
	}
	
	function buyinfo()
	{
		if( $('#buyinfo').html() )
		{
			dts = $('#buyinfo dt');
			for( var i = 0; i < dts.length; i++ )
			{
				$('#'+dts[i].id).click
				(
					function()
					{
						if( $('#'+this.id+'dd').css('display') == 'block' ) a = 1;
						$('#'+this.id+'dd').toggle(100);
						for( var j = 0; j < dts.length; j++ )
						{
							if( dts[j].id != this.id ) $('#'+dts[j].id+'dd').hide();
						}
					}
				);
			}
		}
	}
	
	
	function outlineline()
	{
		if( $('#outline').html() )
		{
			var oh = $('#frameblk').height();
			$('#subblk').css('height',oh+'px');
			$('#frameblk').load(
				function()
				{
					alert(1);
					oh = $('#frameblk').height();
					$('#subblk').css('height',oh+'px');
				}
			);
		}
	}
	
	
	function carbset()
	{
		if( $('.topicsframe').html() )
		{
			$('.topicsframe').after('<div id="carbbottom">&nbsp;</div>');
		}
	}
	
	function imgborder()
	{
		if( $(".imgborder p").html() )
		{
			$(".imgborder p img").load(
				function()
				{
					this.w = $(".imgborder p img").width();
					this.h = $(".imgborder p img").height();
					$(".imgborder").css("width",this.w+'px');
					$(".imgborder").css("height",this.h+'px');
				}
			);
		}
	}
	
	
	
	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...");
	}



