/*
 * Common JavaScript Library
 *
 * Revison - 00 2001.03.23 S.Takikawa ( takikawa@beans.co.jp )
 * Revison - 01 2001.08.20 S.Takikawa ( takikawa@beans.co.jp )
 *
 */


function showFlash(source,width,height) {
	document.write("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+width+"\" height=\""+height+"\">");
	document.write("<PARAM name=\"movie\" value=\""+source+"\">");
	document.write("<PARAM name=\"quality\" value=\"high\">");
	document.write("<PARAM NAME=\"BGCOLOR\" VALUE=\"#FFFFFF\">");
	document.write("<EMBED src=\""+source+"\" width=\""+width+"\" height=\""+height+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" BGCOLOR=\"#FFFFFF\"></EMBED>");
	document.write("</OBJECT>");
}


// add 2006.04.24 by Heviz Sekioka
// change 2006.11.08 by Heviz Sekioka
function openIngre(id) {
	url ="ingre/index.html?itemid="+id;
	window.open(url,'seibun','scrollbars=no,resizable=no,width=440,height=300');
}


// add 2006.04.24 by Heviz Sekioka
// change 2006.11.08 by Heviz Sekioka
function openTips(id) {
	url = "../avenue/faq/tips" + id + ".html";
	window.open(url,'tips','scrollbars=yes,resizable=yes,width=440,height=350');
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function jumpOther(goURL) {
	where = goURL.options[goURL.selectedIndex].value;
	if (where != "")  {
		parent.location.href = where
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*
 *
 */
function fnGetBrowserName() {
	var aName  = navigator.appName.toUpperCase();
	if (aName.indexOf("NETSCAPE") >= 0)  return "Netscape";
	if (aName.indexOf("MICROSOFT") >= 0) return "Explorer";
	return "";
}

function fnGetBrowserVersion() {
	var browser = fnGetBrowserName();
	var version = 0, s = 0, e = 0;
	var appVer  = navigator.appVersion;
	if (browser == "Netscape") {
		s = appVer.indexOf(" ",0);
		version = eval(appVer.substring(0,s));
		if (version >= 5) version++;
	}
	if (browser == "Explorer") {
		appVer  = navigator.userAgent;
		s = appVer.indexOf("MSIE ",0) + 5;
		e = appVer.indexOf(";",s);
		version = eval(appVer.substring(s,e));
	}
	return version;
}

function fnGetOSType() {
	var RetCode = "";
	var uAgent  = navigator.userAgent.toUpperCase();
	if (uAgent.indexOf("MAC") >= 0) RetCode = "MacOS";
	if (uAgent.indexOf("WIN") >= 0) RetCode = "Windows";
	if (uAgent.indexOf("X11") >= 0) RetCode = "UNIX";
	return RetCode;
}

function fnCheckBrowser(nVer,nYesURL,nNoURL,eVer,eYesURL,eNoURL,etcURL) {
	var browser = fnGetBrowserName();
	var version = fnGetBrowserVersion();
	if (browser == "Netscape") {
		if(version >= nVer) {
			if(nYesURL != '') window.location=unescape(nYesURL);
		} else {
			if(nNoURL != '') window.location=unescape(nNoURL);
		}
	}else if(browser == "Explorer") {
		if(version >= eVer) {
			if(eYesURL != '') window.location=unescape(eYesURL);
		} else {
			if(eNoURL != '') window.location=unescape(eNoURL);
		}
	}else{
		if(etcURL != '') window.location=unescape(etcURL);
	}
}

function fnJumpMenuGo(selName,targ,restore){ //v3.0
  MM_jumpMenuGo(selName, targ, restore);
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}




//if (fnGetOSType() == "MacOS") {
//	fnCheckBrowser(6,'','/caution.html',5,'','/caution.html','/caution.html' );
//} else if (fnGetOSType() == "Windows") {
//	fnCheckBrowser(6,'','/caution.html',4,'','/caution.html','/caution.html' );
//} else {
//	fnCheckBrowser(6,'','/caution.html',4,'','/caution.html','/caution.html' );
//}

var brName = fnGetBrowserName();
var brVer  = fnGetBrowserVersion();
var osType = fnGetOSType();

// MENU Ctrl Arrays
var menuChild = new Array( "MenuHome", "MenuProducts", "MenuBeauty", "MenuCounseling", "MenuCommunication", "MenuAyurashop", "MenuOnlineShop" );

function fnMenuChildCtl(arg1,arg2,arg3) {

	fnMenuAllOff();

	if(arg3 == "hide"){
		if(brName == "Netscape"){
			if(brVer >= 5){
				if(MM_findObj(arg1)) { document.getElementById(arg1).style.visibility="hide"; }
			} else if(brVer >= 4){
				if(MM_findObj(arg1)) { document.layers[arg1].visibility="hidden"; }
			}
		} else if(brName == "Explorer"){
			if(brVer >= 4 && osType == "Windows"){
				if(MM_findObj(arg1)) { document.all[arg1].style.visibility="hidden"; }
			} else if (brVer >= 5 && osType == "MacOS"){
				if(MM_findObj(arg1)) { document.all[arg1].style.visibility="hidden"; }
			}
		}
	} else if(arg3 == "show"){
		if(brName == "Netscape"){
			if(brVer >= 5){
				if(MM_findObj(arg1)) { document.getElementById(arg1).style.visibility="visible"; }
			} else if(brVer >= 4){
				if(MM_findObj(arg1)) { document.layers[arg1].visibility="visible"; }
			}
		} else if(brName == "Explorer"){
			if(brVer >= 4 && osType == "Windows"){
				if(MM_findObj(arg1)) { document.all[arg1].style.visibility="visible"; }
			} else if (brVer >= 5 && osType == "MacOS"){
				if(MM_findObj(arg1)) { document.all[arg1].style.visibility="visible"; }
			}
		}
	}
}

function fnMenuAllOff() {

	if(brName == "Netscape"){
		if(brVer >= 5){
			for(i=0; i < menuChild.length; i++){
				if(MM_findObj(menuChild[i])) { document.getElementById(menuChild[i]).style.visibility="hidden"; }
			}
		} else if(brVer >= 4){
			for(i=0; i < menuChild.length; i++){
				if(MM_findObj(menuChild[i])) { document.layers[menuChild[i]].visibility="hidden"; }
			}
		}
	} else if(brName == "Explorer"){
		if(brVer >= 4 && osType == "Windows"){
			for(i=0; i < menuChild.length; i++){
				if(MM_findObj(menuChild[i])) { document.all[menuChild[i]].style.visibility="hidden"; }
			}
		} else if (brVer >= 5 && osType == "MacOS"){
			for(i=0; i < menuChild.length; i++){
				if(MM_findObj(menuChild[i])) { document.all[menuChild[i]].style.visibility="hidden"; }
			}
		}
	}

}


