
	/* --------------------------------------------------------------------*/
	/*  this.javascript.made.by tsuyoshi higuchi	 __wpe__
	/*  Copyright 2010
	/* --------------------------------------------------------------------*/
	
	
	/* call functions from here    */
	$(  
		function()
		{
			init_();
			vtip();
		}
	);
	
	function init_()
	{
		var h1_ = $('h1');
		h1_.hover(
			function (){$(this).css("cursor","pointer"); $(this).attr("title","HOMEへ");},
			function (){$(this).css("cursor","default");}
		);
		h1_.click(	function(){	location.href = "/";	});
		$('a[rel*=blank]').attr("target","_blank");
		$('a[rel*=lightbox]').lightBox();
		
		/* smoothclick use */
		smoothclick();
		if(location.href.match(/\#([\w]+)/))
		{
			var te = "#"+RegExp.$1;
			smooth(te);
		}	
	}
	function formsend()
	{
		$('.error').remove();
		var sp = '';
		var er = 0;
		var fm = $('#ultimateform');
		var lb = $('#ultimateform label');
		
		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');
			$('#'+this.id).after('<div class="error error_'+this.id+'"></div>');
			/* /init */
			
			
			if( sp != null || sp != '' )
			{
				if( flg == '*' )
				{
					/* null Check */
					if( $('#'+this.id).attr('value') == null || $('#'+this.id).attr('value') == '' || $('#'+this.id).attr('value') == 'undefined' )
					{
						my_index = $('#'+this.id).index();
						$(".error_"+this.id).html('&times; 未入力です');
						$('#'+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') != '' ) )
						{
							$(".error_"+this.id).html('&times; カタカナを入力してください');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c2':
						/* NUM CHECK */
						if( !numcheck( $('#'+this.id).attr('value') ) )
						{
							$(".error_"+this.id).html('&times; 数字を入力してください');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c3':
						/* TEL CHECK */
						if( !telcheck( $('#'+this.id).attr('value') ) )
						{
							$(".error_"+this.id).html('&times; 電話番号の形式が違います');
							$('#'+this.id).css('border','3px solid #cc3300');
							er += 1;
						}
					break;
					
					case 'c4':
						/* Mail CHECK */
						if( !mailcheck( $('#'+this.id).attr('value') ) )
						{
							$(".error_"+this.id).html('&times; メールアドレスを入力してください');
							$('#'+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( $('#inquiryform').html() )
		{
			var sr = $('.senderreal');
			sr.after('<a id="sender" href="javascript:formsend();">送信する</a>');
			sr.css('display','none');
		}
		
	}
	function lastnoborder()
	{
		if( $('.last').html() )
		{
			$('.last ul li:last').css('border','none');
		}
	}
	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}, 700);
			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}, 700);
					else $('html,body').animate({scrollTop: targetOffset}, 700);
					return false;
				}
			}
		});
	
	}
	function ov(t)
	{
		t.hover
		(
			function(){	$(this).css("cursor","pointer");	},
			function(){	$(this).css("cursor","default");	}
		)
	}
	function ovoff(t)
	{
		t.hover
		(
			function(){	$(this).css("cursor","default");	},
			function(){	$(this).css("cursor","default");	}
		)
	}
	
	
