// アサヒビール スクリプト

function INRYO_isUnicodeBrouser()
{
   var result = 0 - 0;
   var brouserUserAgent = new String(navigator.userAgent);

   if (brouserUserAgent.indexOf("MSIE") != -1 && brouserUserAgent.indexOf("4.5") != -1 && brouserUserAgent.indexOf("Mac") != -1)
   {
      result = 1 - 0;
   }
   return result;
}

function INRYO_isMozilla3Brouser()
{
   var result = 0 - 0;
   var brouserUserAgent = new String(navigator.userAgent);

   if (brouserUserAgent.indexOf("Mozilla/3") != -1)
   {
      result = 1 - 0;
   }

   return result;
}

function INRYO_searchKeyWord()
{
   if (document.INRYO_SEARCH_FORM.WORD.value == "")
   {
      if (INRYO_isUnicodeBrouser() == 1)
      {
         alert('Input Search Keyword !!');
      }
      else
      {
         alert('検索語が未入力です');
      }
   }
   else
   {
      // document.INRYO_SEARCH_FORM.action = "http://www.asahibeer.co.jp/cgi-bin/search_n.cgi";
      // document.INRYO_SEARCH_FORM.action = "http://www.asahibeer.co.jp/perl/search_n.cgi";
      document.INRYO_SEARCH_FORM.action = "http://www.asahiinryo.co.jp/web-service/common/search/";
      document.INRYO_SEARCH_FORM.submit();
   }
}
var GLOBAL_INRYO_popupWindow = null;
function INRYO_popupWindowOpen(url, height)
{
   if (url.indexOf("http://") == -1)
   {
      url = INRYO_hrefRoot + url;
   }

   var width  = 210;
   // var height = 520;

   if (GLOBAL_INRYO_popupWindow)
   {
      if (GLOBAL_INRYO_popupWindow.closed == false)
      {
         GLOBAL_INRYO_popupWindow.close();
      }
   }

   var attrib = "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes";
   while (GLOBAL_INRYO_popupWindow == null || GLOBAL_INRYO_popupWindow.closed == true)
   {
      GLOBAL_INRYO_popupWindow = open(url, "POPUP_WINDOW", attrib);
   }
}

function INRYO_openerHref(url)
{
   if (url.indexOf("http://") == -1)
   {
      url = INRYO_hrefRoot + url;
   }

   opener.top.location.href = url;

   self.close();
}

function INRYO_pageHref(url)
{
   if (url.indexOf("http://") == -1)
   {
      url = INRYO_hrefRoot + url;
   }

   top.location.href = url;
}

// マクロメディア ビヘイビアスクリプト

function MM_swapImgRestore_v3()
{
  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()
{
  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_v3.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_findObj_v3(n, d) { //v3.0
  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_v3(n,d.layers[i].document); return x;
}

function MM_swapImage_v3() { //v3.0
  var i,j=0,x,a=MM_swapImage_v3.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj_v3(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


<!--2003-->
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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];}
}
<!--2003.-->




// 公開・確認サイト間URLマッピングフレームワーク

var INRYO_locationHref = new String(location.href);
var INRYO_hrefRoot = "http://www.asahiinryo.co.jp/";
var INRYO_imageRoot = "http://www.asahiinryo.co.jp/";
if (INRYO_locationHref.indexOf("http://inryo.azincourt.co.jp") != -1)
{
   INRYO_hrefRoot = "http://inryo.azincourt.co.jp/";
   INRYO_imageRoot = "http://inryo.azincourt.co.jp/";
}
else if (INRYO_locationHref.indexOf("http://sub.asahiinryo.co.jp") != -1)
{
   INRYO_hrefRoot = "http://sub.asahiinryo.co.jp/";
   INRYO_imageRoot = "http://sub.asahiinryo.co.jp/";
}


// アサヒ飲料　マクロメディア関数

var GLOBAL_INRYO_headImagePath = "/image/";
var GLOBAL_INRYO_CurrentTopic = "";

function imgpreload(src){
	var img = new Image(); img.src = src;
}

function setimg(Num,File) {
	if(navigator.appVersion.charAt(0)>=3){
		imga=new Image();
		imga.src= File;
		document.images[Num].src=File;
	}
}

function setimgondiv(divname, imgname, imgsrc) {
	if(navigator.appVersion.charAt(0)>=3){
		var imgobj = getdivimg(divname, imgname);
		imga=new Image();
		imga.src= imgsrc;
		imgobj.src=imgsrc;
	}
}

function showdiv(divname){
	if ( document.all ){document.all( divname ).style.visibility ='visible';}
	else if ( document.layers){document.layers[ divname ].visibility ='show';}
	else if ( document.getElementById ){document.getElementById( divname ).style.visibility ='visible';}
}

function hidediv(divname){
	if ( document.all ){document.all( divname ).style.visibility ='hidden';}
	else if ( document.layers){document.layers[ divname ].visibility ='hide';}
	else if ( document.getElementById ){document.getElementById( divname ).style.visibility ='hidden';}
}

function movediv(divname,x,y){
	if(document.all){ document.all(divname).style.pixelLeft=x; document.all(divname).style.pixelTop=y;}                   //IE4用
	else if (document.layers){ document.layers[divname].left = x; document.layers[divname].top = y; }                     //NN4用
	else if (document.getElementById){ document.getElementById(divname).style.left=x; document.getElementById(divname).style.top=y; } //Moz,NN6,IE5用
}

function getdivimg(divname,imgname){
	if(document.all){return document.images[imgname];}
	else if (document.layers){ return document.layers[ divname ].document.images[imgname]; }
	else if (document.getElementById){ return document.images(imgname); }
}

function getabsleft_img(imgname){
	if(document.layers){ return document.images[imgname].x; }
	else {
		var x = 0, o = document.images[imgname];
		do { x += o.offsetLeft; o = o.offsetParent; } while (o != document.body);
		return x;
	}
}

function getabsright_img(imgname){
	if(document.layers){ return document.images[imgname].x + document.images[imgname].width; }
	else {
		var x = document.images[imgname].width, o = document.images[imgname];
		do { x += o.offsetLeft; o = o.offsetParent; } while (o != document.body);
		return x;
	}
}

function getabstop_img(imgname){
	if(document.layers){ return document.images[imgname].y; }
	else {
		var y = 0, o = document.images[imgname];
		do { y += o.offsetTop; o = o.offsetParent; } while (o != document.body);
		return y;
	}
}

function getabsbottom_img(imgname){
	if(document.layers){ return document.images[imgname].y + document.images[imgname].height; }
	else {
		var y = document.images[imgname].height, o = document.images[imgname];
		do { y += o.offsetTop; o = o.offsetParent; } while (o != document.body);
		return y;
	}
}

function mousover(menuname, popname, popimg){
	if(GLOBAL_INRYO_CurrentTopic != menuname){
		var offsetleftfrommenu = getabsleft_img(menuname) + menuobjs[menuname].divleftm;
		var offsettopfrommenu = getabsbottom_img(menuname) + menuobjs[menuname].divtopm;
		movediv(menuobjs[menuname].divname, offsetleftfrommenu, offsettopfrommenu);
		setimg(menuname, menuobjs[menuname].moversrc);
		if(GLOBAL_INRYO_CurrentTopic != ""){ hidediv(menuobjs[GLOBAL_INRYO_CurrentTopic].divname); }
		showdiv(menuobjs[menuname].divname);
	}
	if(mousover.arguments.length == 3){ setimgondiv(menuobjs[menuname].divname, popname, popimg); }
}

function mousout(menuname, popname, popimg){
	if(GLOBAL_INRYO_CurrentTopic != menuname){ setimg(menuname, menuobjs[menuname].moutsrc); }
	if(mousout.arguments.length == 3){ setimgondiv(menuobjs[menuname].divname, popname, popimg); }
	if(GLOBAL_INRYO_CurrentTopic != menuname){ hidediv(menuobjs[menuname].divname); if(GLOBAL_INRYO_CurrentTopic != ""){ showdiv(menuobjs[GLOBAL_INRYO_CurrentTopic].divname); } }
}

//lineupmenu
function lumenuover(menuname, menuimg, divname, popname, popimg){
	var x = getabsright_img(menuname);
	var y = getabstop_img(menuname);
	movediv(divname, x, y + 0);
	showdiv(divname);
	setimg(menuname, menuimg);
	if(lumenuover.arguments.length == 5){ setimgondiv(divname, popname, popimg); }
}

function lumenuout(menuname, menuimg, divname, popname, popimg){
	hidediv(divname);
	setimg(menuname, menuimg);
	if(lumenuout.arguments.length == 5){ setimgondiv(divname, popname, popimg); }
}

function menuinit(){
	if(GLOBAL_INRYO_CurrentTopic != ""){
		var offsetleftfrommenu = getabsleft_img(GLOBAL_INRYO_CurrentTopic) + menuobjs[GLOBAL_INRYO_CurrentTopic].divleftm;
		var offsettopfrommenu = getabsbottom_img(GLOBAL_INRYO_CurrentTopic) + menuobjs[GLOBAL_INRYO_CurrentTopic].divtopm;
		movediv(menuobjs[GLOBAL_INRYO_CurrentTopic].divname, offsetleftfrommenu, offsettopfrommenu);
		setimg(GLOBAL_INRYO_CurrentTopic, menuobjs[GLOBAL_INRYO_CurrentTopic].moversrc);
		showdiv(menuobjs[GLOBAL_INRYO_CurrentTopic].divname);
	}
}

window.onload = menuinit;
window.onresize = menuinit;

//========================================================================//
// 2005年　キャンペーン応募フォーム　ポップアップウィンドウ               //
//========================================================================//
var win;
function popupwindow( url )
{
	if( url != "" ) {
		win = window.open(url,"popupwindow","status=1,resizable=1,scrollbars=1,toolbar=0,directories=0,scrolling=1,menubar=0,location=1,width=740,height=700,")
		win.focus();
	}
}

//------------------------------------------------------------------------//
// J-stream CM Script                                                    //
//------------------------------------------------------------------------//
function SWindow(Aurl,Aname,Awidth,Aheight,Atoolbar,Alocation,Astatus,Ascroll,Amenu,Aresize){
	Astr = "width=" + Awidth;
	Astr+= ",height=" + Aheight;
	if(Atoolbar)Astr+= ",toolbar";
	if(Alocation)Astr+= ",location";
	if(Astatus)Astr+= ",status";
	if(Ascroll)Astr+= ",scrollbars";
	if(Amenu)Astr+= ",menubar";
	if(Aresize)Astr+= ",resizable";
	window.open(Aurl,Aname,Astr);
}

//------------------------------------------------------------------------//
// BC MovieWindow Script                                                    //
//------------------------------------------------------------------------//
var win;
function movie_pop_tab( url )
{
	if( url != "" ) {
		win = window.open(url,"movie_pop_tab","status=0,resizable=0,scrollbars=0,toolbar=0,directories=0,scrolling=0,menubar=0,location=0,width=966,height=546,")
		win.focus();
	}
}
function movie_pop_compact_tab( url )
{
	if( url != "" ) {
		win = window.open(url,"movie_pop_compact_tab","status=0,resizable=0,scrollbars=0,toolbar=0,directories=0,scrolling=0,menubar=0,location=0,width=798,height=503,")
		win.focus();
	}
}
function movie_pop_single( url )
{
	if( url != "" ) {
		win = window.open(url,"movie_pop_single","status=0,resizable=0,scrollbars=0,toolbar=0,directories=0,scrolling=0,menubar=0,location=0,width=492,height=490,")
		win.focus();
	}
}

function movie_pop_wide( url )
{
	if( url != "" ) {
		win = window.open(url,"movie_pop_single","status=0,resizable=0,scrollbars=0,toolbar=0,directories=0,scrolling=0,menubar=0,location=0,width=650,height=630,")
		win.focus();
	}
}

function movie_pop_fix( url )
{
	if( url != "" ) {
		win = window.open(url,"movie_pop_fix","status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,scrolling=0,menubar=0,location=0,width=990,height=550,")
		win.focus();
	}
}

