var initBody;
function beforePrint() { initBody = document.body.innerHTML; document.body.innerHTML = printArea.innerHTML; } 
function afterPrint() { document.body.innerHTML = initBody; } 
function print_Area() {
	try {
		window.onbeforeprint = beforePrint;
		window.onafterprint = afterPrint;
		window.print();
	} catch(e) {}
}

//�۷ι� �׺���̼�(2Depth �޴��׷�)�� ���� ���콺 �Ǵ� Ű���� ����(����/���)����
function openSub(id) {
	for (num = 1; num <= 5; num++)
		document.getElementById('sub' + num).style.display = 'none'; // sub1~sub4
																		// ����
																		// ���
																		// ����
	document.getElementById(id).style.display = 'block'; // �ش� ID�� ����
}

// ���� �������� �޴� ���� ǥ��(���ǻ� ��� ����������� �����Ǿ� ������ body onLoad
// �� �����
function load(id) {
	document.getElementById(id).style.display = 'block';
}

// �̹��� �����ƿ�
function imgover(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}

function imgout(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
}

function visualover(imgs) {
	imgs.src = imgs.src.replace("off.jpg", "on.jpg");
}

function visualout(imgs) {
	imgs.src = imgs.src.replace("on.jpg", "off.jpg");
}

// png ���� ���� ó��
function setPng24(obj) {
	obj.width = obj.height = 1;
	obj.className = obj.className.replace(/\bpng24\b/i, '');
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
			+ obj.src + "',sizingMethod='image');"
	obj.src = '';
	return '';
}

// �� �޴�
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	// obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof (window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof (document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if (document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

/* faq */
function initToggleList(ulEl, que, ans) {
	currentListNum = false;
	queEl = ulEl.getElementsByTagName(que);
	ansEl = ulEl.getElementsByTagName(ans);

	for (i = 0; i < queEl.length; i++) {
		ansEl.item(i).listNum = i;
		queEl.item(i).listNum = i;
		ansEl.item(i).className = "on";
		queEl.item(i).onclick = toggleList;
	}
}

function toggleList() {
	if (currentListNum && currentListNum != this.listNum + 1) {
		queEl.item(currentListNum - 1).className = null;
		ansEl.item(currentListNum - 1).className = "view";
	}
	if (ansEl.item(this.listNum).className == "view") {
		queEl.item(this.listNum).className = null;
		ansEl.item(this.listNum).className = "close";
	} else {
		queEl.item(this.listNum).className = "on";
		ansEl.item(this.listNum).className = "view";
	}
	currentListNum = this.listNum + 1;
}

function First(ulEl, que, ans) {
	currentListNum = false;
	queEl = ulEl.getElementsByTagName(que);
	ansEl = ulEl.getElementsByTagName(ans);

	queEl.item(0).className = "on";
	ansEl.item(0).className = "view";
	currentListNum = 1;
}

var ran = Math.floor(Math.random()*100000000);

function returnInstance(_id){
	 if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[_id];
    } else {
        return document[_id];
    }
}

function flashWrite(swf, vars, w, h) {
	flashTagValue = "" +
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+w+"' height='"+h+"' id='gnb' align='middle'>" +
	"<param name='allowScriptAccess' value='always' />" +
	"<param name='allowFullScreen' value='true' />" +
	"<param name='movie' value='"+swf+"' />" +
	"<param name='quality' value='high' />" +
	"<param name='FlashVars' value='ran="+ran+"&"+vars+"' />" +
	"<param name='wmode' value='transparent' />" +
	"<embed src='"+swf+"' FlashVars='ran="+ran+"&"+vars+"' quality='high' width='"+w+"' height='"+h+"' name='gnb' align='middle' allowScriptAccess='always' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
	"</object>";
	document.write(flashTagValue);
}

function isBlank(id) {
	if(jQuery("#"+id).val() == "") return true;
}

function checkBlankForm(id, message) {
	if(isBlank(id)) {
		jQuery("#"+id).focus();
		alert(message);
		return true;
	}
	return false;
}

function removes() {
	if(jQuery("input[name*=removes]:checked").size() == 0) {
		alert("삭제할 항목을 선택해주세요.");
		return;
	}
	
	if(!confirm("정말 삭제하시겠습니까?")) return;

	jQuery("#act").val("form");
	jQuery("#form").submit();
}

function remove() {
	if(!confirm("정말 삭제하시겠습니까?")) return;

	jQuery("#removes").val(jQuery("#bid").val());
	jQuery("#act").val("form");
	jQuery("#form").submit();
}

jQuery(document).ready(function() {
	if(jQuery("#removeAll") != null) {
		jQuery("#removeAll").click(function() {
			var value = jQuery(this).attr("checked");
			if(value == true) {
				jQuery("input[name*=removes]").each(function() {
					jQuery(this).attr("checked", "checked");
				});
			} else {
				jQuery("input[name*=removes]").each(function() {
					jQuery(this).attr("checked", "");
				});
			}
		});
	}
});

function fDartOpen() {
  window.open("http://dart.fss.or.kr/html/search/SearchCompanyIR_M.html?textCrpNM=%EC%94%A8%EB%AA%A8%ED%85%8D",
  "","status=yes, toolbar=no, resizable=no, scrollbars=yes, width=750, height=720");
}

function fStockOpen() {
  window.open("http://asp1.krx.co.kr/IR/basic/081090/hp_idx_info.jsp",
  "","status=yes, toolbar=no, resizable=no, scrollbars=no, width=335, height=140");
} 

function winLocOpen(location, name, w, h, modeStr) {
    var LeftPosition = 0;
    var TopPosition  = 0;
    if(modeStr=='mouse') {
	    LeftPosition = event.screenX-145;
	    TopPosition  = event.screenY;
    } else {
	    LeftPosition = (screen.width)?(screen.width-w)/2:100;
		TopPosition  = (screen.height)?(screen.height-h)/2:100;
    }
    window.open(location, name, 'resizable=0,scrollbars=auto,width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',status=0');
}
