//-------------------------------------------------------------------------------
//DigitalLink　くんこくWebMagazine　用フレームジャンプニュープログラム
//株式会社アドバンスギア
//-------------------------------------------------------------------------------
//変数設定-----------------------------------------------------------------------

//各フレームトップのアドレス
TopNavi_aiboadr = "frame_top_aibo.htm"
TopNavi_psshopadr = "frame_top_psshop.htm"
TopNavi_kunkokuadr = "frame_top.htm"

//トップのアドレス
TopAdr = "index.htm"
TopAdrAibo = "index_aibo.htm"
TopAdrPsshop = "index_psshop.htm"

//フレームのアドレス
MainFrameAdr = "main_frame.htm"

//変数設定終わり-------------------------------------------------------------------

function tobu(title,url)
{

	tempCookie('title',title);
	tempCookie('url',url);

//リストメニューからトップへ
if(title==""&url!="")
{
		// 今いるフレームのトップに戻る場合はurlだけににtopを指定する
		if(url=="top")
		{
			def=getCookie('frametype');
			if (def=="aiboshop") parent.window.location.href=TopAdrAibo;
			else {
					if (def=="psshop")parent.window.location.href=TopAdrPsshop;
					else parent.window.location.href=TopAdr;
				}
		}
		//トップに戻らずにジャンプ
		else parent.window.location.href = url;
}
//普通のリンクからのジャンプ
else{
	//ジャンプメニューの区切り線の場合は何もしない
	if(title==""&url=="")return;
		//　それ以外普通のジャンプ
	else{
		if(parent.topnavi)
			{
			// フレームの中からフレームの中へ
					tempCookie('title',title);
					abc=getCookie('frametype');
					if (abc=="aiboshop")parent.topnavi.location.href = TopNavi_aiboadr;
						else {
							if (abc=="psshop")parent.topnavi.location.href = TopNavi_psshopadr;
							else parent.topnavi.location.href = TopNavi_kunkokuadr;
							}
						parent.main.location.href = url;
					return;
			}
		else {
			// フレームの外からフレームの中へ
				document.location.href = MainFrameAdr;
				frametype=selectframe(url);
				tempCookie('frametype',frametype);
			}
	}}
}
//-------------------------------------------------------------------------------
//フレームの外にいる時用飛び先フレーム検査
//-------------------------------------------------------------------------------
function selectframe(chkurl)
{
	str = chkurl;
	str="'"+ str + "'";
	result = str.match(/aiboshop/i);
	result1 = str.match(/psshop/i);
	if(result== "aiboshop") return result;
	else {
		if(result1== "psshop") return result1;
		else return false;
	}
}
//-------------------------------------------------------------------------------
//フレームのチェンジ　(フレーム外　→　フレーム内)
//-------------------------------------------------------------------------------
function changetopframe(){
	frametype=getCookie('frametype');
	if(frametype=="aiboshop")return "frame_top_aibo.htm";
	else{
		if(frametype=="psshop")return "frame_top_psshop.htm";
		else{
			return "frame_top.htm";
		}
	}
}

//-------------------------------------------------------------------------------
//中のフレームの読み込み　（フレーム外　→　フレーム内）
//-------------------------------------------------------------------------------
function loadurl()
{
	geturl = getCookie('url');
	parent.main.location.href = geturl;
}

function loadurl2()
{
	geturl = getCookie('url');
	return geturl;
}

//javascript:loadurl();
//-------------------------------------------------------------------------------
//タイトルを書き込む　　（フレーム外　→　フレーム内）
//-------------------------------------------------------------------------------
function writetitle()
{
	aa = getCookie('title');
//
	if(aa==false)document.write("DigitalLink kunkoku WebMagazine");
	else document.write(aa); 
}

//-------------------------------------------------------------------------------
//　一時的にCookieを使用するための関数
//　成功した時はtrue,失敗した時はfalseを返す
//-------------------------------------------------------------------------------

function tempCookie(theName__,theValue__)
{
	if ((theName__ != null) && (theValue__ != null))
	{
		document.cookie = theName__ + "="+escape(theValue__);
		return true;
	}
	return false;
}

//-------------------------------------------------------------------------------
//　Cookieから指定されたデータを抜きだす
//　成功した時はnull以外,失敗した時はfalseを返す
//-------------------------------------------------------------------------------
function getCookie(theName__)
{
	theName__ += "=";	//　=を追加して検索の手抜きをする
	theCookie__ = document.cookie+";";	//　検索時最終項目で-1になるのを防ぐ
	start__ = theCookie__.indexOf(theName__);	//　指定された名前を検索する
	if (start__ != -1)
	{
		end__ = theCookie__.indexOf(";",start__);
		return unescape(theCookie__.substring(start__+theName__.length,end__));
	}
	return false;
}

