//레이어 관련
var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

var isNS = navigator.appName == 'Netscape';

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function getDivOb(divName) {
	if (isNS4) {
		return document[divName];
	} else if (isDOM) {
		return getRef(divName);
	}
}

﻿//페이지 이동
function movepage(url){
	showCenterAjaxBox();
	location.href = url;
}

﻿//parent 페이지 이동
function movepage2(url){
	showCenterAjaxBox();
	parent.location.href = url;
}

﻿//폼 submit
function movePageForm(form) {
	if (!validate(form)) return false;
	showCenterAjaxBox();
	return true;
}

//인기 약재 검색하기
function favoriteList(query) {
	var url = "/searchmed/searchmed.do?tcode=searchmed"
		+ "&isFirstSearchS=1"
		+ "&query=" + encodeURIComponent(query);
	
	movepage(url);
}

﻿//로그인하기
function moveLoginForm(url) {
	showCenterAjaxBox();
	returnUrlForm.action = url;
	returnUrlForm.submit();
}

//로딩 표시
function showCenterAjaxBox(ment){

	if (ment == null) ment = "페이지 이동 중입니다.   잠시만 기다려주세요";
	
	var yp = document.body.scrollTop;
	var xp = document.body.scrollLeft;
	var ws = document.body.clientWidth;
	var hs = document.body.clientHeight;

	ajaxBox.style.top = eval(hs) / 2;
	ajaxBox.style.left = (eval(ws) - 200) / 2;

	document.getElementById("ajaxBoxMent").style.size = "1px";
	document.getElementById("ajaxBoxMent").innerHTML = ment;
	document.getElementById("ajaxBox").style.display = "block";
}

//플래쉬 표시
function flashobject(file,width,height,bgcolor,name) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">');
	document.write('<param name="movie" value="'+file+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />');	
	document.write('<embed src="'+file+'" quality="high" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'	);
	document.write('</object>');
}

//동영상 표시
function wmobject(file,width,height,autostart,volume) {
	document.write('<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="HTTP://ACTIVEX.MICROSOFT.COM/ACTIVEX/CONTROLS/MPLAYER/EN/NSMP2INF.CAB#VERSION=6,4,7,1112" width="'+width+'" height="'+height+'"> type="application/x-oleobject"'); 
	document.write('<param name="URL" value="'+file+'"/>');
	document.write('<param name="AUTOSTART" value="'+autostart+'"/>');
	document.write('<param name="Volume" value="'+volume+'"/>');
	document.write('<param name="uiMode" value="full"/>');
	document.write('</object>');
}

//메인 왼쪽 기사 읽기 권한 체크
function readBoard(idlevel,idstatus,state){
	if(state=='B'){//전문글
		if(idlevel==''){
			alert("읽기 권한이 없습니다.");
			return false;
		}
		if (idstatus == "2") {//등급과 상관없이 전문기사 열람 가능 상태 여부에 따라 결정
			alert("읽기 권한이 없습니다.");
			return false;
		}
		return true;
	}else{
		return true;
	}
}

//메일발송하기
function mailSending() {
	var url = "/mail/sending/mailSendingWriteForm.do"
		+ "?tcode=mail";

	newWindow(url, "open_win_mail", 600, 510, "no");
}

//이미지 크게보기
function imageView(img) {
	if (img.indexOf("/images/no_image.gif") > -1) return;
	img = img.replace("thumnail/s_","");

	var width;
	var height;
	
	img1= new Image(); 
	img1.src = (img); 
	width = img1.width;
	height = img1.height;

	if((width == 0) && (height == 0)) {
		width = 500;
		height = 500;
	}
	
	var x = document.body.clientWidth/2 - width/2;
	var y = document.body.clientHeight/2 - height/2;

	var idScrap = document.getElementById("divImg");
	document.imgBig.src = img;
	idScrap.style.left = document.body.scrollLeft + x ;
	idScrap.style.top = document.body.scrollTop + y ;
	idScrap.style.width = width;
	idScrap.style.height = height;
	idScrap.style.display = "block";

	var DivIfram = document.getElementById("imgScreenIframe");
    DivIfram.style.width = idScrap.offsetWidth;
    DivIfram.style.height = idScrap.offsetHeight;
    DivIfram.style.top = idScrap.style.top;
    DivIfram.style.left = idScrap.style.left;
    DivIfram.style.zIndex = idScrap.style.zIndex - 1;
    DivIfram.style.display = "block";
	return;
}

function imageHide() {
	var idScrap = document.getElementById("divImg");
	var DivIfram = document.getElementById("imgScreenIframe");
	document.imgBig.src = "";
	idScrap.style.display = "none";
    DivIfram.style.display = "none";
}

function big(imageFile){
	window.open("/mypage/big.jsp?imageFile="+imageFile,"","width=519,height=505,scrollbars=yes");
}
