//=============================================================================
// Style Controll Lib								Powerd by Axdd system div.
// Version 1.0.0
// Created by Akira.Kusama
//=============================================================================

//------------------------------------
// 更新履歴
//------------------------------------
/*

2006/11/14 v1.0.0 リリース

*/

//===================================
// ::used module::
// use prototype.js	->	"1.4.0以上"
// use Common.js
// ===================================

/* ************************************************************************** */
// Object.style

// コンストラクタ
function StyleCtrl() {
}

/* -------------------------------------------------------------------------- */
// Method
/* -------------------------------------------------------------------------- */
// style.visibilityの状態を取得
StyleCtrl.prototype.getVisibility = function(idName) {
	try {
		var utl = new utility();		// Common.js
		var style = "";
		
		if (utl.boolObjChk(idName)) {
			style = document.getElementById(idName).style.visibility;
			if (style == null || style == "") {
				style = "none";
			}
			return style;
		} else {
			return null;
		}
	} catch(e) {
		alert("StyleCtrl\nfunc:getVisibility\n" + e);
	}
}

// style.visibilityを変更
StyleCtrl.prototype.visibility = function(idName, style) {
	try {
		var utl = new utility();		// Common.js
		
		if (utl.boolObjChk(idName) && 
				(utl.ufc(style) == "visible" || utl.ufc(style) == "hidden")) {
			document.getElementById(idName).style.visibility = utl.ufc(style);
		}
	} catch(e) {
		alert("StyleCtrl\nfunc:visibility\n" + e);
	}
}


// style.displayの状態を取得
StyleCtrl.prototype.getDisplay = function(idName) {
	try {
		var utl = new utility();		// Common.js
		var style = "";
		
		if (utl.boolObjChk(idName)) {
			style = document.getElementById(idName).style.display;
			if (style == null || style == "") {
				style = "none";
			}
			return style;
		} else {
			return null;
		}
	} catch(e) {
		alert("StyleCtrl\nfunc:getDisplay\n" + e);
	}
}

// style.displayを変更
StyleCtrl.prototype.display = function(idName, style) {
	try {
		var utl = new utility();		// Common.js
		
		if (utl.boolObjChk(idName) && 
				(utl.ufc(style) == "block" || utl.ufc(style) == "inline" || 
				utl.ufc(style) == "list-item" || utl.ufc(style) == "none")) {
			document.getElementById(idName).style.display = utl.ufc(style);
		}
	} catch(e) {
		alert("StyleCtrl\nfunc:display\n" + e);
	}
}


/* ***** Mainroutine ***** */
// style.visibilityを変更	setTimeout対策
function styVisibility(divIdName, style) {
	try {
		var sty = new StyleCtrl();		// StyleCtrl.js
		sty.visibility(divIdName, style);
	} catch(e) {
		alert("StyleCtrl\nfunc:styVisibility\n" + e);
	}
}


// style.displayを変更		setTimeout対策
function styDisplay(divIdName, style) {
	try {
		var sty = new StyleCtrl();		// StyleCtrl.js
		sty.display(divIdName, style);
	} catch(e) {
		alert("StyleCtrl\nfunc:styDisplay\n" + e);
	}
}


