/* ------------------------------------------------------------------------
	Copyright (c) 2009, Matsumoto.JS All rights reserved.
 ------------------------------------------------------------------------ */
var RollOver = Class.create();
RollOver.prototype = {
initialize: function(option) {
	var props = { hclass : "imgover", suffix : "_o" };
	if(option) for(var key in option) props[key] = option[key];

	$$('img.'+props.hclass,'input.'+props.hclass).each(
		function(el){
			var osrc = el.getAttribute('src');
			if (!osrc) return;
			var hsrc = osrc.replace(/(\.gif|\.jpg|\.png)/,props.suffix+'$1');
			//preload & add handler
			(new Image()).src = hsrc;
			el.observe("mouseover",function(){
				el.setAttribute('src', hsrc);
			}).observe("mouseout",function(){
				el.setAttribute('src', osrc);
			});
		}
	);
}
}//prototype
Event.observe(window,'load',function(){new RollOver();});



//
// *** FONT RESIZE ***
//
var cookiemgr;
var currentSize = "normal";
Event.observe(window,'load', function(){
	//cookie
	cookiemgr = new CookieManager();
	var cookieValue = cookiemgr.getCookie("currentFontSize");
	if (cookieValue) currentSize = cookieValue;
	resizeFont(currentSize);
});

var resizeFont = function(size) {
	$('font-l').removeClassName('sel');
	$('font-n').removeClassName('sel');
	$('font-s').removeClassName('sel');
	switch (size) {
		case 'small':
			$('left-content').style.fontSize = "80%";
			$('font-s').addClassName('sel');
			break;
		case 'normal':
			$('left-content').style.fontSize = "100%";
			$('font-n').addClassName('sel');
			break;
		case 'large':
			$('left-content').style.fontSize = "110%";
			$('font-l').addClassName('sel');
			break;
	}
	cookiemgr.setCookie("currentFontSize", size);
}
