﻿/* min-height (ie6)*/
function min_height(obj,h) {
	if(obj.readyState != "complete") return "auto";
	if(obj.offsetHeight<h) {
		obj.style.height="0";
		obj.sytle.height=h+"px";
	}
}

/**
	스크롤 따라다니는 레이어
*/
  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.style.position = "relative";
	obj.top = obj.initTop;
	obj.style.right = -20+'px';

	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 390;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > -1) {
			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";
	}, 10)

}

function winOpen(url,target,arg){
    if( navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("MSIE 7") > -1){
    }
	window.open(url,target,arg);
}

function winOpen2(url,target,wid,hei,arg){
    if( navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("MSIE 7") > -1){
		hei = hei + 3;
    }
	arg = arg + ",width=" + wid + ",height=" + hei;
	window.open(url,target,arg);
}

function download(filePath,fileName){
	location.href="/common/download_bbs.jsp?filePath=" + filePath + "&fileName=" + fileName;
}
