/* vim: set tabstop=2 shiftwidth=2 foldmethod=marker: */
/**
 * 
 * Lazurite公開画面 基本スクリプト
 *
 * @author     Tsukasa Koizumi <tsukasa@virtuawave.jp>
 * @copyright  2005-2006 VirtuaWave Inc.
 * @version    CVS: $Id: common.js,v 1.12.4.6 2008/08/27 08:51:56 yuk Exp $
 *
 */

vw.url      = '';
vw.script   = '';
vw.path     = '';
/* 初期化
------------------------------------------------------------------------*/
vw.init = function(url, script, secure, path)
{
	// サーバー側スクリプトパスの設定
	this.url    = url;
	this.script = url + script;
	this.path   = path;
	loadingImage = this.path + 'img/loading.gif';
	closeButton  = this.path + 'img/close.gif';
	initLightbox();
	
	// Cookieチェック
	if (!vw.cookie.checkEnabled(secure)) {
		location.href = vw.script + '/error/cookie/';
	}
	return null;
}

/* イメージの自動切り替え
------------------------------------------------------------------------*/
vw.swapImage = {
	/** 初期化 */
	init: function()
	{
		document.getElementsByClassName('swapImage', document.body, 'a').each(function(e){
			Event.observe(e, 'mouseover', vw.swapImage.swap.bind(e), false);
		});
	},
	swap: function()
	{
		var target  = $('swapImageTarget');
		target.href = this.href;
		target.replaceChild(this.firstChild.cloneNode(true), target.firstChild);
	}
}
/* 商品ページ、フリースペース内の画像URL修正
------------------------------------------------------------------------*/
vw.modItemImage = function()
{
	document.getElementsByClassName('freespace').each (function(e){
		$A(e.getElementsByTagName('img')).each(function(i){
			i.src = vw.path + i.src.replace(window.location, '').replace(vw.path, '');
		});
	});
}