var attachID = ['search', 'site_name'];
var keywords = {};


window.onload = function() {
	/* attach Lightbox */
	var elements = document.getElementsByTagName('a');

	for (var loop = 0; loop < elements.length; loop++)
	{
		if (elements[loop].getAttribute("class") == 'wide') {
			elements[loop].setAttribute("rel", "lightbox[group]");
		}
	}



	/* attach Jump */
	var oSelects = $('navigation').getElementsByTagName('select');

	for (var i = 0; i < oSelects.length; i++) {
		oSelects[i].setAttribute('onchange', "jump(this)");
	}



	/* attach Input words */
	for (var j = 0; j < attachID.length; j++) {
		keywords[attachID[j]] = $(attachID[j]).getAttribute('value');
		$(attachID[j]).setAttribute('onfocus', "inputKeyword('" + attachID[j] + "')");
		$(attachID[j]).setAttribute('onblur', "inputKeyword('" + attachID[j] + "')");
	}
}


function jump(oForm)
{
	var number = oForm.selectedIndex;

	if (number && number != '0') {
		window.location.href = oForm.options[number].value;
	}
}


function inputKeyword(id)
{
	var nowValue = $(id).getAttribute('value');

	if (nowValue == keywords[id]) {
		$(id).setAttribute('value', '');
	} else if (nowValue == '') {
		$(id).setAttribute('value', keywords[id]);
	}
}