﻿

function mysubmit()
{
	if(document.loginform.mode[0].checked==true)
	{
		document.loginform.action=document.loginform.server_url.value+"login.php";
	}
	else
	{
		document.loginform.action=document.loginform.https_server_url.value+"login.php";
	}
	document.loginform.submit();
}
function searchSubmit(){
	if(document.getElementById('search_map').value!=''){
		topSearch();
	}else{
		document.searchform.submit();
	}
}
function topSearch(searchValue) {
	if(searchValue==null)
	{
		var q =document.getElementById('search_map').value;
	}
	else
	{
		var q = searchValue;
	}
	gLocalSearch.execute(q);
	return false;
}
function topload() {
	if (GBrowserIsCompatible()) {
		gLocalSearch = new GlocalSearch();
		gLocalSearch.setSearchCompleteCallback(null, topLocalSearch);
	}
}
function topLocalSearch(){
	if (gLocalSearch.results.length == 0) {
		//alert('見つかりませんでした');
		//return;
	}else{
		var first = gLocalSearch.results[0];
		var lat = parseFloat(first.lat);
		var lng = parseFloat(first.lng);
		document.getElementById('addrCond').value=lat+','+lng;
	}
	document.searchform.submit();
}

var bannerAD=new Array(); 
var bannerADlink=new Array(); 
var adNum=0; 

bannerAD[0]="images/banner/468x60_1.gif"; 
bannerADlink[0]="index.php"; 
bannerAD[1]="images/banner/468x60_2.gif"; 
bannerADlink[1]="index.php"; 
bannerAD[2]="images/banner/468x60_3.gif"; 
bannerADlink[2]="index.php"; 
bannerAD[3]="images/banner/468x60_4.gif"; 
bannerADlink[3]="index.php";
bannerAD[4]="images/banner/468x60_smile.gif"; 
bannerADlink[4]="http://www.sinderera.jp/";
bannerAD[5]="images/banner/shikakankei_top.jpg"; 
bannerADlink[5]="hospital_reg.php"; 
var preloadedimages=new Array(); 
for (i=1;i<bannerAD.length;i++){ 
	preloadedimages[i]=new Image(); 
	preloadedimages[i].src=bannerAD[i]; 
} 
function setTransition(){ 
	if (document.all){ 
		bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23); 
		bannerADrotator.filters.revealTrans.apply(); 
	} 
} 
function playTransition(){ 
	if (document.all) 
	bannerADrotator.filters.revealTrans.play() 
} 
function nextAd(){ 
	if(adNum<bannerAD.length-1)adNum++ ; 
	else adNum=0; 
	setTransition(); 
	document.images.bannerADrotator.src=bannerAD[adNum]; 
	playTransition(); 
	theTimer=setTimeout("nextAd()", 5000); 
} 
function jump2url(){ 
	jumpUrl=bannerADlink[adNum]; 
	jumpTarget=''; 
	if (jumpUrl != ''){ 
		if (jumpTarget != '')window.open(jumpUrl,jumpTarget); 
		else location.href=jumpUrl; 
	} 
} 
function displayStatusMsg() {  
	status=bannerADlink[adNum]; 
	document.returnValue = true; 
}



function checkFirstInput(obj){
	//alert(obj.style.color);
	if(isTrueColor(obj.style.color))
	{
		if(obj.style.color=="#9b9b9b"){
			//alert("same");
			obj.style.color="#000000";
			obj.value='';
		}
	}
	else
	{
		if(obj.style.color=="rgb(155, 155, 155)"){
			obj.style.color="rgb(0, 0, 0)";
			obj.value='';
		}
	}
}

function searchSubmit1(){
	//alert(document.getElementById('search_map_text').style.color);
	if(isTrueColor(document.getElementById('search_map_text').style.color))
	{
		if(document.getElementById('search_map_text').style.color!="#9b9b9b")
		{
			document.searchform.search_map.value=document.getElementById('search_map_text').value;
		}
		if(document.getElementById('search_map2_text').style.color!="#9b9b9b")
		{
			document.searchform.search_map2.value=document.getElementById('search_map2_text').value;
		}
	}
	else
	{
		if(document.getElementById('search_map_text').style.color!="rgb(155, 155, 155)")
		{
			document.searchform.search_map.value=document.getElementById('search_map_text').value;
		}
		if(document.getElementById('search_map2_text').style.color!="rgb(155, 155, 155)")
		{
			document.searchform.search_map2.value=document.getElementById('search_map2_text').value;
		}
	}
	
	document.searchform.submit();
}

function isTrueColor(str)
{
	if(str.length==7)
	{
		return true;
	}
	else
	{
		return false;
	}
}

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];}}
}

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_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 searchSubmit2(){
	var search_str_index="";
	for(i=0;i<document.searchform.elements.length;i++)
	{
		if(document.searchform.elements[i].name=="search1[]" && document.searchform.elements[i].checked==true)
		{
			if(search_str_index!="")
			{
				search_str_index=search_str_index+"|";
			}
			search_str_index=search_str_index+document.searchform.elements[i].value;
		}
		if(document.searchform.elements[i].name=="search2" && document.searchform.elements[i].value!="")
		{
			if(search_str_index!="")
			{
				search_str_index=search_str_index+"|";
			}
			search_str_index=search_str_index+document.searchform.elements[i].value;
		}
	}
	document.searchform.search_str_index.value=search_str_index;
	//alert(search_str_index);
	document.searchform.submit();
}







var sbm_ary = {
  "google_bmarks" : ["Googleブックマーク","http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}",0],
  "hatena" : ["はてなブックマーク","http://b.hatena.ne.jp/add?mode=confirm&&url={url}&title={title}",2],
  "livedoor_clip" : ["livedoorクリップ","http://clip.livedoor.com/redirect?link={url}&title={title}",0],
  "nifty_clip" : ["niftyクリップ","http://clip.nifty.com/create?url={url}&title={title}",0],
   "yahoo_myweb" : ["Yahooブックマーク","http://bookmarks.yahoo.co.jp/bookmarklet?t=u={url}&t={title}",0]
};

var sbm_ary_max="";
for(key in sbm_ary){ sbm_ary_max++; }

var  d=document;
var ie=d.all?1:0
var ns6=d.getElementById&&!d.all?1:0
var opera=window.opera?1:0
var shareID="sbmform";

function post_Share(share_name,en) {
  var _url=location.href;
  var _title=document.title;
  var url=encodeURIComponent(_url);
  var title=encodeURIComponent(_title);
  var base=sbm_ary[share_name][1];
  if(en=='en'){
    /* エンコード */
    base = base.replace('{url}', url);
    base = base.replace('{title}', title);
  }else{
    /* エンコードなし */
    base = base.replace('{url}', _url);
    base = base.replace('{title}', _title);
  }
  w=window.open(base,"w","width=700px,height=400px,top=0,left=0,scrollbars=yes,toolbar=no");
  w.focus();
  return false;
}

function disp_Share() {
  if(ie || ns6 || opera){
        obj=ns6 ? d.getElementById(shareID) : d.all(shareID);
    if(obj.style.display=="block"){
      obj.style.display="none";
        }else{
      obj.style.display="block";
       }
    }
}

function create_Share(){
  var cnt=1;
  var ofst=10; /* 折り返しする数 */
  var s="<div class='social'>";
  for(key in sbm_ary){
    if(cnt==1 || cnt%ofst==1){
      s+="<ul>";
    }
    if(sbm_ary[key][2]==1){ /* js */
      s+="<li><a href='"+sbm_ary[key][1]+"' class='"+key+"'>"+sbm_ary[key][0]+"<\/a><\/li>";
    }else if(sbm_ary[key][2]==2){ /* URLエンコード不要 */
      s+="<li><a href='javascript:void(0);' class='"+key+"' onClick=\"post_Share('"+key+"',0)\">"+sbm_ary[key][0]+"<\/a><\/li>";
    }else{ /* URLエンコード */
        s+="<li><a href='javascript:void(0);' class='"+key+"' onClick=\"post_Share('"+key+"','en')\">"+sbm_ary[key][0]+"<\/a><\/li>";
      }
      if(cnt==sbm_ary_max || cnt%ofst==0){
      s+="<\/ul>";
    }
    cnt++;
  }
  s+="<\/div>";
  document.write(s);
}


function detailSubmit(flag,id,clickflg){

	if(flag==0){
		if(clickflg=="top"){
			window.open(id+"/top.html");
		}else if(clickflg=="reco"){
			window.open(id+"/reco.html");
		}
	}else{
		document.rankform.hospital_id.value=id;
		if(clickflg=="top"){
			document.rankform.cmd.value="top";
		}else if(clickflg=="reco"){
			document.rankform.cmd.value="reco";
		}
		document.rankform.action = "clinic_index.php";
		document.rankform.target="_blank";
		document.rankform.submit();
	}

}