function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	
	//2009.4.6
	//minit();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImage2() {
  var i,j=0,x,a=MM_swapImage2.arguments;
  document.MM_sr=new Array;
  for(i=0;i<(a.length-2);i+=3){
  	if ((x=MM_findObj(a[i]))!=null){
		document.MM_sr[j++]=x;
		if(!x.oSrc){
			//x.oSrc=x.src;
		}
		x.src=a[i+2];
	}
  }
}

function sopen(frm,rn){
	frm.rn.value = rn;
	frm.submit();
}

function pup(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function mopen(tar) {
	//2009.4.6
	if(!(tar==27||tar==22||tar==19||tar==18||tar==20) || arguments[1]){
		
		var is = 'Image'+tar+'b';
		var im = 'Image'+tar+'c';
	
		
		if(tar=='12'){
			document.getElementById('Image11b').style.display='none';
			document.getElementById('Image11c').className='li01';
		}else if(tar=='11'){
			document.getElementById('Image12b').style.display='none';
			document.getElementById('Image12c').className='li01';
		}
	
		/*
		document.getElementById('Image27b').style.display='none';
		document.getElementById('Image22b').style.display='none';
		document.getElementById('Image19b').style.display='none';
		document.getElementById('Image18b').style.display='none';
		document.getElementById('Image20b').style.display='none';
		*/
		if(tar){
			if(document.getElementById(is).style.display!='none'){
				//open to close
				if(tar=='11'||tar=='12')	document.getElementById(im).className='li01';
				else						document.getElementById(im).className='li04';
				document.getElementById(is).style.display='none';
			}else{
				//close to open
				if(tar=='11'||tar=='12')	 document.getElementById(im).className='li02op01';
				else						 document.getElementById(im).className='li04op01';
				document.getElementById(is).style.display='block';
			}
		}
	}
}

function mopenORG(tar) {
	//2009.4.6
	if(!(tar==27||tar==22||tar==19||tar==18||tar==20) || arguments[1]){
		
		var is = 'Image'+tar+'b';
		var im = 'Image'+tar+'c';
	
		document.getElementById('Image12b').style.display='none';
		document.getElementById('Image12c').className='li01';
		if(tar=='12'){
			document.getElementById('Image11b').style.display='none';
			document.getElementById('Image11c').className='li01';
		}
	
		document.getElementById('Image27b').style.display='none';
		document.getElementById('Image22b').style.display='none';
		document.getElementById('Image19b').style.display='none';
		document.getElementById('Image18b').style.display='none';
		document.getElementById('Image20b').style.display='none';
		
		if(tar){
			if(document.getElementById(is).style.display!='none'){
				if(tar=='11'||tar=='12')	document.getElementById(im).className='li01';
				else						document.getElementById(im).className='li04';
				document.getElementById(is).style.display='none';
			}else{
				if(tar=='11'||tar=='12')	 document.getElementById(im).className='li02op01';
				else						 document.getElementById(im).className='li04op01';
				document.getElementById(is).style.display='block';
			}
		}
	}
}

function minit(){
	mypath = location.pathname;
	mypath = mypath.replace(/\\/g,"/");
	
	document.getElementById('Image12b').style.display='none';
	document.getElementById('Image11b').style.display='none';
	document.getElementById('Image27b').style.display='none';
	document.getElementById('Image22b').style.display='none';
	document.getElementById('Image19b').style.display='none';
	document.getElementById('Image18b').style.display='none';
	document.getElementById('Image20b').style.display='none';

	// if(mypath.match(/about|media/i)&&!mypath.match(/inquiry|link/i)){
	if(mypath.match(/about/i)&&!mypath.match(/inquiry|link/i)){
		mopen("12",true);
		if(mypath.match(/about\/01/i))			MM_swapImage2('Image23','','../elements/rmenu2-2-1on.gif',1);
		else if(mypath.match(/about\/02/i))	MM_swapImage2('Image24','','../elements/rmenu2-2-2on.gif',1);
		else if(mypath.match(/about\/03/i))	MM_swapImage2('Image25','','../elements/rmenu2-2-3on.gif',1);
	}else if(mypath.match(/pain\/01|pain\/02/i)){
		mopen("11",true);
		mopen("27",true);
		if(mypath.match(/pain\/01/i))			MM_swapImage2('Image28','','../elements/rmenu2-1-1-1on.gif',1);
		else if(mypath.match(/pain\/02/i))		MM_swapImage2('Image29','','../elements/rmenu2-1-1-2on.gif',1);
	}else if(mypath.match(/pain\/03|pain\/04|pain\/05|pain\/06/i)){
		mopen("11",true);
		mopen("22",true);
		if(mypath.match(/pain\/03/i))			MM_swapImage2('Image30','','../elements/rmenu2-1-2-1on.gif',1);
		else if(mypath.match(/pain\/04/i))		MM_swapImage2('Image34','','../elements/rmenu2-1-2-2on.gif',1);
		else if(mypath.match(/pain\/05/i))		MM_swapImage2('Image35','','../elements/rmenu2-1-2-3on.gif',1);
		else if(mypath.match(/pain\/06/i))		MM_swapImage2('Image36','','../elements/rmenu2-1-2-4on.gif',1);
	}else if(mypath.match(/pain\/07|pain\/08|pain\/09/i)){
		mopen("11",true);
		mopen("19",true);
		if(mypath.match(/pain\/07/i))			MM_swapImage2('Image31','','../elements/rmenu2-1-3-1on.gif',1);
		else if(mypath.match(/pain\/08/i))		MM_swapImage2('Image37','','../elements/rmenu2-1-3-2on.gif',1);
		else if(mypath.match(/pain\/09/i))		MM_swapImage2('Image38','','../elements/rmenu2-1-3-3on.gif',1);
	}else if(mypath.match(/pain\/10|pain\/11|pain\/12/i)){
		mopen("11",true);
		mopen("18",true);
		if(mypath.match(/pain\/10/i))			MM_swapImage2('Image32','','../elements/rmenu2-1-4-1on.gif',1);
		else if(mypath.match(/pain\/11/i))		MM_swapImage2('Image39','','../elements/rmenu2-1-4-2on.gif',1);
		else if(mypath.match(/pain\/12/i))		MM_swapImage2('Image40','','../elements/rmenu2-1-4-3on.gif',1);
	}else if(mypath.match(/pain\/13|pain\/14|pain\/15|pain\/16/i)){
		mopen("11",true);
		mopen("20",true);
		if(mypath.match(/pain\/13/i))			MM_swapImage2('Image33','','../elements/rmenu2-1-5-1on.gif',1);
		else if(mypath.match(/pain\/14/i))		MM_swapImage2('Image41','','../elements/rmenu2-1-5-2on.gif',1);
		else if(mypath.match(/pain\/15/i))		MM_swapImage2('Image42','','../elements/rmenu2-1-5-3on.gif',1);
		else if(mypath.match(/pain\/16/i))		MM_swapImage2('Image43','','../elements/rmenu2-1-5-4on.gif',1);
	}else if(mypath.match(/check/i)){
		MM_swapImage2('Image8','','../elements/rmenu1-1on.gif',1);
	}else if(mypath.match(/faq/i)){
		MM_swapImage2('Image9','','../elements/rmenu1-2on.gif',1);
	}else if(mypath.match(/seminar/i)){
		MM_swapImage2('Image10','','../elements/rmenu1-3on.gif',1);
	}else if(mypath.match(/press/i)){
		MM_swapImage2('Image13','','../elements/rmenu2-3-0on.gif',1);
	}else if(mypath.match(/soudan/i)){
		MM_swapImage2('Image181','','../elements/rmenu0-1on.jpg',1);
	}else if(mypath.match(/clinic/i)){
		MM_swapImage2('Image191','','../elements/rmenu0-2on.jpg',1);
	}
}
//window.onload = minit;

function cForm(frm) {
	$etxt = '';
	
	$testmail = frm.mail1.value + '@' + frm.mail2.value;
	
	if(!(frm.sname1.value && frm.sname2.value)) $etxt += "・相談者のお名前\n";
	if(!(frm.kname1.value && frm.kname2.value)) $etxt += "・患者さんのお名前\n";
	if(!frm.shi.value) $etxt += "・患者さんの疾患名\n";
	if(!(frm.shiy1.value || frm.shiy2.value)) $etxt += "・患者さんの疾病年数\n";
	if(!frm.age.value) $etxt += "・患者さんの年齢\n";
	if(!(frm.zip1.value && frm.zip2.value)) $etxt += "・郵便番号\n";
	if(!(frm.pref[frm.pref.selectedIndex].value && frm.add1.value)) $etxt += "・住所\n";
	if(!(frm.tel1.value && frm.tel2.value && frm.tel3.value)) $etxt += "・電話番号\n";
	if(!(frm.mail1.value && frm.mail2.value)) $etxt += "・E-mail\n";
	else if(!cMail(frm.mail1.value + '@' + frm.mail2.value)) $etxt += "・正しいE-mailアドレス\n";
	else if((frm.mail1.value != frm.mail1b.value)||(frm.mail2.value != frm.mail2b.value)) $etxt += "・確認用E-mailアドレス\n";
	if(!frm.cont.value) $etxt += "・相談内容\n";
	
	if($etxt) alert($etxt+"\nを確認してください。")
	else frm.submit();
}

function bForm(frm) {
	frm.m.value=0;
	frm.submit();
}
function cMail(sMail) {
	var mForm = /^[A-Za-z0-9\_\.\-]+\@{1}[A-Za-z0-9\_\.\-]+\.{1}[A-Za-z0-9\_\.\-]+$/
	var result = sMail.match(mForm);
	return result;
}
