/* ------------------------------------------------------
/* 更新履歴
------------------------------------------------------ */
/* 2011/11/25
   ・サイトカタリスト PRIUS PHV車種コンテンツ対応

/* 2011/5/26
   ・サイトカタリスト iPhoneアプリ対応
 
/* 2010/12/15
   ・フッターデザイン変更

/* 2010/11/30
   ・サイトカタリストver3テスト版
   
/* 2010/3/1
   ・サイトセンサスタグ削除対応
     
/* 2009/11/17
   ・サイトカタリスト出力用の処理追記、サイトセンサス
     出力用の処理を削除
   
/* 2009/09/08
   ・レコメンドビーコン画像出力処理追記

/* 2009/07/23
   ・サイトカタリストの計測タグを追加

/* 2008/12/05
   ・新規作成
------------------------------------------------------ */


/******************************************************************************/
//etoyota.net効果検証ビーコン用JS読み込み

var protocol = location.protocol.indexOf('https') > -1 ? 'https:' : 'http:';
var url = protocol + '//etoyota.net/include/js/measurementBeacon.js';

document.write('<script src="' + url + '" type="text/javascript"></script>');


/******************************************************************************/
//Google Analystics用JS読み込み
if(location.protocol.indexOf('https') == -1){
	document.write('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>');
}else {
	document.write('<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>');
}


/******************************************************************************/
//フッター出力
if (location.protocol.indexOf('https') > -1){
	document.write('<script src="/include/js/footer_data-ssl.js" type="text/javascript" charset="Shift_JIS"></script>');
}else{
	document.write('<script src="/include/js/footer_data.js" type="text/javascript" charset="Shift_JIS"></script>');
}
//フッターサイトマップ
function outputFooter(){
	var htmlStr="";

	htmlStr += '<div id="footerArea"><div id="footer">';
	htmlStr += '<p class="pagetop"><a href="#"><img src="/image/footer/footer_pagetop.gif" alt="ページトップへ戻る" width="126" height="33"></a></p>';


	for(i=0;i<footer_data_title.length;i++){
		//タイトル
		if(footer_data_title[i].boxtype){
			htmlStr += '<div class="box_recommend">';
		}else{
			htmlStr += '<div class="box_nav">';
		}

		if (footer_data_title[i].url){
			htmlStr += '<p><a href="'+footer_data_title[i].url+'" target="'+footer_data_title[i].target+'"><img src="' + footer_data_title[i].imagae + '" alt="' + footer_data_title[i].alt + '" width="' + footer_data_title[i].width + '" height="' + footer_data_title[i].height + '"></a></p>';
		}else{
			htmlStr += '<p><img src="' + footer_data_title[i].imagae + '" alt="' + footer_data_title[i].alt + '" width="' + footer_data_title[i].width + '" height="' + footer_data_title[i].height + '"></p>';
		}
		htmlStr += "<ul>";
		for(j=0;j<footer_data_title[i].contents.length;j++){
			//ターゲット有り無し
			if(footer_data_title[i].contents[j].target != ""){
				//おすすめリンクかどうか
				if(footer_data_title[i].contents[0].image){
					htmlStr += '<li><a  target="'+ footer_data_title[i].contents[j].target +'" href="' + footer_data_title[i].contents[j].url + '"><img src="'+ footer_data_title[i].contents[j].image +'" alt="'+ footer_data_title[i].contents[j].alt +'" width="'+ footer_data_title[i].contents[j].width +'" height="'+ footer_data_title[i].contents[j].height +'"></a></li>';
				}else{
					htmlStr += '<li><a  target="'+ footer_data_title[i].contents[j].target +'" href="' + footer_data_title[i].contents[j].url + '">' + footer_data_title[i].contents[j].title + '</a></li>';
				}
			}else{
				if(footer_data_title[i].contents[0].image){
					htmlStr += '<li><a href="'+ footer_data_title[i].contents[j].url +'"><img src="'+ footer_data_title[i].contents[j].image +'" alt="'+ footer_data_title[i].contents[j].alt +'" width="'+ footer_data_title[i].contents[j].width +'" height="'+ footer_data_title[i].contents[j].height +'"></a></li>';
				}else{
					htmlStr += '<li><a href="' + footer_data_title[i].contents[j].url + '">' + footer_data_title[i].contents[j].title + '</a></li>';
				}
			}
		}
		htmlStr += "</ul></div>";
		if(footer_data_title[i].contents[0].image){
			document.write(htmlStr);
			htmlStr="";
		}else{
			document.write(htmlStr);
			htmlStr="";
		}
	}

	htmlStr += '</div><!-- /footer --><div id="footerbtmArea">';
	if (location.protocol.indexOf('https') > -1){
		htmlStr += '<div id="footerbtm"><p class="copy"><img src="/image/footer/footer_copyright.gif" alt="(c) TOYOTA MOTOR CORPORATION. ALL RIGHTS RESERVED." width="302" height="8"></p><ul><li><a href="http://toyota.jp/sp/mobile.html"><img src="/image/footer/footer_fnav01.gif" alt="モバイル" width="40" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/sitemap/"><img src="/image/footer/footer_fnav02.gif" alt="サイトマップ" width="55" height="10" class="imgover"></a></li><li><a target="_blank" href="http://www.toyota.co.jp/jp/link/index.html"><img src="/image/footer/footer_fnav06.gif" alt="リンク" width="28" height="10" class="imgover"></a></li><li><a href="http://www2.toyota.co.jp/toyotajp/faq/"><img src="/image/footer/footer_fnav03.gif" alt="お問い合わせ" width="60" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/tp/attribute/"><img src="/image/footer/footer_fnav04.gif" alt="ご利用に際して" width="67" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/tp/attribute/privacy_statement.html"><img src="/image/footer/footer_fnav05.gif" alt="個人情報の取り扱いについて" width="131" height="10" class="imgover"></a></li></ul></div>';
	}else{
		htmlStr += '<div id="footerbtm"><p class="copy"><img src="/image/footer/footer_copyright.gif" alt="(c) TOYOTA MOTOR CORPORATION. ALL RIGHTS RESERVED." width="302" height="8"></p><ul><li><a href="/sp/mobile.html"><img src="/image/footer/footer_fnav01.gif" alt="モバイル" width="40" height="10" class="imgover"></a></li><li><a href="/sitemap/"><img src="/image/footer/footer_fnav02.gif" alt="サイトマップ" width="55" height="10" class="imgover"></a></li><li><a target="_blank" href="http://www.toyota.co.jp/jp/link/index.html"><img src="/image/footer/footer_fnav06.gif" alt="リンク" width="28" height="10" class="imgover"></a></li><li><a href="http://www2.toyota.co.jp/toyotajp/faq/"><img src="/image/footer/footer_fnav03.gif" alt="お問い合わせ" width="60" height="10" class="imgover"></a></li><li><a href="/tp/attribute/"><img src="/image/footer/footer_fnav04.gif" alt="ご利用に際して" width="67" height="10" class="imgover"></a></li><li><a href="/tp/attribute/privacy_statement.html"><img src="/image/footer/footer_fnav05.gif" alt="個人情報の取り扱いについて" width="131" height="10" class="imgover"></a></li></ul></div>';
	}
	htmlStr += '<!-- /footerbtmArea --></div><!-- /footerbtm --></div><!-- /footerArea -->';
	document.write(htmlStr);
	outputBeacon();
}

function printFooter_Ex(){
	var htmlStr="";

	htmlStr += '<div id="footerArea"><div id="footer">';
	htmlStr += '<p class="pagetop"><a href="#top"><img src="/image/footer/footer_pagetop.gif" alt="ページトップへ戻る" width="126" height="33"></a></p>';


	for(i=0;i<footer_data_title.length;i++){
		//タイトル
		if(footer_data_title[i].boxtype){
			htmlStr += '<div class="box_recommend">';
		}else{
			htmlStr += '<div class="box_nav">';
		}

		if (footer_data_title[i].url){
			htmlStr += '<p><a href="'+footer_data_title[i].url+'" target="'+footer_data_title[i].target+'"><img src="' + footer_data_title[i].imagae + '" alt="' + footer_data_title[i].alt + '" width="' + footer_data_title[i].width + '" height="' + footer_data_title[i].height + '"></a></p>';
		}else{
			htmlStr += '<p><img src="' + footer_data_title[i].imagae + '" alt="' + footer_data_title[i].alt + '" width="' + footer_data_title[i].width + '" height="' + footer_data_title[i].height + '"></p>';
		}
		htmlStr += "<ul>";
		for(j=0;j<footer_data_title[i].contents.length;j++){
			//ターゲット有り無し
			if(footer_data_title[i].contents[j].target != ""){
				//おすすめリンクかどうか
				if(footer_data_title[i].contents[0].image){
					htmlStr += '<li><a  target="'+ footer_data_title[i].contents[j].target +'" href="' + footer_data_title[i].contents[j].url + '"><img src="'+ footer_data_title[i].contents[j].image +'" alt="'+ footer_data_title[i].contents[j].alt +'" width="'+ footer_data_title[i].contents[j].width +'" height="'+ footer_data_title[i].contents[j].height +'"></a></li>';
				}else{
					htmlStr += '<li><a  target="'+ footer_data_title[i].contents[j].target +'" href="' + footer_data_title[i].contents[j].url + '">' + footer_data_title[i].contents[j].title + '</a></li>';
				}
			}else{
				if(footer_data_title[i].contents[0].image){
					htmlStr += '<li><a href="'+ footer_data_title[i].contents[j].url +'"><img src="'+ footer_data_title[i].contents[j].image +'" alt="'+ footer_data_title[i].contents[j].alt +'" width="'+ footer_data_title[i].contents[j].width +'" height="'+ footer_data_title[i].contents[j].height +'"></a></li>';
				}else{
					htmlStr += '<li><a href="' + footer_data_title[i].contents[j].url + '">' + footer_data_title[i].contents[j].title + '</a></li>';
				}
			}
		}
		htmlStr += "</ul></div>";
		if(footer_data_title[i].contents[0].image){
			document.write(htmlStr);
			htmlStr="";
		}else{
			document.write(htmlStr);
			htmlStr="";
		}
	}

	htmlStr += '</div><!-- /footer --><div id="footerbtmArea">';
	if (location.protocol.indexOf('https') > -1){
		htmlStr += '<div id="footerbtm"><p class="copy"><img src="/image/footer/footer_copyright.gif" alt="(c) TOYOTA MOTOR CORPORATION. ALL RIGHTS RESERVED." width="302" height="8"></p><ul><li><a href="http://toyota.jp/sp/mobile.html"><img src="/image/footer/footer_fnav01.gif" alt="モバイル" width="40" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/sitemap/"><img src="/image/footer/footer_fnav02.gif" alt="サイトマップ" width="55" height="10" class="imgover"></a></li><li><a target="_blank" href="http://www.toyota.co.jp/jp/link/index.html"><img src="/image/footer/footer_fnav06.gif" alt="リンク" width="28" height="10" class="imgover"></a></li><li><a href="http://www2.toyota.co.jp/toyotajp/faq/"><img src="/image/footer/footer_fnav03.gif" alt="お問い合わせ" width="60" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/tp/attribute/"><img src="/image/footer/footer_fnav04.gif" alt="ご利用に際して" width="67" height="10" class="imgover"></a></li><li><a href="http://toyota.jp/tp/attribute/privacy_statement.html"><img src="/image/footer/footer_fnav05.gif" alt="個人情報の取り扱いについて" width="131" height="10" class="imgover"></a></li></ul></div>';
	}else{
		htmlStr += '<div id="footerbtm"><p class="copy"><img src="/image/footer/footer_copyright.gif" alt="(c) TOYOTA MOTOR CORPORATION. ALL RIGHTS RESERVED." width="302" height="8"></p><ul><li><a href="/sp/mobile.html"><img src="/image/footer/footer_fnav01.gif" alt="モバイル" width="40" height="10" class="imgover"></a></li><li><a href="/sitemap/"><img src="/image/footer/footer_fnav02.gif" alt="サイトマップ" width="55" height="10" class="imgover"></a></li><li><a target="_blank" href="http://www.toyota.co.jp/jp/link/index.html"><img src="/image/footer/footer_fnav06.gif" alt="リンク" width="28" height="10" class="imgover"></a></li><li><a href="http://www2.toyota.co.jp/toyotajp/faq/"><img src="/image/footer/footer_fnav03.gif" alt="お問い合わせ" width="60" height="10" class="imgover"></a></li><li><a href="/tp/attribute/"><img src="/image/footer/footer_fnav04.gif" alt="ご利用に際して" width="67" height="10" class="imgover"></a></li><li><a href="/tp/attribute/privacy_statement.html"><img src="/image/footer/footer_fnav05.gif" alt="個人情報の取り扱いについて" width="131" height="10" class="imgover"></a></li></ul></div>';
	}
	htmlStr += '<!-- /footerbtmArea --></div><!-- /footerbtm --></div><!-- /footerArea -->';

	//効果検証ビーコン
	var _measurement_host = 'etoyota.net';
	var protocol = location.protocol.indexOf('https')>-1?'https:':'http:';
	var url = protocol + '//' + _measurement_host + '/measurement/access/contents';
	url += '?from=' + escape(document.referrer);
	url += '&to=' + escape(window.location);
	htmlStr +='<img src="' + url + '">';

	document.write(htmlStr);
}

/******************************************************************************/
//ビーコン出力

function outputBeacon(){
	var htmlStr = "";

	etoyota_bc();
	google_bc();
	recommend_bc();
	SCoutput_bc();
}

/******************************************************************************/
//サイトカタリスト　ビーコン  2010/3 センサスタグ削除版
function SCoutput_bc(){
	var catalystStr = "";
	//s_code.jsの読み込み
	//IEのURL最大長：2083バイト対応（2083バイトを超える文字列をサイトカタリストに送信できないため）
	if((document.URL.indexOf('/service/estimate_simulation')  > -1) || (document.URL.indexOf('/service/dealer_estimate')  > -1) 
	|| (document.URL.indexOf('/service/dealer/spt/search')  > -1) || (document.URL.indexOf('/service/dealer/spt/store-detail')  > -1)){
		// 見積りシミュレーション
		catalystStr += '<script language="JavaScript" type="text/javascript">';
		catalystStr += ' var SCaccount="toyotamotortoyotajpprd"';
		catalystStr += '</script>';
		catalystStr += '<script language="JavaScript" src="/include/js/s_code_sim.js"></script>';
	}else if(document.URL.indexOf('/iphone/dc/base-car-detail')  > -1 || (document.URL.indexOf('/iphone/dc/gallery')  > -1) 
	|| (document.URL.indexOf('/iphone/dc/special-car-detail')  > -1)){
		// iPhoneアプリ
		catalystStr += '<script language="JavaScript" type="text/javascript">';
		catalystStr += ' var SCaccount="toyotamotorapptoyotajpprd"';
		catalystStr += '</script>';
		catalystStr += '<script language="JavaScript" src="/include/js/s_code_app.js"></script>';
	}else if(document.URL.indexOf('toyota.jp/priusphv/') > -1){
		// PRIUS PHV車種コンテンツ
		catalystStr += '<script language="JavaScript" type="text/javascript">';
		catalystStr += ' var SCaccount="toyotamotorphvprd,toyotamotortoyotajpprd"';
		catalystStr += '</script>';
		catalystStr += '<script language="JavaScript" src="/include/js/s_code_phv.js"></script>';
	}else{
		// 通常のs_code.jsの読み込み
		catalystStr += '<script language="JavaScript" type="text/javascript">';
		catalystStr += ' var SCaccount="toyotamotortoyotajpprd"';
		catalystStr += '</script>';
		catalystStr += '<script language="JavaScript" src="/include/js/s_code_v2.js"></script>';
	}
	document.write(catalystStr);
}


/******************************************************************************/
//etoyota.net効果検証ビーコン

function etoyota_bc(){
	//eTOYOTA.net Beacon START
	measurementBeacon();
}

/******************************************************************************/
//Google Analystics ビーコン

function google_bc(){
	//Google Analystics start
	if (location.protocol.indexOf('https') == -1) {
		_uacct = "UA-641300-1";
	} else {
		_uacct = "UA-641300-2";
	}
	urchinTracker();
	//Google Analystics end
}
/******************************************************************************/
//レコメンド ビーコン

function recommend_bc(){
	if(window.location.protocol.indexOf('https') == -1){
		var colledurl = 'http://' + window.location.host + window.location.pathname + window.location.search;
		var beaconurl = 'http://search.toyota.jp/image/beacon.gif?item=' + escape(colledurl);
		var imgtag = '<img src="' + beaconurl + '">';
		document.write(imgtag);
	}
}
/******************************************************************************/


