/**
 * @fileOverview *************************
 * @version 0.0.5
 */
/* ----------------------------------------------------------------------------------- */


/**
 * @namespace 
 */
var MKF = {};


MKF.previewWindowName = "ContentPrintPreviewWindow";


/* ----------------------------------------------------------------------------------- */

/**
 * スムーススクロール処理。
 * @class スムーススクロール
 * @constructor
 */
MKF.SmoothScroll = function () {

	this.selector    = $('a[href^=#], area[href^=#]');
	this.goToPageTop = "#ancPageTop";// 配列化が必要？
	this.speed       = 1000;
	this.easing      = "easeOutExpo";
	this.noScrollCName    = "no-scroll";

	if (this.selector.length && window.name != MKF.previewWindowName) {
		this.init();
	}
}

/**
 */
MKF.SmoothScroll.prototype.init = function () {
	var _this = this;
	this.selector.each(function () {
		if (!$(this).hasClass(_this.noScrollCName)) {
			var fi = $(this).attr("href");
			if (fi == "#") return false;
			var el = ($(fi).length) ? $(fi) : $("a[name="+fi.replace(/#/,"")+"]");
			if (el.length) {
				$(this).click(function() {
					//e.preventDefault();
					var target = el[0];
					$.scrollTo(target, {
						speed: _this.speed,
						easing: _this.easing/*,
						onAfter: function() {
							return (fi == _this.goToPageTop) ? false : true;
						}*/
					});
					return (fi == _this.goToPageTop) ? false : true;
				});
			}
		}
	});
}

/* ----------------------------------------------------------------------------------- */
$(function() {

	/* for IE6 background image flicker */
	if (jQuery.browser.msie && jQuery.browser.version == 6) {
		try {
			document.execCommand("BackgroundImageCache", false, true);
		} catch(err) {}
	}

	/* Setup RolloverImages */
	var roi = new RolloverImages('rollover', 'on');

	/* Setup MKF  */
	for (module in MKF) {
		var obj = MKF[module];
		if (obj && typeof obj == "function") {
			new MKF[module]();
		}
	}

});


/* ----------------------------------------------------------------------------------- */

MKF.SearchPlaceholder = function () {

	this.d_fcolor = "#999999";

	this.fcolor = "#333333";

	this.formData = [
						{
							target : "#inputSearchText",
							defaultKeyword : "サイト内検索"
						}
					];
//	if () {
		this.init();
//	}
}

MKF.SearchPlaceholder.prototype.init = function () {
	var _this = this;
	$.each(_this.formData, function (i) {
		var d_key = this.defaultKeyword;
		$(this.target).each(function () {
			var el = $(this);
			el.css({"color" : _this.d_fcolor})
				.attr({"value"  : d_key});

			el.focus(function () {
				if (el.attr("value") == d_key) {
					el.attr({"value" : ""});
				}
				el.css({"color" : _this.fcolor});
			});

			el.blur(function () {
				if (el.attr("value") == "") {
					el.css({"color" : _this.d_fcolor})
						.attr({"value"  : d_key});
				}
			});
		});

	});





/* ----------------------------------------------------------------------------------- */
};

