/***************************
* WebSite_Title
****************************/
document.title=":::: MDfaculty ::::";




/******************************************************************************/
/* popup
/******************************************************************************/
/* window_open Scroll No */
function popWin(url, target, intwidth,intheight) {
	window.open(url, target , "width="+intwidth+",height="+intheight+",resizable=0,scrollbars=0");
}

/* window_open Scroll Yes */
function popWinS(url, target, intwidth,intheight) {
	window.open(url, target , "width="+intwidth+",height="+intheight+",resizable=1,scrollbars=1");
}

/* window_open Scroll Yes Resize Yes */
function popWinSR(url, target, intwidth,intheight) {
	window.open(url, target , "width="+intwidth+",height="+intheight+",resizable=1,scrollbars=1");
}

/* window_open Scroll Yes */
function popWinCenter(url, target, intwidth, intheight) {
	var top = 0;
	var left = 0;
	var w_width = intwidth; 	//창 넓이
	var w_height = intheight; 	//창 높이
	if(left == 0){
		var x= screen.width/2 - w_width/2; //화면중앙으로위치
		left = x;
	}
	if(top == 0){
		var y= screen.height/2 - w_height/2;
		top = y;
	}
	window.open(url, target , "top="+top+",left="+left+",width="+intwidth+",height="+intheight+",resizable=0,scrollbars=1");
}

/* window_open Scroll Yes */
function popWinCenterMax(url, target, intwidth, intheight) {
	var top = 0;
	var left = 0;
	var w_width = intwidth; 	//창 넓이
	var w_height = intheight; 	//창 높이
	if(left == 0){
		var x= screen.width/2 - w_width/2; //화면중앙으로위치
		left = x;
	}
	if(top == 0){
		var y= screen.height/2 - w_height/2;
		top = y;
	}
	window.open(url, target , "top="+top+",left="+left+",width="+intwidth+",height="+intheight+",resizable=1,scrollbars=1");
}

/* window_open Scroll No */
function popWinCenterNoScroll(url, target, intwidth, intheight) {
	var top = 0;
	var left = 0;
	var w_width = intwidth; 	//창 넓이
	var w_height = intheight; 	//창 높이
	if(left == 0){
		var x= screen.width/2 - w_width/2; //화면중앙으로위치
		left = x;
	}
	if(top == 0){
		var y= screen.height/2 - w_height/2;
		top = y;
	}
	window.open(url, target , "top="+top+",left="+left+",width="+intwidth+",height="+intheight+",resizable=0,scrollbars=0");
}

/* window_open Scroll No */
function popEventWin(url, target, intwidth, intheight, top, left) {	
	var w_width = intwidth; 	//창 넓이
	var w_height = intheight; 	//창 높이
	window.open(url, target , "top="+top+",left="+left+",width="+intwidth+",height="+intheight+",resizable=0,scrollbars=0");
}

/* window_open Scroll No */
function popNoticeWin(url, target, intwidth, intheight, top, left) {	
	var w_width = intwidth; 	//창 넓이
	var w_height = intheight; 	//창 높이
	if(left == 0){
		var x= screen.width/2 - w_width/2; //화면중앙으로위치
		left = x;
	}
	if(top == 0){
		var y= screen.height/2 - w_height/2;
		top = y;
	}
	
	window.open(url, target , "top="+top+",left="+left+",width="+intwidth+",height="+intheight+",resizable=0,scrollbars=0");
}

/* window_close */
function popClose() {
	window.close();
}

/*
 	10241001	감염질환
	10241002	관동맥질환
	10241003	대사질환
	10241004	대사성골질환
	10241005	류마티스질환
	10241006	신장질환
	10241007	심장질환
	10241008	천식 및 알레르기
	10241009	호흡기질환
	10251001	정형외과
	10261001	비뇨기질환
	10271001	여성내분비질환과 폐경
	10271002	부인과 질환
	10281001	아이들, 청소년 알레르기
	10291001	녹내장
	10301001	피부질환
	10311001	신경과질환
	10391001	부정맥 클리닉
 */
 /* 질병 강좌 축하 인사말 팝업 */
function popLectureMov(lectureId){
	var url = "";
	if(lectureId == "10291001"){
		url = "/front/lecture/popLectureMov01.jsp";
	} else if(lectureId == "10241008"){
		url = "/front/lecture/popLectureMov02.jsp";
	} else if(lectureId == "10271001"){
		url = "/front/lecture/popLectureMov03.jsp";
	} else if(lectureId == "10311001"){
		url = "/front/lecture/popLectureMov04.jsp";
	} else if(lectureId == "10281001"){
		url = "/front/lecture/popLectureMov05.jsp";
	} else if(lectureId == "10241005"){
		url = "/front/lecture/popLectureMov06.jsp";
	} else if(lectureId == "10241004"){
		url = "/front/lecture/popLectureMov07.jsp";
	} else if(lectureId == "10261001"){
		url = "/front/lecture/popLectureMov08.jsp";
	} else if(lectureId == "10251001"){
		url = "/front/lecture/popLectureMov09.jsp";
	} else if(lectureId == "10241003"){
		url = "/front/lecture/popLectureMov10.jsp";
	}
	popWinCenterNoScroll(url, '_lectureMove', 354, 378);
}



/***************************
* Select Form
****************************/

function SelectLayerSH(LayerID,LayerSH) {
	ns4 = (document.layers)?true:false
	ie4 = (document.all)?true:false

	
	if (ns4) {
		thisLayerOff = eval("document.layers." + LayerID + "Off" );
		thisLayerOf = eval("document.layers." + LayerID + "On" );
	}else if (ie4) {
		thisLayerOff = eval("document.all." + LayerID + "Off.style");
		thisLayerOn = eval("document.all." + LayerID + "On.style");      
    }else{
    	//FF의 경우 사용
    	 thisLayerOff = document.getElementById(LayerID + "Off");
      	 thisLayerOn = document.getElementById(LayerID + "On");
    } 
    
    
    // ns, ie는 기존 로직으로 이동하고 FF경우에는 style 테그를 넣는다.
    if(ns4 || ie4){
    	if (LayerSH == "On")	{
			thisLayerOff.display = 'none';
			thisLayerOn.display = 'block';
		}else if (LayerSH == "Off") {
			thisLayerOff.display = 'block';
			thisLayerOn.display = 'none';
		}
    }else{
		if (LayerSH == "On")	{
			thisLayerOff.style.display = 'none';
			thisLayerOn.style.display = 'block';
		}else if (LayerSH == "Off") {
			thisLayerOff.style.display = 'block';
			thisLayerOn.style.display = 'none';
		}
    }
}


/***************************
* Faq List
***************************/
function faqList(faqNum) {
	
	for ( j = 1 ; j < 16 ; j++ ){
		var obj1 = document.getElementById("faqOn" + j);
		var obj2 = document.getElementById("faqOff" + j);
		if(obj1 != null){
			obj1.style.display = "none";
		}
		if(obj2 != null){
			obj2.style.display = "block";
		}
		if ( j == faqNum ){
			document.getElementById("faqOn" + faqNum).style.display = "block";
			document.getElementById("faqOff" + faqNum).style.display = "none";
		}
	}
}

var PopUp = function(elementId){
	var ele = document.getElementById(elementId);
	if(ele != null){
		this.element = ele;
		this.init();
	}
}

/****************************************************************
 * 팝업창을 띄워 준다.
 * 사용법 : var popUp = null;
 * Event.observe( window, 'load', function(){
 *	popUp = new PopUp('layerWrapper');
 * });
 * Event.observe를 이용하여 합니다.
 * popUp.show() 팝업창이 띄워진다.
 * popUp.hide() 팝업창을 닫아준다.
 ****************************************************************/
	PopUp.prototype = {
	init : function(){
		if(document.getElementById('blackBg') == null){
			this.createDivBackground();
		}
	},
	showLayerWrapper : function(){		
		var pos = this.position();
		this.element.style.position = 'absolute';
		this.element.style.zIndex = '100';
		this.element.style.left = '450px';
		this.element.style.top = pos[1] + 'px';
		this.element.style.display = "block";
	},
	getDimension : function(){
		var widthWithScroll = document.documentElement.scrollWidth;
		var heightWithScroll = document.documentElement.scrollHeight + 30;
		document.getElementById('blackBg').style.width = widthWithScroll;
		document.getElementById('blackBg').style.height = heightWithScroll;
	},
	/*
	 * DIV 투명한 검은색 배경을 보여준다.
	 */
	show : function(){
		this.getDimension();
		document.getElementById('blackBg').style.display="block";
		this.showLayerWrapper();
	},
	hide : function(){
		document.getElementById('blackBg').style.display="none";
		this.element.style.display = "none";
	},
	/*
	 * body에 DIV 투명한 검은색 배경을 만든다.
	 */
	createDivBackground : function () {
		var createDiv = document.createElement('div');
		createDiv.setAttribute('id', 'blackBg');
		createDiv.style.display = 'none';
		createDiv.style.position = 'absolute';
		createDiv.style.background = '#000000';
		createDiv.style.filter = 'alpha(opacity=40)';
		createDiv.style.zIndex = '99';
		createDiv.style.width = '100%';
		createDiv.style.top = 0;
		createDiv.style.left = 0;
		createDiv.style.opacity = '0.5';		
		document.body.appendChild(createDiv);		
	},
	position : function(){
		var topWithScroll = document.documentElement.scrollTop;
		var clientWithWidth = document.documentElement.clientWidth;
		var clientWithHeight = document.documentElement.clientHeight;
		var layerWrapperObjWidth = this.element.getWidth();
		var layerWrapperObjHeight = this.element.getHeight();

		var pos = [];
		pos[0] = (clientWithWidth - layerWrapperObjWidth) / 2;
		pos[1] = (clientWithHeight - layerWrapperObjHeight) / 2 + (topWithScroll - 30);
		if(pos[0] < 0){
			pos[0] = 0;
		}
		if(pos[1] < 0){
			pos[1] = 0;
		}
		return pos;
	}
}

var footerLayer = null;
	//공통 팝업 레이어
window.onload = function(){		
	var layerDiv = document.createElement('div');
	layerDiv.setAttribute('id', 'footerLayerArea');
	layerDiv.setAttribute('class', 'layer01');
	document.body.appendChild(layerDiv);	
	footerLayer = new PopUp('footerLayerArea');
}

/********************************************************************************
*  컨텐츠 내용 확대, 축소 스크립트
********************************************************************************/
var mFirst=[8,15];
var mFont;
var mZoom;
var cFont;
var moFirst, mClass;
var initFlag = false;

function chgWindow(d,v) {	
	if(v == "1.0") {    /* 초기화 */
		//mZoom = readCookie("cZoom");
  		d.body.style.zoom = v;
  	}else if(d.body.style.zoom == '' ){
	   	if (v > 1) {
	    		d.body.style.zoom = v ;
	   	}
  	} else {
	   	var fSize = parseFloat(d.body.style.zoom);
	   	if (fSize > 2.0 ) {
	    		if (v < 1) {
	     			d.body.style.zoom *= v;
	    		}
			//d.body.style.zoom = 2.0; // 이이상은 작동 않하게
	   	} else if ( fSize < 1 ) {
	    		if (v > 1) {
	     			d.body.style.zoom = 1 ;
	    		}
			//d.body.style.zoom = 1;  // 이이하는 작동 않하게
	   	} else {
	    		d.body.style.zoom *= v;
	   	}
 	}
}

function zoom_parent(n) {
	var mFont=readCookie("cFont");
 	try {
  		if(mFont == undefined) mFont=12;
  		mFont=parseInt(mFont);
 	} catch(e) {
	  	mFont=12;
	}
 	n=parseInt(n);
 	mFont+=n;

 	var class_name="main01";

 	if (mFont<mFirst[0]) mFont=mFirst[0];
 	if (mFont>mFirst[1]) mFont=mFirst[1];

 	moFirst=parent.document.getElementsByTagName("td");
 	mClass=class_name ? class_name : "Sfont";	  
 	objs=moFirst;
 	for (i=0;i<objs.length;i++) {
  		try {
   		objs[i].style.fontSize=mFont+'pt';
   		if (initFlag) moFirst[i]=objs[i];
  		}catch(e) {}
 	}


 	moFirst=parent.document.getElementsByTagName("a");
 	mClass=class_name ? class_name : "Sfont";

 	objs=moFirst;
 	for (i=0;i<objs.length;i++) {
  		try {
   		objs[i].style.fontSize=mFont+'pt';
   		if (initFlag) moFirst[i]=objs[i];
  		} catch(e) {}
 	}
}

window.onload = function(){	
	chgWindow(top.document, '1.0');
}
/**
* 에디터 이미지 확대 보기
* @param imgSrc 이미지 주소
* @return
*/
function editorImageDetailView(imageURL){
	//popWinS('/front/inc/global/editorImageView.jsp?imageName=' + imgSrc, '_imageView', 100, 100);
	  
	  var useImage = new Image(); 
	  useImage.src = imageURL; 
	  width = useImage.width; 
	  height = useImage.height; 
	  
	  var top = 0;
	  var left = 0;
	  var w_width = width; 		//창 넓이
	  var w_height = height; 	//창 높이
	  if(left == 0){
		  var x= screen.width/2 - w_width/2; //화면중앙으로위치
		  left = x;
	  }
	  if(top == 0){
		  var y= screen.height/2 - w_height/2;
		  top = y;
	  }
	  
	  if(navigator.appVersion.indexOf("MSIE 7") > -1 
	  || navigator.appVersion.indexOf("MSIE 8") > -1){
	  		height = height + 70;	
	  }else{
	  		height = height + 40;	
	  }

	  imageHandle=open("","popupForImage","top="+top+",left="+left+",scrollbars=no,resizable=no,width=100,height=100"); 
	  imageHandle.document.write("<title>MDfaculty.com</title>"); 
	  imageHandle.document.write("<style>"); 
	  imageHandle.document.write("*{margin:0;padding:0;border:0;}"); 
	  imageHandle.document.write("</style>"); 
	  imageHandle.document.write("<img src=\""+imageURL+"\" onload=\"window.resizeTo("+width+","+height+");\" onclick=\"self.close();\" style=\"cursor:hand;\" title=\"클릭하면 닫힙니다.\">"); 
}

/* 글로벌영역 : 바탕화면 바로가기 추가 2009 10 23 */
function btnAdd(url, target) {		 
	location.href = "/admin/downloadKor.mdf?saveName=/MDfaculty.url&originalName=MDfaculty.url";
}