var path	= new Array();
var login	= new Array();
var o_path	= new Array(
	'outside/agency/appli.html',
	'outside/media/sales.html',
	'outside/media/hachiko_reg.html',
	'outside/media/south_reg.html',
	'outside/media/moyai_reg.html',
	'outside/media/qs_reg.html',
	'outside/media/q2_reg.html',
	'outside/agency/inquiry.html',
	'outside/agency/appli_2.html',
	'outside/agency/news/index.html'
);
var t_path	= new Array(
	'traffic/agency/station/index.html',
	'traffic/agency/busroute/index.html',
	'traffic/agency/tokyu_ad/page_1.html'
);
path	= new Array(o_path,t_path);

//RF
var actype_o	= getCookie('ACTYPEo');
var o_login	= 0;
if ( actype_o == 'o' ){
	o_login	= 1;
}
var actype_t	= getCookie('ACTYPEt');
var t_login	= 0;
if (actype_t == 't' ){
	t_login	= 1;
}
//alert(o_login+":"+t_login)
login = new Array(o_login,t_login);

//RF
//------------------------------------------------------
function testMess(MESS){
	alert(MESS);
}
function setAccount(TYPE){
	setCookie('ACTYPE'+TYPE,TYPE);
}
function getCookie(KEY){
	var tmp		= document.cookie + ";";
	var offset	= tmp.indexOf(KEY, 0);
	if( offset != -1 ){
		tmp		= tmp.substring(offset, tmp.length);
		offset	= tmp.indexOf("=", 0) + 1;
		var end	= tmp.indexOf(";", offset);
		return(unescape(tmp.substring(offset, end)));
	}
	return("");
}
function setCookie(K, V, DAY) {
	if ( DAY ) {
		var date	= new Date();
		date.setTime(date.getTime()+( DAY*24*60*60*1000 ));
		var expires	= "; expires="+date.toGMTString();
	} else {
		var expires	= "";
	}
	document.cookie	= K + "=" + V + expires + "; path=/";
}
//------------------------------------------------------


var sHeight = function(){
	var winHeight = window.screen.availWidth;
	if(winHeight<=1024){
		var Hight = winHeight - 40;
	}else if(winHeight>1024){
		var Hight = "100%";
	}
	return Hight;
}

var mySwitch = function(x,y){
	if(x==1){
		switch(y){//ログイン時
			
			case 'header':
				write('<div id="header" class="login header">');
				break;
				
			case 'loginIcon':
				write('<p id="loginIcon"><span>ログイン中</span></p>');
				break;
				
			case 'traffic_gn':
				var link = link();
				write('<li id="gn03"><a href="' + link + path[1][0] + '" title="駅図情報">駅図情報</a></li>'
					+ '<li id="gn04"><a href="' + link + path[1][1] + '" title="バス路線図情報">バス路線図情報</a></li>'
					+ '<li id="gn05"><a href="' + link + path[1][2] + '" title="東急広告会">東急広告会</a></li>'
				);
				break;
				
			case 'outside_gn':
				var link = link();
				write('<li id="gn03"><a href="' + link + path[0][0] + '" title="申込・決定基準">申込・決定基準</a></li>');
				var inq = document.getElementById('toInquiry');
				inq.setAttribute('href',link + path[0][7]);//お問い合わせのリンク先も変更
				break;
				
			case 'outside_gn2':
				var link = link();
				write('<li id="gn05"><a class="popupWindow" href="' + link + path[0][8] + '" title="空枠状況">空枠状況</a></li>');
				var news = document.getElementById('toNews');
				news.setAttribute('href',link + path[0][9]);//メディアニュースのリンク先も変更
				break;
				
			case 'os_ln_sl':
				var link = link();
				var re = new RegExp(path[0][1],"i");
				if(location.href.search(re) != -1){//現在のURLにpath[0][1]を含んでいる場合
					write('<li id="ln1-6" class="current"><a href="' + link + path[0][1] + '">セールスシート</a></li>');
				}else{
					write('<li id="ln1-6"><a href="' + link + path[0][1] + '">セールスシート</a></li>');
				}
				break;
				
			case 'hachiko':
				var link = link();
				write('<a href="hachiko_ad.html" class="popupWindow" target="_blank" style="position:absolute;top:81px;left:290px;"><img src="../../images/common/outside/btn_ad_pattern.gif" alt="広告掲出パターン" width="204" height="36" /></a>'
					+ '<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" style="position:absolute;top:119px;left:290px;"><img src="../../images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
					+ '<img src="' + link + 'images/common/dotted_line02.gif" alt="　" width="197" height="1" style="position:absolute;top:185px;left:290px;margin-left:3px;" />'
					+ '<a href="' + link + path[0][2] + '" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_reg.gif" alt="掲出規定" width="204" height="36" /></a>'
				);
				break;
				
			case 'south':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=1" target="_blank" style="position:absolute;top:119px;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
					+ '<img src="' + link + 'images/common/dotted_line02.gif" alt="　" width="197" height="1" style="position:absolute;top:185px;left:290px;margin-left:3px;" />'
					+ '<a href="' + link + path[0][3] + '" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_reg.gif" alt="掲出規定" width="204" height="36" /></a>'
				);
				break;
				
			case 'moyai':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=1" target="_blank" style="position:absolute;top:119px;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
					+ '<img src="' + link + 'images/common/dotted_line02.gif" alt="　" width="197" height="1" style="position:absolute;top:185px;left:290px;margin-left:3px;" />'
					+ '<a href="' + link + path[0][4] + '" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_reg.gif" alt="掲出規定" width="204" height="36" /></a>'
				);
				break;
				
			case 'qs':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" target="_blank" style="position:absolute;top:119px;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
					+ '<img src="' + link + 'images/common/dotted_line02.gif" alt="　" width="197" height="1" style="position:absolute;top:185px;left:290px;margin-left:3px;" />'
					+ '<a href="' + link + path[0][5] + '" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_reg.gif" alt="掲出規定" width="204" height="36" /></a>'
				);
				break;
				
			case 'q2':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" target="_blank" style="position:absolute;top:119px;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
					+ '<img src="' + link + 'images/common/dotted_line02.gif" alt="　" width="197" height="1" style="position:absolute;top:185px;left:290px;margin-left:3px;" />'
					+ '<a href="' + link + path[0][6] + '" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_reg.gif" alt="掲出規定" width="204" height="36" /></a>'
				);
				break;
			
			case 'bus_13_tbl':
				var link = link();
				write('<table summary="料金表" class="mb20">'
						+ '<thead class="tac_all_th">'
						+ '	<tr class="this_bgc01">'
						+ '	  <th rowspan="2">&nbsp;</th>'
						+ '	  <th colspan="2">制作費</th>'
						+ '	  <th rowspan="2">施工費他</th>'
						+ '	  </tr>'
						+ '	<tr class="this_bgc01">'
						+ '		<th>右面</th>'
						+ '		<th>左面</th>'
						+ '	</tr>'
						+ '</thead>'
						+ '<tbody class="tac_all_th tar_all_td">'
						+ '	<tr>'
						+ '		<th scope="row">1台</th>'
						+ '		<td class="uniform">57,000円</td>'
						+ '		<td class="uniform">33,000円</td>'
						+ '		<td rowspan="3" class="uniform">40,000円</td>'
						+ '	</tr>'
						+ '	<tr>'
						+ '		<th scope="row">偶数台</th>'
						+ '		<td class="uniform">30,000円</td>'
						+ '		<td class="uniform">20,000円</td>'
						+ '		</tr>'
						+ '	<tr>'
						+ '		<th scope="row">3台</th>'
						+ '		<td class="uniform">38,000円</td>'
						+ '		<td class="uniform">22,000円</td>'
						+ '		</tr>'
						+ '</tbody>'
						+ '</table>'
				);
				break;
				
			case 'bus_13_ol':
				var link = link();
				write('<ol>'
						+ '<li>施工費他には取付＆剥離費及び保険が含まれています。</li>'
						+ '<li>4台以上の場合は偶数台の制作費を適用します。</li>'
						+ '<li>片面のみの施工費他も両面と同料金となります。</li>'
						+ '</ol>'
				);
				break;
				
			default:
				write("error...");
				break;
		}
	}else if(x!=1){//非ログイン時
		switch(y){
			case 'header':
				write('<div id="header" class="header">');
				break;
				
			case 'hachiko':
				var link = link();
				write('<a href="hachiko_ad.html" class="popupWindow" target="_blank" style="position:absolute;bottom:56px;left:290px;"><img src="../../images/common/outside/btn_ad_pattern.gif" alt="広告掲出パターン" width="204" height="36" /></a>'
					+ '<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" style="position:absolute;bottom:0;left:290px;"><img src="../../images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>'
				);
				break;
				
			case 'south':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=1" target="_blank" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>');
				break;
				
			case 'moyai':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=1" target="_blank" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>');
				break;
				
			case 'qs':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" target="_blank" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>');
				break;
				
			case 'q2':
				var link = link();
				write('<a href="http://www.tokyu-agc.co.jp/tokyu-ooh/demography/index.html?id=2" target="_blank" style="position:absolute;bottom:0;left:290px;"><img src="' + link + 'images/common/outside/btn_watch_demo.gif" alt="この媒体のあるエリアのデモグラフィを見る" width="204" height="56" /></a>');
				break;
			
			case 'bus_13_ol':
				var link = link();
				write('<ol>'
						+ '<li>制作費が別途かかります。担当までお問い合わせ下さい。</li>'
						+ '</ol>'
				);
				break;
				
			default:
				break;
		}
	}
	
	function link(){
		var logo = document.getElementById('logo');
		var toRoot = logo.getAttribute('href');
		var link = toRoot.replace('index.html','');
		return link;
	}
	
	function write(str){
		document.write(str);
	}
}

Event.observe(window, 'load', loadAccordions, false);
function loadAccordions() {
	if(!window.opera){
		if($$('#accordion_container')!=""){
			var bottomAccordion = new accordion('accordion_container',{
				classNames : {
							toggle : 'accordion_toggle',
							toggleActive : 'accordion_toggle_active',
							content : 'accordion_content'
						},
				resizeSpeed : 12,
		    	direction : 'vertical'
			});
		}
	}
}

window.onload = function(){
	
	if($$('.popupWindow')!=""){
		var oh = $$('.popupWindow');
		oh.each(function(l){
			l.onclick = function(){
				var url = l.getAttribute('href');
				l.setAttribute('target','');
				var ContextWindow = window.open(url,'_blank','width=620,height=740,resizable=1,scrollbars=1,menubar=0,toolbar=0');
				ContextWindow.focus();
				return false;
			}
		});
	}
	
	if($$('.closeBtn')!=""){
		var cd = $$('.closeBtn');
		cd.each(function(l){
			l.onclick = function(){
				window.close();
				return false;
			}
		});
	}
}


//newshibuya - amana
function newShibuya(){
		contents = window.open('../../newshibuya/','newshibuya','toolbar=yes,scrollbars=yes,resizable=yes').focus();
}


function parentOpe(url){
	if(!window.opener || window.opener.closed){ // メインウィンドウの存在をチェック
		window.open(url,'main','toolbar=yes,scrollbars=yes,resizable=yes').focus();
	}
	else{
		window.opener.location.href = url; // 存在する場合はページを切りかえる
	}
}
