// ふりがなチェック
function FuriganaCheck(TARGET) {
	var src = document.getElementById(TARGET);
	var str = src.value;
   if( str.match( /[^ぁ-んァ-ン　\s]+/ ) ) {
      alert("ふりがなは、「ひらがな」・「カタカナ」のみで入力して下さい。");
		src.style.backgroundColor = "#ffffcc";
		src.focus();
		return true;
	}else{
		src.style.backgroundColor = "#ffffff";
		return false;
	}
}

// 半角英文字チェック
function AlphabetCheck(TARGET) {
	var src = document.getElementById(TARGET);
	var str = src.value;
   if( str.match( /[^A-Za-z0-9.\-\@\_\+]+/ ) ) {
//   if( str.match( /^[0-9A-Za-z.\_\-]+\@[0-9A-Za-z\.\-]+$/ ) ) {
      alert("メールアドレスに不正な文字が含まれています。\n\n"+str);
		src.style.backgroundColor = "#ffffcc";
		src.focus();
		return true;
	}else{
		src.style.backgroundColor = "#ffffff";
		return false;
	}
}

// 半角数字チェック
function NumberCheck(TARGET) {
	var src = document.getElementById(TARGET);
	var str = src.value;
   if( str.match( /[^0-9]+/ ) ) {
      alert("電話番号は、半角数字のみで入力して下さい。");
		src.style.backgroundColor = "#ffffcc";
		src.focus();
		return true;
	}else{
		src.style.backgroundColor = "#ffffff";
		return false;
	}
}

// MAILチェック
function MailCheck(TARGET1,TARGET2) {
	var src = document.getElementById(TARGET1);
	var str1 = src.value;
	var src = document.getElementById(TARGET2);
	var str2 = src.value;
   if( str1 != str2 ) {
      alert("確認用のメールアドレスが違います。");
		src.style.backgroundColor = "#ffffcc";
		src.focus();
		return true;
	}else{
		src.style.backgroundColor = "#ffffff";
		return false;
	}
}

// 空欄Check 
function VoldCheck(TARGET,DEFAULT) {
	var src = document.getElementById(TARGET);
	var str = src.value;
	if( str.match( /[\s\n\r]/ ) ) {
		str = str.split(' ').join('').split('　').join('').split('\n').join('').split('\r').join('');
	}
	
	if( str == '' | str == null | str == DEFAULT ) {
		src.value = '';
		src.style.backgroundColor = "#ffffcc";
		src.focus();
		alert("必須項目に空欄があります。入力して下さい。");
		return true;
	}else{
		src.style.backgroundColor = "#ffffff";
		return false;
	}
}


function SSC(){
	var check = 0;
	if( VoldCheck('subject','お問い合わせ件名') ){
		return false;
	}else if( VoldCheck('news','お問い合わせ内容') ){
		return false;
	}else if( VoldCheck('fname','姓（漢字）') ){
		return false;
	}else if( VoldCheck('lname','名（漢字）') ){
		return false;
	}else if( VoldCheck('fnamer','姓（ふりがな）') ){
		return false;
	}else if( FuriganaCheck('fnamer') ){
		return false;
	}else if( VoldCheck('lnamer','名（ふりがな）') ){
		return false;
	}else if( FuriganaCheck('lnamer') ){
		return false;
	}else if( VoldCheck('email','例）taro_shinaji@synergy.ne.jp') ){
		return false;
	}else if( VoldCheck('emailr','例）taro_shinaji@synergy.ne.jp') ){
		return false;
	}else if( AlphabetCheck('email') ){
		return false;
	}else if( AlphabetCheck('emailr') ){
		return false;
	}else if( MailCheck('email','emailr') ){
		return false;
	}else if( VoldCheck('phone1',' ') ){
		return false;
	}else if( NumberCheck('phone1') ){
		return false;
	}else if( VoldCheck('phone2',' ') ){
		return false;
	}else if( NumberCheck('phone2') ){
		return false;
	}else if( VoldCheck('phone3',' ') ){
		return false;
	}else if( NumberCheck('phone3') ){
		return false;
	}else{
//		var form = document.forms[me]; 
//		form.viewmode.value = 'review';
		document.getElementById("viewmode").value = 'review';
//		alert(document.getElementById("viewmode").value+'確認画面へ');
		document.me.submit() ;
	}
}
function SSC2(){
	document.getElementById("viewmode").value = 'sendmail';
//	alert('送信します');
	document.me.submit() ;
}
//   check += FuriganaCheck('fnamer');
//   check += FuriganaCheck('lnamer');
//   check += AlphabetCheck('');
//   check += NumberCheck('');
//   if( check > 0 ) {
//      alert("false");
//  ---------- 

function RDO(MODE){
	if(MODE == '1'){
		document.getElementById('select_a').style.display = 'block' ;
		document.getElementById('select_b').style.display = 'none' ;
	}else{
		document.getElementById('select_a').style.display = 'none' ;
		document.getElementById('select_b').style.display = 'block' ;
	}
}

//  ----------  

function ShowFG(TARGET,GS) {
// 入力案内を表示
	if( TARGET.value == '' ) {
		TARGET.value = GS
		TARGET.style.color = '#808080';
	}
}
function HideFG(TARGET,GS) {
// 入力案内を消す
	if( TARGET.value == GS ) {
		TARGET.value= '';
		TARGET.style.color = '#000000';
	}
}
function rewrite(){
//		var form = document.forms[me]; 
//		form.viewmode.value= 'rewrite';
		document.getElementById("viewmode").value = 'rewrite';
//		alert("rewrite"+'訂正画面へ');
		document.me.submit() ;
}

