/**
 * @fileOverview *************************
 * @version 0.0.5
 */
/* ----------------------------------------------------------------------------------- */

var JXHDLIB = {};


JXHDLIB.previewWindowName = "ContentPrintPreviewWindow";



/* ----------------------------------------------------------------------------------- */


JXHDLIB.SmoothScroll = function () {

	this.selector    = $('a[href^=#], area[href^=#]');

	this.goToPageTop = "#headerContainer";

	this.speed       = 600;

	this.easing      = "easeOutExpo";

	this.noScrollCName    = "no-scroll";

	if (this.selector.length && window.name != JXHDLIB.previewWindowName) {
		this.init();
	}
}

JXHDLIB.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;
				});
			}
		}
	});
}

/* ----------------------------------------------------------------------------------- */

JXHDLIB.SearchPlaceholder = function () {

	this.d_fcolor = "#8a8a8a";

	this.fcolor = "#555555";

	this.formData = [
						{
							target : "#bizsearchAspQuery",
							defaultKeyword : ""
						},
						{
							target : "#content-search",
							defaultKeyword : ""
						}
					];
//	if () {
		this.init();
//	}
}

JXHDLIB.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});
				}
			});
		});

	});
}


/* ----------------------------------------------------------------------------------- */
$(function() {

	if (jQuery.browser.msie && jQuery.browser.version == 6) {
		try {
			document.execCommand("BackgroundImageCache", false, true);
		} catch(err) {}
	}

	var roi = new RolloverImages('rollover', 'on');

	for (module in JXHDLIB) {
		var obj = JXHDLIB[module];
		if (obj && typeof obj == "function") {
			new JXHDLIB[module]();
		}
	}

});


/*---------------------------------------------------------------------------*/
if(typeof StyleSwitcher != 'undefined') {
	FONTSIZE_SELECTOR_ENABLED = true;
	FONTSIZE_SELECTOR         = null;
	
	
	if (FONTSIZE_SELECTOR_ENABLED) {
	
		$(function() {
			var config = {
				className      : "fontsize",
				blockId        : "fontsize-selector",
				buttonsSetting : {
						"default" : {
									styleId       : "fontsize-default",
									buttonId      : "fontsize-btn-default"
						},
						"large" : {
									styleId       : "fontsize-large",
									buttonId      : "fontsize-btn-large"
						}
				}
				,rollover : new RolloverImages("rollover-fsbutton", "on", "on")
			};
	
			FONTSIZE_SELECTOR = new FontSizeSelector(config);
		});
	
		// 
		document.write(''
		+ '<style  type="text/css" media="screen,print">'
		+ '#fontsize-selector {display: block !important;}'
		+ '</style>');
	}
	
	

}

