//
// Clip Viewer
// Ver. 2007
// Dependence prototype.js
//
Event.observe(window, 'load', checkTag, false);

// Target ID
var targetId = "preview";

// Check Tag
function checkTag() {
	var cnt = "";
	var nodeList = document.getElementsByTagName("a");
	// alert(nodeList.length);
	for (var i=0; i<nodeList.length; i++) {
		if (nodeList[i].rel == "clipviewer") {
			// alert(nodeList[i].href);
			// alert(nodeList[i].rel);
			nodeList[i].onclick = new Function("getPhotoData('"+nodeList[i].href+"'); return false;");
			nodeList[i].href = "javascript:void(0);";
		}
	}
	// Debug
	// --------------------------------------------------
	// cnt += "このページに a 要素は " + nodeList.length + " つあります。\n";
	// cnt += "そのうち rel 属性があるのは以下。\n";
	// for(var i in nodeList){
	// 	if(nodeList[i].rel) cnt += "- " + nodeList[i].rel + "\n";
	// }
	// alert(cnt);
}

// Display
function getPhotoData(url, alts) {
	targetPhoto = '<img src="' + url + '" alt="Photo" />';
	document.getElementById(targetId).innerHTML = targetPhoto;
	// alert("Photo!"+url);
}
