/* ===================================================
 * User's Guide
 * common
 * Modified : 2018-02-26
=================================================== */


/* global _ua, draft */

var cmn = {
	
	/*
	 * 桁揃え
	 */
	"_initAlign": function (n, digit) {
		var r = new String(n);
		var cnt = digit - r.length;
		if(cnt <= 0) return r;
		while (cnt-- > 0) r = "0" + r;
		return r;
	}
	
	/*
	 * 配列の重複削除
	 */
	,"_uniqueArray": function (array) {
		var storage = {};
		var uniques = [];
		var i,value;
		for( i=0; i<array.length; i++){
			value = array[i];
			if(!(value in storage)){
				storage[value] = true;
				uniques.push(value);
			}
		}
		return uniques;
	}
	
	
	/*
	 * 検索フォームのaction変換
	 */
	,"_searchAction": function(formAction){
		var action = /*(conf._isWebAccess)? formAction.replace(/\.htm.?$/,".php") :*/ formAction ;
		return action;
	}
	
	
	
};




var viewFunc = {
	
	//テーブルヘッダ削除
	"_removeThead": function(){
		$('thead').each(function(i,e){
			$(e).children().prependTo($(e).parent());
			$(e).remove();
		});
		
		$('td:empty').html('<span class="emptyCell"></span>');

	}

	//プリント用追加クラス
	,"_printClass": function(){
		//IE10 アコーディオン中のテーブル内リストへ追加クラス
		if(_ua._isIE10){
			$('.answer table li').addClass('accordionTableList');
		}

	}
	
};


(function(){
	if("draft" in window && draft){
		var html = document.getElementsByTagName('html')[0];
		html.setAttribute("data-draft", true);
	}
}());


