
function wValOver(idx,sts){
	for(var i=0; i<5; i++){
		if(i == idx){
			document.getElementById("wv_"+ sts +"_"+ i +"").style.backgroundColor = "#ededed";
		}else{
			document.getElementById("wv_"+ sts +"_"+ i +"").style.backgroundColor = "";
		}
	}
}

function viewSearchType(){
	var sTypeLIst = document.getElementById("sType_list");
	if(sTypeLIst.style.display=="block"){
		sTypeLIst.style.display="none";
	}else{
		sTypeLIst.style.display="block";
	}
}

function selectSchType(obj){
	var tobj = obj.parentNode;
	var typeTxt = tobj.getElementsByTagName('label')[0].innerHTML;
	var dash = typeTxt.indexOf('-');
	if(dash != -1){
		typeTxt = typeTxt.substr(dash+1,typeTxt.length);
	}
	document.getElementById('sType').innerHTML = typeTxt;
	viewSearchType();
	document.getElementById('sch_value').focus();
}

function cleanKwd(obj){
	var val = obj.value;
	if(val.indexOf("                              ") > 0){
		obj.value = "";
	}
}

function searchsubmit() {
//	var q = document.search.q;
	var rObj = document.search.sType;
	for(i=0;i<rObj.length;i++){
		if(rObj[i].checked){
			sw = rObj[i].value;
	}
	}
	document.search.sch_where.value=sw; 

	document.search.submit();

}

function callMdown(event){
	if (!event) event= window.event;
	try{
		var element = event.target || window.event.srcElement;
		if(element.id != 'sType'){
			var name = element.parentNode.getElementsByTagName('INPUT')[0].getAttribute('name');
			if(name != 'sType'){
				var sTypeLIst = document.getElementById("sType_list");
				if(sTypeLIst.style.display=="block"){
					sTypeLIst.style.display="none";
				}
			}
		}
	}catch(e){}
}


/*--------------------------------------------------------------------------*/
/*  $id Selector
/*--------------------------------------------------------------------------*/
/* getElementById : $id("id") */
function $id()	{
	var elements = new Array();

	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
		element = document.getElementById(element);

		if (arguments.length == 1)
		return element;

		elements.push(element);
	}

	return elements;
}



/*--------------------------------------------------------------------------*/
/*  getElementsByClassName Selector
/*--------------------------------------------------------------------------*/
/* getElementsByClassName : getElementsByClassName("className","parentId","elementName")*/
document.getElementsByClassName = function(_class, el_id, elTag) {
	if (elTag == false || elTag == null) {
		elTag = '*';
	}
	var parent, els, returnArr = new Array(), i = 0;
	parent = (el_id) ? document.getElementById(el_id) : document;
	els = parent.getElementsByTagName(elTag) || parent.all;
	for (i; i < els.length; i++)
		if (els[i].className == _class) 
			returnArr[returnArr.length] = els[i];
	return returnArr;
}


  

/*--------------------------------------------------------------------------*/
/*  IE Image Label check
/*--------------------------------------------------------------------------*/
function	ieLabel(el)	{
	if(navigator.appVersion.indexOf('MSIE') != -1)	{
		var labelFor = el.getAttribute("for")? el.getAttribute("for") : el.getAttribute("htmlFor")
		$id(labelFor).focus();
		$id(labelFor).click();
	}
}



/*--------------------------------------------------------------------------*/
/*  enter key press check
/*--------------------------------------------------------------------------*/
function	enterCheck(el,event)	{
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		el.onkeypress = el.onclick;
	}
	else {
		return false;
	}
}



/*--------------------------------------------------------------------------*/
/*  select Visible & hidden
/*--------------------------------------------------------------------------*/
function selectVis(vis)	{
	var select = document.getElementById("container").getElementsByTagName("select");
	for (i=0;i<select.length;i++)	{
		select[i].style.visibility = vis;
	}
}



/*--------------------------------------------------------------------------*/
/*  add event
/*--------------------------------------------------------------------------*/
function addEvent( obj, type, fn )
{
	if (obj.addEventListener)	/* Dom Standard */
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)	/* MS Script */
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
} 
 

/*--------------------------------------------------------------------------*/
/*  Total Search Form
/*--------------------------------------------------------------------------*/
function totalSearchReplace(){
	try
	{
		var listTag = $id("totalSearchChoice").getElementsByTagName("li");

		var replaceList = document.createElement("ul");
		replaceList.setAttribute("id","totalSearchReplace");
		for (i=0;i<listTag.length;i++)	{
			listTextNode = listTag[i].getElementsByTagName("label")[0].lastChild.nodeValue;
			listAnchor = listTag[i].getElementsByTagName("a")[0].href;
			replaceListItem = document.createElement("li");
			replaceListItemAnchor = document.createElement("a");
			replaceListItemAnchor.href = listAnchor;
			replaceListItemAnchor.title = listTextNode + "을(를) 검색조건으로 체크";
			replaceListItemText = document.createTextNode(listTextNode);
			replaceListItem.appendChild(replaceListItemAnchor);
			replaceListItemAnchor.appendChild(replaceListItemText);
			replaceList.appendChild(replaceListItem);
		}
		$id("totalSearchField").insertBefore(replaceList,$id("totalSearchChoice"));

		var choiceList = document.createElement("a");
		choiceList.href = "#totalSearchReplace";
		choiceList.title = "검색조건 선택";
		choiceList.setAttribute("id","totalSearchTitle");
		var choiceListText = document.createTextNode(listTag[0].getElementsByTagName("label")[0].lastChild.nodeValue);
		choiceList.appendChild(choiceListText);
		$id("totalSearchField").insertBefore(choiceList,$id("totalSearchReplace"));

		var replaceListTag = $id("totalSearchReplace").getElementsByTagName("li");
		var rObj = document.search.sType;

		for (j=0;j<replaceListTag.length;j++){
			replaceListTag[j].getElementsByTagName("a")[0].onclick = function()	{
				for(k=0;k<listTag.length;k++)	{
					if(this.lastChild.nodeValue == listTag[k].getElementsByTagName("label")[0].lastChild.nodeValue)	{
						listTag[k].getElementsByTagName("input")[0].click();
						for(i=0;i<rObj.length;i++){
							if(rObj[i].checked){
							sw = rObj[i].value;
							}
						}
						$id("sch_where").value = sw;
						$id("sch_value").focus();
					}
				}
				$id("totalSearchReplace").style.display = "none";
				$id("totalSearchTitle").lastChild.nodeValue = this.lastChild.nodeValue;
				return false;
			}
		}
		
		$id("sch_value").onfocus = function()	{
			$id("totalSearchReplace").style.display = "none";
		}
		$id("sch_value").onblur = function()	{
		}

		$id("totalSearchReplace").style.display = "none";
		$id("totalSearchChoice").style.position = "absolute";
		$id("totalSearchChoice").style.visibility = "hidden";
		$id("totalSearchChoice").style.top = "-9999px";
		$id("totalSearchChoice").style.left = "-9999px";

		var viewState = 0;
		$id("totalSearchTitle").onmousedown = function	()	{
			($id("totalSearchReplace").style.display == "block") ? $id("totalSearchReplace").style.display = "none" : $id("totalSearchReplace").style.display = "block";
			viewState = 1;
			return false;
		}
		$id("totalSearchTitle").onfocus = function	()	{
			if (viewState != 1)
			{
				($id("totalSearchReplace").style.display == "block") ? $id("totalSearchReplace").style.display = "none" : $id("totalSearchReplace").style.display = "block";
				return false;
			}
			else {viewState = 0;}
		}
		$id("totalSearchTitle").onclick = function	()	{
			return false;
		}
	}
	catch (e)
	{
		return false;
	}
}
function	totalSearchOnload()	{
	$id("sType1").checked = true;
	$id("sch_value").value = '';
}
function search_form_view(){
document.write("<form id='search' name='search' method='get' onsubmit='return searchsubmit();' enctype='multipart/form-data'  action='../10_search/search.htm'>");
document.write("<input name='sch_where' type='hidden' id='sch_where' value=''  /> ");
document.write("<fieldset id='totalSearchField'>");
document.write("<legend>통합검색</legend>");
document.write("<ul id='totalSearchChoice'>");
document.write("<li class='css_sType' ><input type='radio' class='css_sType' name='sType' id='sType1' value='tot' /><label  class='css_sType' for='sType1' >통합검색</label>");
document.write("<a href='/10_search/search.htm?sch_where=&amp;sType=tot&amp;sch_value='></a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType2' value='clinic' /><label class='css_sType' for='sType2' >진료과/센터</label>");
document.write("<a href='/08_minihp/contents_main.htm'>진료과/센터 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType3' value='professor'/><label class='css_sType' for='sType3'>진료교수</label>");
document.write("<a href='/01_clinicinfo/guide_07.htm'>진료교수 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType4' value='info' /><label class='css_sType' for='sType4'>질병백과</label>");
document.write("<a href='/02_medinfo/sick.htm'>질병백과 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType5' value='qna' /><label class='css_sType' for='sType5'>의료상담실</label>");
document.write("<a href='/04_client/client_counsel.htm?board_db=qna'>의료상담실 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType6' value='news1' /><label class='css_sType' for='sType6'>공지사항</label>");
document.write("<a href='/04_client/news_01.htm'>공지사항 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType7' value='news6' /><label class='css_sType' for='sType7'>의료원뉴스</label>");
document.write("<a href='/04_client/news_06.htm'>의료원뉴스 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType8' value='news2' /><label class='css_sType' for='sType8'>언론보도</label>");
document.write("<a href='/04_client/news_02.htm'>언론보도 바로가기</a>");
document.write("</li>");
document.write("<li><input type='radio' class='css_sType' name='sType' id='sType9' value='news3' /><label class='css_sType' for='sType9'>포토뉴스</label>");
document.write("<a href='/04_client/news_03.htm'>포토뉴스 바로가기</a>");
document.write("</li>");
document.write("</ul> "); 
document.write("<span id='sch_in1'>");
document.write("<input type='text' name='sch_value' id='sch_value'   class='type-text'  size='55'  onkeypress='' onclick='cleanKwd(this);'   value='' title='검색어 입력' />");
document.write("</span>");
document.write("<span style='float:right;' id='sch_in2'><input type='image' src='http://yumc.ac.kr/images/common/btn_search.gif'  alt='검색'    class='type-btn' /></span>");
document.write("</fieldset>");
document.write("</form>");
}
