/*rollover*/
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}
if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}


/* target_blank */
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
			((anchor.getAttribute("rel") == "external nofollow") || (anchor.getAttribute("rel") == "nofollow external") || (anchor.getAttribute("rel") == "external")))
			anchor.target = "_blank";
	}
}
if(window.addEventListener) {
	window.addEventListener("load", externalLinks, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", externalLinks);
}

// popup
/*knowledge*/
function knowledge(src, winName){
	NewWin=window.open(src,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600');
}
/*movie*/
function movie(src, winName){
	NewWin=window.open(src,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600');
}
/*popup*/
function popup(src, winName){
	NewWin=window.open(src,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600');
}
/*sp10/colorvariation/colorpopup*/
function colorpopup(src, winName){
	NewWin=window.open(src,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=800,height=700');
}
/*event/map*/
function mappopup(src, winName){
	NewWin=window.open(src,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=440,height=500');
}

/*
 * yuga.js
 * Copyright (c) 2009 Kyosuke Nakamura (kyosuke.jp)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */

(function($) {
	$(function() {
		$.yuga.css3class();
	});

	$.yuga = {
		//css3のクラスを追加
		css3class: function() {
			//:first-child, :last-childをクラスとして追加
			$('body :first-child').addClass('firstChild');
			$('body :last-child').addClass('lastChild');
			//css3の:emptyをクラスとして追加
			$('body :empty').addClass('empty');
		}
	};
})(jQuery);


function switchImg(source,e1,e2){

	this.Array = document.getElementById("sampleImg").getElementsByTagName("img");
	this.Array[0].src = "images/color_img_"+source+".jpg";
	
	this.Array2 = document.getElementById(source).getElementsByTagName("img");
	this.Array2[0].src = "images/color_bu_"+source+"_on.jpg";
	
	this.Array3 = document.getElementById(e1).getElementsByTagName("img");
	this.Array3[0].src = "images/color_bu_"+e1+".jpg";
	
	this.Array4 = document.getElementById(e2).getElementsByTagName("img");
	this.Array4[0].src = "images/color_bu_"+e2+".jpg";
}

