function validMessage()
{
	/*var UserName = document.getElementById('user_name').value;
	var Messages = document.getElementById('words').value;
	var Title = document.getElementById('title').value;
	if (confirm("内容は提出しますか？"))
	{
		UserName   =   UserName.replace(/(^\s+)|(\s+$)/,   "");
		Messages   =   Messages.replace(/(^\s+)|(\s+$)/,   "");
		Title      =   Title.replace(/(^\s+)|(\s+$)/,   "");
		if (UserName == '' || Messages == '' || Title == '')
		{
			alert("ユーザー、タイトルと内容は必至です。");
		} else {
			return document.sendClientWords.submit();
		}
	}*/
}

function checkAllInputEmpty()
{
	var UserName = document.getElementById('user_name').value;
	var Title = document.getElementById('title').value;
//	var Sex = document.getElementById('sex').checked;
	var Address = document.getElementById('address').value;
	var Tel = document.getElementById('tel').value;
	var Age = document.getElementById('age').value;
	var Email = document.getElementById('email').value;
	var Words = document.getElementById('words').value;
	
	var inputTitle = new Array('お名前', 'フリガナ', '住所', 'TEL', 'E-mailアドレス', '問い合わせ内容');
	
		mssage = '';
		
		UserName   =   UserName.replace(/(^\s+)|(\s+$)/,   "");
		Title      =   Title.replace(/(^\s+)|(\s+$)/,   "");
		Address      =   Address.replace(/(^\s+)|(\s+$)/,   "");
		Email      =   Email.replace(/(^\s+)|(\s+$)/,   "");
		Words      =   Words.replace(/(^\s+)|(\s+$)/,   "");
		Tel   =   Tel.replace(/(^\s+)|(\s+$)/,   "");
		Age   =   Age.replace(/(^\s+)|(\s+$)/,   "");
		
		useranmenockeck = false;
		if(UserName=='')
		{
			mssage = mssage+'お名前を入力してください\r\n';
			useranmenockeck = true;
		}
		titlenockeck = false;
		if(Title=='')
		{
			mssage = mssage+'フリガナを入力してください\r\n';
			titlenockeck = true;
		}
		agenocheck = false;
		if(isNaN(Age)&&Age!='')
		{
		 	mssage = mssage+'年齢は半角数字で入力してください\r\n';
			agenocheck= true;
		}
		
		addressnockeck = false;
		if(Address=='')
		{
			mssage = mssage+'住所を入力してください\r\n';
			addressnockeck = true;
		}
		telnockeck = false;
		if(Tel=='')
		{
			mssage = mssage+'Telを入力してください\r\n';
			telnockeck = true;
		}
		mailnockeck = false;
		if(Email=='')
		{
			mssage = mssage+'E-mailアドレスを入力してください\r\n';
			mailnockeck = true;
		}
		wordsnockeck = false;
		if(Words=='')
		{
			mssage = mssage+'問い合わせ内容を入力してください\r\n';
			wordsnockeck = true;
		}
		num = /[0-9a-zA-Z-<>!@$%^&*()_]/;
		if(!useranmenockeck)
		{
			if(num.test(UserName)){
				mssage = mssage+'お名前を全角で入力してください\r\n';	
			}
		}

		errortitle = $.ajax({
		 url: "http://www.comicbuster.jp/kameiten/testshop/index.php?page=Bbs&do=Check",
		  type: "POST",
		  data: "title="+Title,
		  async: false   
		}).responseText; 
		  if(!titlenockeck){
		   mssage = mssage+errortitle;
		  }

		//Sex   =   Sex.replace(/(^\s+)|(\s+$)/,   "");
		
		t = /^[0-9-]+$/;
		if(!telnockeck){
			if(!t.test(Tel)){
				mssage = mssage+'電話番号は半角数字と-で入力してくださいr\n';
			}
		}
		//Tel   =   Tel.replace(/[1-9-]d*$/,   "");
		em =/^[^@]+@[^.^@]+/;
		if(!mailnockeck){
			if(!em.test(Email)) 
			{ 
				 mssage = mssage+'メールアドレスを半角英数記号で入力してください\r\n';
			}
		}
		//Email      =   Email.replace(/^(^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$)/,   "");
		//
		
		Words1     =   Words.replace(/http:\/\//,   "");
		
		Words2      =   Words1.replace(/http:\/\//,   "");
		if(!wordsnockeck){
			if(Words1!=Words2&&Words!=Words1){
				mssage = mssage+'お問い合わせ内容にはURLを2つ以上入力できません\r\n';
			}
		}
		tishi = false;
	    var s1 = Words.indexOf('death');
		if(s1!=-1){
			mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
			tishi = true;
		}
		var s2 = Words.indexOf('sex');
		if(s2!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s3 = Words.indexOf('pill');
		if(s3!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s4 = Words.indexOf('fuck');
		if(s4!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s5 = Words.indexOf('Porno');
		if(s5!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s6 = Words.indexOf('死');
		if(s6!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s7 = Words.indexOf('<script');
		if(s7!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		var s8 = Words.indexOf('<object');
		if(s8!=-1){
			if(!tishi){
				mssage = mssage+'お問い合わせ内容に不適切な語句が含まれています\r\n';
				tishi = true;
			}
		}
		
		if(mssage==''){
			return document.sendClientWords.submit()
		}else{
			alert(mssage);
		}
		//Words      =   Words.replace(/<.*>/,   "");
		
	/*var input = new Array(UserName, Title , Address, Tel, Email, Words);	
		if (UserName == '' || Title == '' || Address == '' || Tel == '' || Email == '' || Words == '')
		{
			var message='';
			for(var i=0; i<6; i++) {
				if(input[i]==''){
					 message = message+inputTitle[i] + 'を入力してください\r\n';
				}
				alert(message);
				//showErrorMessage(input[i], inputTitle[i]);
			}
		} else {
			return document.sendClientWords.submit();
		}*/
}

function checkLookInputEmpty()
{
	var UserName = document.getElementById('user_name').value;
	var Title = document.getElementById('title').value;
	var Age = document.getElementById('age').value;
	var Address = document.getElementById('address').value;
	var Tel = document.getElementById('tel').value;
	var Card = document.getElementById('card').value;

	var inputTitle = new Array('お名前', 'ふりがな', '年齢', '住所', '電話番号', 'メール');
	

		UserName   =   UserName.replace(/(^\s+)|(\s+$)/,   "");
		Title      =   Title.replace(/(^\s+)|(\s+$)/,   "");
		Address      =   Address.replace(/(^\s+)|(\s+$)/,   "");
		Tel   =   Tel.replace(/(^\s+)|(\s+$)/,   "");
		Age      =   Age.replace(/(^\s+)|(\s+$)/,   "");
		Card      =   Card.replace(/(^\s+)|(\s+$)/,   "");

	var input = new Array(UserName, Title, Age, Address, Tel, Card);
		if (UserName == '' || Title == '' || Address == '' || Tel == '' || Age == '' || Card == '')
		{
			for(var i=0; i<6; i++) {
				showErrorMessage(input[i], inputTitle[i]);
			}
		} else if(Card.match(/^(.+)@(.+)$/)==null)
		{
			showErrorMessage('','メール');
		}  else if(!(/^\d+(\.\d+)?$/.test(Age)))
		{
			showErrorMessage('','年齢');
		} else {
			return document.sendMailFrom.submit();
		}
}

function showErrorMessage(input, title)
{
	if (input == '')
	{
		var message = title + 'を入力してください';
		alert(message);
	}
}
