
//current_txtsize_image
function chgImg(name, url) {
	document.images["bigger"].src = "../image/txt_b.gif";
	document.images["middle"].src ="../image/txt_m.gif";
	document.images["small"].src = "../image/txt_s.gif";
	document.images[name].src = url; 
}

//txtsize_css
function replace_css(id,url){
	if(!document.getElementById) return false;
	var element = document.getElementById(id);
	if(!element || !element.cloneNode) return false;
	var new_node = element.cloneNode(true);
	new_node.href = url;
	element.parentNode.replaceChild(new_node,element);
	return true;
}

//focus
var colorful = new ColorfulInput;
colorful.skip = ['submit'];
colorful.color['focus'] = '#ffffcc';

window.onload = function() {
   colorful.set();
}

function ColorfulInput() {
   this.skip  = [];
   this.color = { 'blur': '', 'focus': '#ffffff' };

   this.set = function() {
      for (var i = 0; i < document.forms.length; i++) {
         for (var f = 0; f < document.forms[i].length; f++) {
            var elm = document.forms[i][f];
            if(!this._checkSkip(elm)) continue;

            this._setColor(elm, 'focus');
            this._setColor(elm, 'blur');
         }
      }
   }

   this._checkSkip = function(elm) {
      for(var i in this.skip) {
         if(elm.type == this.skip[i]) return false;
      }
      return true;
   }

   this._setColor = function(elm, type) { 
      var color = this.color[type];
      var event = function() { elm.style.backgroundColor = color; };

      if(elm.addEventListener) {
         elm.addEventListener(type, event, false);
      } else if(elm.attachEvent) {
         elm.attachEvent('on'+type, event);
      } else {
         elm['on'+type] = event;
      }
   }
}

