function crSwfCode(SWFFILE,FW,FH){ var rdata='<object data='+SWFFILE+' width='+FW+' height='+FH+' type="application/x-shockwave-flash"><param name="movie" value='+SWFFILE+' /><param name="wmode" value="transparent" /></object>'; document.write(rdata); }

	
function clearSearch(input){
	if ((input.value == "フリーワードから") || (input.value == "フリーワードで") || (input.value == "キーワード検索")) input.value="";
}

function wud(t,p,f){ 
	if(navigator.userAgent.indexOf("Slurp") == -1) {
		if(navigator.appVersion.indexOf("MSIE") != -1) {
			var wwidth=document.body.clientWidth;
			var wheight=document.body.clientHeight;
		}
		else {
			var wwidth=window.innerWidth;
			var wheight=window.innerHeight;
		}
		var data='"'+t+'","'+p+'","'+screen.width+'x'+screen.height+'","'+wwidth+'x'+wheight+'","'+(window.outerWidth-window.innerWidth)+'x'+(window.outerHeight-window.innerHeight)+'","'+navigator.platform+'",'+'"'+navigator.userAgent+'"';
		xmlhttp=new XMLHttpRequest();
		xmlhttp.open("GET",f+"wud.php?m=j&t="+data,true);
		xmlhttp.send(null);
		document.cookie="j="+t
	}
};


//doctor board
function showhide(a,b){
	if(target=document.getElementById(a)){
		str=target.className;
		if(str.match(/v0/)){
			target.className=str.replace(/v0/,"v1");
			if(target2=document.getElementById(b)){
				target2.className="v0";
			}
		} else if(str.match(/v1/)){
			target.className=str.replace(/v1/,"v0");
			if(target2=document.getElementById(b)){
				target2.className="v1";
			}
		} else {
			target.className="v0";
		}
	}	
}

function parb(target,mode){
	str=target.className;
	if(mode==1 && str.match(/p0/)){
		target.className=str.replace(/p0/,"p1");
	} else if(mode==0 && str.match(/p1/)){
		target.className=str.replace(/p1/,"p0");
	} 
}

function hideall(a){
	//document.getElementById("menutabblock1").className=str.replace(/v1/,"v0");
	//document.getElementById("menutabblock2").className=str.replace(/v1/,"v0");
	for(i=1;i<5;i++){
		if(i!=a){
			if(target=document.getElementById("menutabblock"+i)){
				str=target.className;
				target.className=str.replace(/v1/,"v0");
			}
		}
	}
}

//common used in shop casssette, shop gallery, hospital cassette, top tab
function switchShopTab(a,max,tabid,blockid,strreplace_or_replace,foldblock){
	for(i=1;i<max;i++){
		target1=document.getElementById(blockid+i);
		if(i!=a && target1.className){
			target1.className=target1.className.replace(/v1/,"v0");
			document.getElementById(tabid+i).className='tab0';
		}
	}
	if(strreplace_or_replace==1){
		target=document.getElementById(blockid+a);
		str=target.className;
		if(str.match(/v0/)){
			target.className=str.replace(/v0/,"v1");
		} else if(foldblock=='1' && str.match(/v1/)){
			target.className=str.replace(/v1/,"v0");
		} else if(foldblock=='1'){
			target.className="v0";
		}
		document.getElementById(tabid+a).className="tab1";
	} else {
		document.getElementById(blockid+a).className="v1";
		document.getElementById(tabid+a).className="tab1";
	}
}

function exct(v){ //execute form
	document.getElementById(v).click();
}

function showSearchForm(){
	document.getElementById("menusearchbox").className="v1";
	//document.getElementById("menusearchenter").className="v0";

}
function fcs(v){ //focus form
	document.getElementById(v).focus();
}
function showContentsMenu(v){
	target=document.getElementById(v);
	str=target.className;
	if(str.match(/v0/)){
		target.className=str.replace(/v0/,"v1");
	} else {
		target.className="v0";
	}
}
function setTab(name,max,tabid,blockid){
	//retrieve saved cookie (holds tab no) and execute switchshoptab
	v=parseInt(getCookie(name));
	if(v) switchShopTab(v,max,"ttab","tabbox",1);
	return true;
}
function setCookie(name,value){
	document.cookie=name+"="+value+";path=/";

	return true;
}
function getCookie(name){
	var search=name+'=';
	if (document.cookie.length>0) {
		offset=document.cookie.indexOf(search);
		if (offset!=-1){
			offset+=search.length;
			end=document.cookie.indexOf(';',offset);
			if(end==-1)
				end=document.cookie.length;
			return unescape(document.cookie.substring(offset,end));
		}
	}
	return null;
}

function mmenu(target){
	if(target.className=="li1"){
		target.className="li0";
	} else {
		target.className="li1";
	}
}

function getPos(id){
	if(v=parseInt(getCookie("CPOS"))) {
		previd=getCookie("CPOSID")
		if(id==previd) window.scroll(0,v);
	}
	return true;
}
function setPos(id,v){
	if(!v){
		if(window.scrollY){
			v=window.scrollY;
		} 
		else if(document.body.scrollTop){
			v=document.body.scrollTop;
		}
		else if (window.pageYOffset){
			v=window.pageYOffset;
		} 
		else {
			v=0;
		}
	}
	setCookie('CPOS',v);
	setCookie('CPOSID',id);
}

function SetImage(i) { 
	document.CassettePhoto.src=CassetteImage[i].src; 
	document.getElementById('CassetteCaption').innerHTML = CassetteLabel[i];
};
