// IE6のキャッシュを有効にする。try { document.execCommand("BackgroundImageCache", false, true); } catch(e) {}/** * 現在のページのドキュメントルートからの相対パスを取得する。 */function getRelativePath(){	var relPath = '';	// URLがローカル(file://)の場合に機能しない。	// for (var i = 0; i < location.pathname.split('/').length - 3; i++) relPath += '../';	// ローカルルールでショートカットアイコンのパスから取得する。	relPath = $('link[rel="shortcut icon"]').attr('href').replace('favicon.ico','');	return relPath;}/** * lightboxを設定する。 * divにlightboxクラスが設定されている場合。 */function setLightBox(){	//console.time('setLightBox');	if (!$('div').is('.lightbox')) return;	var relPath = getRelativePath();	var css= $('<link rel="stylesheet" type="text/css" media="screen" href="'+relPath+'common/css/jquery.lightbox-0.5.css" />');	var js = $('<script type="text/javascript" src="'+relPath+'common/js/lib/jquery.lightbox-0.5.fix.js"></script>');	$('head').append(css);	$('head').append(js);	var author = $('meta[name="author"]').attr('content') || '';	var ico = $('<span class="lb-ico-img">&nbsp;</span>');	$('div.lightbox').each(function(){		$(this).children('a.lightbox').each(function(){			$(this).append(ico.clone());		});		var title = $(this).attr('title') || '';		$(this).children('a.lightbox').lightBox({			overlayBgColor: '#333',			overlayOpacity: 0.6,			imageLoading: relPath + 'common/img/lightbox-ico-loading.gif',			imageBtnPrev: relPath + 'common/img/lightbox-btn-prev.gif',			imageBtnNext: relPath + 'common/img/lightbox-btn-next.gif',			imageBtnClose: relPath + 'common/img/lightbox-btn-close.gif',			txtOf: '/',			txtImage: ((title == '') ? '' : title + '｜') + author		});	});	//console.timeEnd('setLightBox');}// メイン処理。$(function(){	// lightboxを設定する。	setLightBox();});
