/*

	default func. definition
	(ut-life ver.1.00)

*/

	/* pop upper */
	function popup(o) {
		window.open(o.getAttribute("href"));
 	}
	function popup_mini(o, w, h) {
		window.open(o.getAttribute("href"), "new", "width="+w+",height="+h+",status=no,resizable=no,scrollbars=yes");
	}

	/* image changer */
	// set
	var Imagenames = new Array();
	Imagenames[0] = "icon_guide";
	Imagenames[1] = "icon_people";
	Imagenames[2] = "icon_special";
	Imagenames[3] = "icon_study";
	// preload
	for(i = 0; i < Imagenames.length; i++){
		new Image().src = "/style/hov/"+Imagenames[i]+".png";
		// new Image().src = "http://www.ut-life.net/style/hov/"+Imagenames[i]+".png";
	}
	// change
	function getname(s) {
		return s.slice(s.lastIndexOf("/"));
	}
	function hov(n) {
		cn = n.childNodes[1];
		cn.src = "/style/hov/"+getname(cn.src);
		// cn.src = "http://www.ut-life.net/style/hov/"+getname(cn.src);
		return;
	}
	function unhov(n) {
		cn = n.childNodes[1];
		cn.src = "/style/"+getname(cn.src);
		// cn.src = "http://www.ut-life.net/style/"+getname(cn.src);
		return;
	}
	
	// Event show & hide switch
	function recent_event_switch(show, always_show_num) {
		var switch_str;
		if(show) switch_str = "<a href=\"javascript:recent_event_switch(false, "+ always_show_num +");\">less</a>";
		else switch_str = "<a href=\"javascript:recent_event_switch(true, "+ always_show_num +");\">more</a>";
		document.getElementById("recent_event_switch").innerHTML = switch_str;
		
		for(i = always_show_num ; document.getElementById("recent_event_" + i) ; i++) {
			document.getElementById("recent_event_" + i).style.display = (show) ? "block" : "none";
		}
	}
	
	// General show & hide switch (NOTE by Toshio Ito 2007-04-27)
	// Switch link is a text in an anchor tag whose href attribute calls the function 'list_switch' to show/hide list items.
	// And the switch link must be contained in an element(such as div) whose id attribute is (list_id + '_switch')
	// Each item of list must be contained in a block element(such as div, table) whose id attribute is (list_id + '_' + number)
	// Default show/hide status of list items must be written in PHP script directly.
	function list_switch(list_id, show, always_show_num) {
		var switch_str;
		if(show) switch_str = "<a href=\"javascript:list_switch(" + list_id + ", false, "+ always_show_num +");\">less</a>";
		else switch_str = "<a href=\"javascript:list_switch(" + list_id + ", true, "+ always_show_num +");\">more</a>";
		document.getElementById(list_id + "_switch").innerHTML = switch_str;
		
		for(i = always_show_num ; document.getElementById(list_id + "_" + i) ; i++) {
			document.getElementById(list_id + "_" + i).style.display = (show) ? "block" : "none";
		}
	}
