String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function csFrameResize(width, height) {
	if (width == null)
		width = document.body.scrollWidth;
	if (height == null)
		height = document.body.scrollHeight;
	self.resizeTo(width, height);
}

function csFrameResizeP(width, height) {
	if (width == null)
		width = document.body.scrollWidth;
	if (height == null)
		height = document.body.scrollHeight;
	self.resizeTo(width, height);
	try {
		var parentdiv = parent.document.all.divOuter;
		height = parentdiv.offsetHeight;
		parent.resizeTo(width, height);
	} catch(err) {}
}

function csPopupResize(width, height) {
	var resizeWidth = width;
	var resizeHeight = height;
	if (width == null)
		resizeWidth = document.body.scrollWidth;
	if (height == null)
		resizeHeight = document.body.scrollHeight;
	window.resizeTo(resizeWidth,resizeHeight);

	if (width == null) {
		if (document.documentElement.clientWidth > 0 && document.documentElement.clientWidth < document.body.scrollWidth)
			resizeWidth += document.body.scrollWidth - document.documentElement.clientWidth;
		if (resizeWidth > screen.availWidth) resizeWidth = screen.availWidth;
	}
	if (height == null) {
		if (document.documentElement.clientHeight > 0 && document.documentElement.clientHeight < document.body.scrollHeight)
			resizeHeight += document.body.scrollHeight - document.documentElement.clientHeight;
		if (resizeHeight > screen.availHeight) resizeHeight = screen.availHeight;
	}
	if (width == null || height == null) {
		window.resizeTo(resizeWidth,resizeHeight);
	}
}

function csViewLayer(objId, flag) {
	var obj = document.getElementById(objId);
	if (flag == "on") obj.style.display = "block";
	else obj.style.display = "none";
}

function csInquiry() {
	top.window.location.href = "/content/mail/mailInquiry.do";
}

function csHome(target) {
	var objForm = document.homeForm;
	try {
		if (target == "opener") {
			if (!window.opener) {
				target = "_blank";
			} else {
				if (window.opener.name == "") {
					var dt = new Date();
					window.opener.name = dt.getTime();
				}
				target = window.opener.name;
				
				// 모바일팩 - 새창으로 문의창 띄우기
				if(window.opener.document.all.targetStyle)
						target = window.opener.document.all.targetStyle;
			}
		}
	} catch(err) {
		target = "_blank";
	}
	if (target != null) {
		objForm.target = target;
	}
	objForm.submit();
}

/* 페이징 */
function csPaging(page) {
	var objForm = document.pagingForm;
	objForm.page.value = page;
	objForm.submit();
}


function csCheckNumber(obj) { 
    var flag = true; 
    var objValue = "";
    objValue = obj.value;

    if (objValue.length > 0) { 
        for (i = 0; i < objValue.length; i++) {  
            if (objValue.charAt(i) < '0' || objValue.charAt(i) > '9') { 
                flag = false; 
            } 
        } 
    } 
    return flag; 
} 
