

///////// 자동완성 검색 /////////////
var js_position = function() {}

js_position.prototype.top = function (oNode) {		// 절대좌표 (right)
	var oCurrentNode=oNode;
	var iTop=0;
	while(oCurrentNode.tagName!="BODY") {
		iTop+=oCurrentNode.offsetTop;
		oCurrentNode=oCurrentNode.offsetParent;
	}

	return iTop;
}

js_position.prototype.left = function (oNode) {		// 절대좌표 (left)
	var oCurrentNode=oNode;
	var iLeft=0;
	while(oCurrentNode.tagName!="BODY"){
		iLeft+=oCurrentNode.offsetLeft;
		oCurrentNode=oCurrentNode.offsetParent;
	}

	return iLeft;
}


var js_search = function () {
	this.search_bg_targeted = -1;	
}

var js_browser = function () {
	this.width = 0;			// 브라우저 크기
	this.height = 0;		// 브라우저 크기

	this.screenwidth = screen.availWidth;		// 화면 크기(가로)
	this.screenheight = screen.availHeight;		// 화면 크기(세로)
}

// Browser Size
js_browser.prototype.browsersize = function () {
	if (window.innerHeight && window.scrollMaxY) {
		this.width = window.innerWidth + window.scrollMaxX;
		this.height = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		this.width = document.body.scrollWidth;
		this.height = document.body.scrollHeight;
	} else {															// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		this.width = document.body.offsetWidth;
		this.height = document.body.offsetHeight;
	}

	

	if(this.width > 977){
		o_left = 478+(this.width - 977)/2 + 10;
	}else{
		o_left = '488';
	}
	
	obj.style.position = 'absolute'; 
	//obj.style.top = '88px';
	//obj.style.left = o_left+'px';

	//setTimeout('js_browser.prototype.browsersize()',100);

}

js_search.prototype.init = function (id,url,width) {

	document.write("<div id=SchSug style='position:absolute;display:none; z-index:999;'>");
	document.write("<iframe id='hFrame' name='hFrame' src='"+url+"' style='width:"+width+"px;display:none' frameborder='0' scrolling='no'></iframe>");
	document.write("</div>");
	document.write("<div id='set_sugicn' style='display:none; width:200px; height:200px; position:absolute; left:50px; top:50px; z-index:1;'></div>");
	document.write("<div id='set_sugicnUP' style='display:none; width:200px; height:200px; position:absolute; left:50px; top:50px; z-index:1;'></div>");

	hFrame.autolink_id = id;
	

	// 좌표 객체
	//var position = new js_position();	
	/*
	obj.style.top = position.top(document.getElementById("q")) + document.getElementById("q").offsetHeight;
	obj.style.left = position.left(document.getElementById("q"));
	
	
	var obj_set_sugicn = document.getElementById("set_sugicn");
	obj_set_sugicn.style.top = position.top(document.getElementById("q")) + 4;
	obj_set_sugicn.style.left = position.left(document.getElementById("q")) + document.getElementById("q").offsetWidth - 17;
	
	var obj_set_sugicnUP = document.getElementById("set_sugicnUP");
	obj_set_sugicnUP.style.top = position.top(document.getElementById("q")) + 4;
	obj_set_sugicnUP.style.left = position.left(document.getElementById("q")) + document.getElementById("q").offsetWidth - 17;
	*/
	if(isIE()) document.getElementById('set_sugicn').style.display = '';
}


js_search.prototype.strip = function (a) {
	if (a) {
		if ((a == "K" && document.searchform.q.value != "") || (a == "M")) {
			document.searchform.q.style.backgroundImage = '';
			this.search_bg_targeted = -1;
		}
	} else {
		document.searchform.q.style.backgroundImage = '';
		this.search_bg_targeted = -1;
	}
}


js_search.prototype.submit = function () {
	var check = true;
	var sugCurPos = hFrame.curCursorPos;
	//var nil_Search = "btn";
	//if(sugCurPos > -1) nil_Search = "sugtop";
	return check;
}

// 객체생성
var js_search = new js_search();

q_size = document.getElementById("q").style.width.split('p');
js_search.init('q','/ajax/ajax_suggest.php',q_size[0]);


geturl = function(url){
	document.searchform.q.value = url;
	document.searchform.submit();
}
