// *** プロパティの追加
function addProperty(objectName, property, childArrayNum){
	if(this[objectName] == undefined) this[objectName] = new Array();
	if(childArrayNum == undefined){
		this[objectName] = this[objectName].concat(new Array(property));
	} else{
		if(this[objectName][childArrayNum] == undefined) this[objectName][childArrayNum] = new Array();
		this[objectName][childArrayNum] = this[objectName][childArrayNum].concat(new Array(property));
	}
}

//このスクリプトを使用するドメイン
var domain = 'http://point.ecnavi.jp/';

// サブディレクトリの登録

addProperty('serviceDirectory', {
	// ▼ サブディレクトリ名
	name:		"antique"
	// ▼ タイトル画像URL
//,	titleImage:		"http://point.ecnavi.jp.eimg.jp/header/img/title_antique.gif"
,	titleImage:	"http://point.ecnavi.jp.eimg.jp/header/img/title_antique.gif"
	// ▼画像の横幅(width)
,	width: 		"94px"
	// ▼画像の縦幅(height)
,	height: 	'19px'
	// ▼ リンク先URL
,	href:		"http://point.ecnavi.jp/antique/"
	// ▼ リンク文言
,	text:		"買取サービス"
});

addProperty('serviceDirectory', {
	// ▼ サブディレクトリ名
	name:		"delivery"
	// ▼ タイトル画像URL
//,	titleImage:		"http://point.ecnavi.jp.eimg.jp/header/img/title_delivery.gif"
,	titleImage:	"http://point.ecnavi.jp.eimg.jp/header/img/title_delivery.gif"
	// ▼画像の横幅(width)
,	width: 		"76px"
	// ▼画像の縦幅(height)
,	height: 	'19px'
	// ▼ リンク先URL
,	href:		"http://point.ecnavi.jp/delivery/"
	// ▼ リンク文言
,	text:		"デリバリー"
});

function showTitle(tImg) {
	var elem = document.getElementById('service_img');
	elem.href = tImg.href;
	elem.style.display = 'block';
	elem.style.width = tImg.width;
	elem.style.height = tImg.height;
	elem.style.backgroundImage = 'url(' + tImg.titleImage + ')';
	elem.style.backgroundRepeat = 'no-repeat';
	elem.style.textIndent = '-9999px';
	elem.innerHTML = tImg.text;
}

function service_title_show() {
	var url = document.URL;
	
	//該当するドメインかチェックする
	if(-1 != url.indexOf(domain)) {
		//現在のサブディレクトリ名を抜き取り
		subDirectory = url.substring(domain.length, url.indexOf('/', domain.length));
		
		var d_list_len = serviceDirectory.length;
		for(var i=0; i < d_list_len; i++) {
			if(serviceDirectory[i]['name'] == subDirectory) {
				showTitle(serviceDirectory[i]);
				break;
			}
		}
	}
}

service_title_show();