
window.onload	= function ()
{
	_rewriteMainImg();
	_dispDecomail();
	_rewriteShopUrl();
	_rewriteCloseBtn();
}

function _rewriteMainImg()
{
	if (document.getElementById('thumbnail')) {
		var elememnts, obj, i;
		elements	= document.getElementById('thumbnail').getElementsByTagName('img');
		for (i = 0; i < elements.length; i++) {
			obj	= elements[i];
			if (! obj.src.match(/noImg/)) {
				obj.onmouseover		= function () { reloadMainImg(this); }
				obj.onclick			= function () { reloadMainImg(this); }
				obj.style.cursor	= 'pointer';
			}
		}
	}
}

function reloadMainImg(obj)
{
	var target;
	target		= document.getElementById('img1').getElementsByTagName('img');
	target		= target[0];
	target.src	= obj.src.replace('S.', 'L.');
}

function _dispDecomail()
{
	if (document.getElementById('girlsMobile')) {
		var obj	= document.getElementById('girlsMobile');
		if (obj.getElementsByTagName('p').length) {
			obj.style.display	= 'block';
		}
	}
	if (document.getElementById('diary')) {
		var obj	= document.getElementById('diary');
		if (obj.getElementsByTagName('p').length) {
			obj.style.display	= 'block';
		}
	}
}

function _rewriteShopUrl()
{
	var obj	= document.getElementById('moveShopBtn');
	obj.href	= "javascript:openerLocationShop('" + obj.href + "');";
}

function openerLocationShop(url) {
	if (opener) {
		if (opener.parent) {
			opener.parent.location.href	= url;
		} else {
			opener.location.href		= url;
		}
		window.close();
	} else {
		window.location.href		= url;
	}
}

function _rewriteCloseBtn()
{
	var obj	= document.getElementById('closeBtn');
	obj.href	= "javascript:closeBtn('" + obj.href + "');";
}

function closeBtn(url)
{
	if (opener) {
		window.close();
	} else {
		window.location.href		= url;
	}
}

