function linkwindow() {
	lightbox_count = 0;
	a_elements = document.getElementsByTagName('a');
	a_count = a_elements.length;
	for(i = 0; i < a_count; ++i) {
		a_element = a_elements.item(i);
		a_href = a_element.getAttribute('href');
		param_index = a_href.indexOf('?', 0);
		if(param_index >= 0) {
			a_href2 = a_href.substr(0, param_index);
		} else {
			a_href2 = a_href;
		}
		if(
			(
				a_href2.match(/^https?:\/\//) &&
				!a_href2.match(/^https?:\/\/((fetus\.k-hsu\.net)|(fetus\.bouhime\.com)|(fetus\.k-hsu\.bouhime\.com))/)
			) ||
			a_href2.match(/\.(jpg|gif|png|txt)$/)
		) {
			onclick_value = a_element.getAttribute('onclick');
			if(!onclick_value || onclick_value == '') {
				if(document.all && navigator.userAgent.indexOf('; MSIE ', 0) >= 0) {
					onclick_value = new Function('window.open("' + a_href + '"); return false;');
				} else {
					onclick_value = 'window.open("' + a_href + '"); return false;';
				}
				a_element.setAttribute('onclick', onclick_value);
				if(a_href2.match(/\.(jpg|gif|png)$/) && !a_element.getAttribute('rel')) {
					a_element.setAttribute('rel', 'lightbox');
					++lightbox_count;
				}
			}
		}
	}
	if(lightbox_count) {
		setTimeout('myLightbox.updateImageList()', 10);
	}
}
Event.observe(window, 'load', linkwindow, false);
