if(!c){
	var c = {};
}
c.cacheArr = new Array();
c.setRollover = function(parent){
	var parent = typeof parent == "undefined" ? "*" : parent;
	$(parent).each(function(){
		var src = this.src;
		if(src && src.indexOf("_off.")>=0){
			c.cacheImg(src.split("_off.").join("_on."));
			$(this)
				.bind("mouseover",function(){
					this.src = this.src.split("_off.").join("_on.");
				})
				.bind("mouseout",function(){
					this.src = this.src.split("_on.").join("_off.");
				});
		}
		
		//背景ロールオーバー設定
		var bg = $(this).css("backgroundImage");
		if(bg != "none" && bg.indexOf("_off.")>=0){
			c.cacheImg(bg.split("_off.").join("_on."));
			//form text
			if(this.nodeName == "INPUT" && this.type == "text"){
				$(this)
					.bind("focus",function(){
						$(this).css("backgroundImage",$(this).css("backgroundImage").replace("_off.","_on."));
					})
					.bind("blur",function(){
						$(this).css("backgroundImage",$(this).css("backgroundImage").replace("_on.","_off."));
					});
			}else{
				$(this)
					.css("cursor","pointer")
					.bind("mouseover",function(){
						$(this).css("backgroundImage",$(this).css("backgroundImage").replace("_off.","_on."));
					})
					.bind("mouseout",function(){
						$(this).css("backgroundImage",$(this).css("backgroundImage").replace("_on.","_off."));
					});
			}
		}
	});
}
c.cacheImg = function(imgPath){
	imgPath = imgPath.split('"').join("").split('url(').join("").split(')').join("");
	if(typeof c.cacheArr[imgPath] == "undefined"){
		var img = document.createElement("img");
		img.src = imgPath;
		img.style.position = "absolute";
		img.style.top = "0";
		img.style.left = "0";
		img.width = 0;
		img.height = 0;
		c.cacheArr[imgPath] = true;
		$(document.body).append(img);
	}
}

$(function(){
	c.setRollover();
});