
(function($) {

/*
 |/////////////////////////////////////////////////////////////////////////////////////////////////////
 |  * Name : oxUtil()
 |  * Description : 공통 Util 클래스
 |*************************************************************************************
*/
OxUtil = function() {


	/*
	 |=====================================================================================
	 |  * Name : (function) displayDebug
	 |  * Description : 디버깅창 보이기
	 |-------------------------------------------------------------------------------------
	*/
	this.displayDebug = function(data) {
		
		var html = "";
		html = html + "";
		html = html + '<div id="widget_oxDebug" style="display:none; padding:5px; text-align:center; vertical-align:middle;">';
		html = html + '	<iframe name="frame_oxDebug" id="frame_oxDebug" src="" width="0" height="0" marginwidth="0" height="0" marginheight="0" scrolling="auto" frameborder="1"></iframe>';
		html = html + '</div>';
		
		$("body").find("div[id='widget_oxDebug']").remove();
		$("body").append($(html));
		
		var $widget_oxDebug = $("div[id='widget_oxDebug']");
		var $frame_oxDebug = $("iframe[name='frame_oxDebug']");
		
		$widget_oxDebug.dialog({
			title: 'Debug',
			autoOpen: true,
			width:600, height:400,
			modal: false,
			draggable: true,
			resizable: true,
			show: '',
			hide: '',
			minWidth:50, minHeight: 50,
			position: ['center','center'],
			stack: true,
			closeOnEscape: false,
			open: function(e, ui) {
				$(".ui-dialog").addClass("debug");
				$frame_oxDebug.attr({ width:'98%' , height:'98%', src:data });
			},
			close: function(e, ui) {
				$(".ui-dialog").removeClass("debug");
				$frame_oxDebug.attr({ width:'0' , height:'0', src:'' });
			}
		});
	
	}; //(fn) displayDebug
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) showBlockUI , hideBlockUI
	 |  * Description : BlockUI 보이기/숨기기
	 |-------------------------------------------------------------------------------------
	*/
	this.showBlockUI = function(ele) {
		
		if (jQuery.browser.msie && jQuery.browser.version.substr(0,1) == "6") {
			//alert("Internet Explorer 6");
		}
		
		if ( typeof(ele) == "object" && typeof(ele) != "undefined" ) {
			ele.block({ 
				message : "<img src=\"/_setup/images/img_progress_circlebig.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" />",
				css : { border : "#5573AA solid 1px"},
				overlayCSS:  { backgroundColor:"#EBEBEB", opacity:0.6 }
			});
		} else {
			$.blockUI({ 
				message : "<img src=\"/_setup/images/img_progress_circlebig.gif\" border=\"0\" align=\"absmiddle\" alt=\"\" />",
				css : { border : "#5573AA solid 1px"},
				overlayCSS:  { backgroundColor:"#EBEBEB", opacity:0.6 }
			});
		}
	}; //(fn) showBlockUI
	
	this.hideBlockUI = function(ele) {
		if ( typeof(ele) == "object" && typeof(ele) != "undefined" ) {
			ele.unblock();
		} else {
			$.unblockUI();
		}
	}; //(fn) hideBlockUI
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) openPopup
	 |  * Description : 새창 띄우기
	 |-------------------------------------------------------------------------------------
	*/
	this.openPopup = function(options) {
	
		var settings = $.extend({
			url: "about:blank",
			name: "window_popup", /* 창이름 */
			width: 200,
			height: 200,
			posX: "center", /* left | center | right | 위치값(정수) */
			posY: "middle", /* top | middle | bottom | 위치값(정수) */
			style: {
				resizable: "no", /* 창크기 조절 (yes | no) */
				scrollbars: "no", /* 스크롤바 (yes | no) */
				toolbar: "no", /* yes | no */
				menubar: "no", /* yes | no */
				directories: "no", /* yes | no */
				status: "no", /* yes | no */
				location: "no", /* yes | no */
				copyhistory: "no" /* yes | no */
				}
			}, options);
		settings.width = ( isNaN(parseInt(settings.width,10)) ? 200 : settings.width );
		settings.height = ( isNaN(parseInt(settings.height,10)) ? 200 : settings.height );
		settings.style.resizable = (settings.style.resizable == "yes") ? "yes" : "no";
		settings.style.scrollbars = (settings.style.scrollbars == "yes") ? "yes" : "no";
		settings.style.toolbar = (settings.style.toolbar == "yes") ? "yes" : "no";
		settings.style.menubar = (settings.style.menubar == "yes") ? "yes" : "no";
		settings.style.directories = (settings.style.directories == "yes") ? "yes" : "no";
		settings.style.status = (settings.style.status == "yes") ? "yes" : "no";
		settings.style.location = (settings.style.location == "yes") ? "yes" : "no";
		settings.style.copyhistory = (settings.style.copyhistory == "yes") ? "yes" : "no";
		
		var wnd = $(window);
		var doc = $(document);
		var pLeft = 0;
		//var pLeft = doc.scrollLeft();
		var pTop = 0;
		//var pTop = doc.scrollTop();
		var minTop = pTop;
		if (settings.posX.constructor == Number) {
			pLeft += settings.posX;
		} else {
			switch (settings.posX) {
				case 'left':
					pLeft += 0;
					break;
				case 'right':
					pLeft += wnd.width() - settings.width;
					break;
				default: /*center*/
					//pLeft += ( wnd.width()/2 - settings.width/2 );
					pLeft += (window.screen.width/2) - (settings.width/2);
					break;
			}
		}
		if (settings.posY.constructor == Number) {
			pTop += settings.posY;
		} else {
			switch (settings.posY) {
				case 'top':
					pTop += 0;
					break;
				case 'bottom':
					pTop += wnd.height() - settings.height;
					break;
				default: /*middle*/
					//pTop += ( wnd.height()/2 - settings.height/2);
					pTop += (window.screen.height/2) - (settings.height/2);
					break;
			}
		}
		pTop = Math.max(pTop, minTop);
		pLeft = parseInt(pLeft);
		pTop = parseInt(pTop);
		//alert(wnd.width() + "/" + pLeft + " | " + wnd.height() + "/" + pTop);

		var winstyle = "left=" + pLeft + ",top=" + pTop + ",screenX=" + pLeft + ",screenY=" + pTop + ",width=" + settings.width + ",height=" + settings.height + ",resizable=" + settings.style.resizable + ",scrollbars=" + settings.style.scrollbars + ",toolbar=" + settings.style.toolbar + ", menubar=" + settings.style.menubar + ",directories=" + settings.style.directories + ",status=" + settings.style.status + ",location=" + settings.style.location + ",copyhistory=" + settings.style.copyhistory + "";
		
		var openWin = window.open(settings.url, settings.name, winstyle);
		if(openWin == null) {
			//alert("차단된 팝업창을 허용해 주세요.");
		} else {
			openWin.focus();
		}
	
	}; //(fn) openPopup
	/*
	 |=====================================================================================
	*/
	

	/*
	 |=====================================================================================
	 |  * Name : (function) trim
	 |  * Description : 앞뒤 공백 제거
	 |-------------------------------------------------------------------------------------
	*/
	this.trim = function(inStr) {
		return inStr.replace( /^\s+|\s+$/g, "" );
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) hasSpecialChar
	 |  * Description : 특수 문자 포함 여부
	 |-------------------------------------------------------------------------------------
	*/
	this.hasSpecialChar = function(inStr) {
		if(inStr.search(/[!@~#$%^&*_+=`<>?\\/\{}'\"']/) != -1) {
			return true;
		} else {
			return false;
		}
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) IsEngFN
	 |  * Description : 영문파일명(영문,숫자, 언더바, 하이픈) 점검
	 |  * Output :  true | false (영문파일명(영문,숫자, 언더바, 하이픈)이 아니면 False 반환)
	 |  * Parameters
	 |     inStr : 문자열
	 |-------------------------------------------------------------------------------------
	*/
	this.IsEngFN = function(inStr) {
		if(inStr.search(/[^A-Za-z0-9_\-]/) != -1) {
			return true;
		} else {
			return false;
		}
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) IsEmail
	 |  * Description : E-mail 주소 체크
	 |  * Output :  true | false
	 |  * Parameters
	 |     inStr : 문자열
	 |-------------------------------------------------------------------------------------
	*/
	this.IsEmail = function(thisVal) {
		if (thisVal.replace(/ /g, "") == "") {
			return false;
		} else {
			if (thisVal.search(/^([\w-]{2,})\@{1}([\w-]{1,})\.{1}([\w-]{2,3})/) != -1) {
				return true;
			} else {
				return false;
			}
		}
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) IsNumeric
	 |  * Description : 숫자값인지 체크
	 |  * Output :  true | false
	 |  * Parameters
	 |     inStr : 문자열
	 |-------------------------------------------------------------------------------------
	*/
	this.IsNumeric = function(thisVal) {
		if (thisVal.replace(/ /g, "") == "") {
			return false;
		} else {
			if (thisVal.search(/[^0-9]/) != -1) {
				return true;
			} else {
				return false;
			}
		}
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) StripHTMLtag
	 |  * Description : HTML 태그 제거
	 |  * Output : String
	 |  * Parameters
	 |     inStr : 문자열
	 |-------------------------------------------------------------------------------------
	*/
	this.StripHTMLtag = function(inStr) {
		var objStrip = new RegExp();
		objStrip = /[<][^>]*[>]/g;
		return inStr.replace(objStrip, "");
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) openWindowCenter
	 |  * Description : 윈도우창 가운데 띄우기
	 |  * Output :  Windows Object
	 |  * Parameters
	 |     inUrl : 페이지 URL
	 |     inWinName : 윈도우명
	 |     inWidth : width
	 |     inHeight : height
	 |     inScroll : 스크롤바 사용 여부 (yes | no)
	 |     inResize : 창크기변경 허용 여부 (yes | no)
	 |-------------------------------------------------------------------------------------
	*/
	this.openWindowCenter = function(inUrl, inWinName, inWidth, inHeight, inScroll, inResize) {

		var strAppVersion = navigator.appVersion;
		var xWidth = inWidth;
		var xHeight = inHeight;
		var plusHeight = 0;
		var iMyWidth;
		var iMyHeight;
		var winstyle = "";
		
		if(strAppVersion.indexOf("Windows NT 5.1")>-1) {// Windows XP 인 경우
			plusHeight = 6;
		}
		if(strAppVersion.indexOf("MSIE 7.0")>-1) {// IE 7 인 경우
			plusHeight += 30;
		}
		xHeight += plusHeight;
	
		iMyWidth = (window.screen.width/2) - (xWidth/2+50);
		iMyHeight = (window.screen.height/2) - (xHeight/2+50);
		
		var winstyle = "left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",height=" + xHeight + ",width=" + xWidth + ", toolbar=no, menubar=no,directories=no,resizable=" + inResize + ",status=no,scrollbars=" + inScroll + ",location=no,copyhistory=no";
		
		var openWin = window.open(inUrl, inWinName, winstyle);
		
		if(openWin == null) {
			//alert("차단된 팝업창을 허용해 주세요.");
		} else {
			openWin.focus();
		}
	
	}
	/*
	 |=====================================================================================
	*/
	
	
	/*
	 |=====================================================================================
	 |  * Name : (function) objectWrite_Public
	 |  * Description : document.write
	 |  * Output : String
	 |  * Parameters
	 |     inStr : 문자열
	 |-------------------------------------------------------------------------------------
	*/
	this.objectWrite_Public = function(inStr) {
		document.write(inStr);
	}
	/*
	 |=====================================================================================
	*/


}; //(fn) OxUtil
/*
 |/////////////////////////////////////////////////////////////////////////////////////////////////////
*/

})(jQuery);



/*
 |=====================================================================================
 |  * Name : (prototype) String.prototype.trim
 |  * Description : 앞뒤 공백 제거
 |  * Output :  String
 |  * Parameters
 |-------------------------------------------------------------------------------------
*/
String.prototype.trim = function() {
	return (this || "").replace( /^\s+|\s+$/g, "" );
}
/*
 |=====================================================================================
*/


/*
 |=====================================================================================
 |  * Name : (prototype) String.prototype.getNum
 |  * Description : 문자열에 포함된 숫자만 가져 오기
 |  * Output :  String
 |  * Parameters
 |-------------------------------------------------------------------------------------
*/
String.prototype.getNum = function() {
	return (this.trim().replace(/[^0-9]/g, ""));
}
/*
 |=====================================================================================
*/


/*
 |=====================================================================================
 |  * Name : (prototype) String.prototype.StripHTMLtag
 |  * Description : HTML 태그 제거
 |  * Output : String
 |  * Parameters
 |-------------------------------------------------------------------------------------
*/
String.prototype.StripHTMLtag = function() {
	return (this.trim().replace(/[<][^>]*[>]/g, ""));
}
/*
 |=====================================================================================
*/



function objectWrite_Public(objStr) {
	document.write(objStr);
}

