/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 switch footer-background

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/
(function(){
	var bgSrc = ['contents_foot_bg.gif','contents_foot_bg02.gif','contents_foot_bg03.gif'];
	document.write('<style type="text/css">#document{background-image:url(/img/common/element/' + bgSrc[Math.floor(Math.random()*bgSrc.length)] + ')}</style>');
})();

/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Dream Weaver Function

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/

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];}}
}

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_openBrWindow(theURL,winName,features) { //v2.0
  subWin = window.open(theURL,winName,features);
		subWin.focus();
}

function CS_openBrWindow(theURL,winName,features) { //v2.0
  subWin = window.open(theURL,winName,features);
		subWin.focus();
}

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_showHideLayers() { //v6.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.parentNode && obj.parentNode.className == "posRelative"){
		obj.parentNode.style.zIndex = (obj.parentNode.style.zIndex==10)?0:10;
	}
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function gaPassthru(category, action) {
    pageTracker._trackEvent(category, action);
}



//ボックス表示切り替え
function boxChangeBuy(boxIdBuy){
	document.getElementById("recommendBuyOn").style.display = "none";
	document.getElementById("recommendBuyOff").style.display = "none";

	document.getElementById(boxIdBuy).style.display = "block";

	inputBoxBuy(boxIdBuy);
}
function boxChangeCheck(boxIdCheck){
	document.getElementById("recommendCheckOn").style.display = "none";
	document.getElementById("recommendCheckOff").style.display = "none";

	document.getElementById(boxIdCheck).style.display = "block";

	inputBoxCheck(boxIdCheck);
}


//状態を記憶する
function inputBoxBuy(idBuy) {
	setCookie("recommendBuy", idBuy);
	return(idBuy);
}
function inputBoxCheck(idCheck) {
	setCookie("recommendCheck", idCheck);
	return(idCheck);
}


//cookie処理
function getCookie(key) {
	var start, end;
	var tmp=document.cookie+";";
	var keyposition=tmp.indexOf(key, 0);
	if(keyposition!=-1) {
		tmp=tmp.substring(keyposition, tmp.length);
		start=tmp.indexOf("=", 0)+1;
		end=tmp.indexOf(";", start);
		return(unescape(tmp.substring(start, end)));
	}
	return("");
}
function setCookie(key, val) {
	var tmp= key+"="+escape(val)+";";

	time = new Date();
	time.setTime(time.getTime()+(60*60*24*1000*7));
	timeSet = "expires="+time.toGMTString();

	document.cookie = tmp + timeSet + ";path=/;";
	return true;
}
//function boxChangeBuy(boxIdBuy){
//	document.getElementById("recommendBuyOn").style.display = "none";
//	document.getElementById("recommendBuyOff").style.display = "none";
//
//	document.getElementById(boxIdBuy).style.display = "block";
//
//	inputBoxBuy(boxIdBuy);
//}
//function boxChangeCheck(boxIdCheck){
//    var recommendCheckOn = document.getElementById("recommendCheckOn");
//    var recommendCheckOff = document.getElementById("recommendCheckOff");
//    var boxIdCheck_ = document.getElementById(boxIdCheck);
//
//    if (recommendCheckOn != null) {
//        recommendCheckOn.style.display = "none";
//    }
//    if (recommendCheckOff != null) {
//        recommendCheckOff.style.display = "none";
//    }
//
//    if (boxIdCheck_ != null) {
//        boxIdCheck_.style.display = "block";
//    }
//
//	inputBoxCheck(boxIdCheck);
//}
//
//
//function inputBoxBuy(idBuy) {
//	setCookie("recommendBuy", idBuy);
//	return(idBuy);
//}
//function inputBoxCheck(idCheck) {
//	setCookie("recommendCheck", idCheck);
//	return(idCheck);
//}
//
//
//function getCookie(key) {
//	var start, end;
//	var tmp=document.cookie+";";
//	var keyposition=tmp.indexOf(key, 0);
//	if(keyposition!=-1) {
//		tmp=tmp.substring(keyposition, tmp.length);
//		start=tmp.indexOf("=", 0)+1;
//		end=tmp.indexOf(";", start);
//		return(unescape(tmp.substring(start, end)));
//	}
//	return("");
//}
//function setCookie(key, val) {
//	var tmp= key+"="+escape(val)+";";
//
//	time = new Date();
//	time.setTime(time.getTime()+(60*60*24*1000*7));
//	timeSet = "expires="+time.toGMTString();
//
//	document.cookie = tmp + timeSet + ";path=/;";
//	return true;
//}


var Cookies = {
    conf:{
        separator: "|"
    },
    createCookies:function(cookieName, cookieValue, expires) {
        var date_ = new Date().getTime();
        var expires_ = new Date(date_+(86400000*expires));
        var value_ = cookieName+"="+escape(cookieValue)+";expires="+expires_.toGMTString()+";path=/;";
        document.cookie = value_;
    },
    getCookies:function(cookieName) {
        var cookies_ = document.cookie.split("; ");
        var cookieValue_ = "";
        for(i=0;i<cookies_.length;i++) {
            var result_ = cookies_[i].split("=");
            if (result_[0] == cookieName) {
                cookieValue_ = unescape(result_[1]);
                break;
            }
        }
        return cookieValue_;
    },
    appendCookies:function(cookieName, thisCookieValue, limit, expires) {
        var cookies_ = this.getCookies(cookieName);
        if (cookies_) {
            var cookie_ = cookies_.split(this.conf.separator);
            var limit_ = limit -1;
            if (cookie_.length >= limit_) {
                cookies_ = "";
                for (i=0;i<limit_;i++) {
                    cookies_ += (i!=0) ? this.conf.separator+cookie_[i] : cookie_[i];
                }
            }

            if (cookies_.indexOf(thisCookieValue) == -1) {
                this.createCookies(cookieName, thisCookieValue + this.conf.separator + cookies_, expires);
            } else {}
        } else {
            this.createCookies(cookieName, thisCookieValue, expires);
        }
    },
    toArray:function(cookieValue) {
            return (cookieValue.indexOf(this.conf.separator) != -1) ? cookieValue.split(this.conf.separator) : cookieValue;
        }
}


