/* On document ready */
$(document).ready(function () {
	$('#lnb ul:not(#sidebar-subject #lnb ul)').lnb();
});

/*flash*/
function swfprint(furl,fwidth,fheight,transoption)	{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ fwidth +'" height="' + fheight +'" id="movie1" align="middle" allowScriptAccess="always">');
		document.write('<param name="allowScriptAccess" value="always"/>');
	document.write('<param name="movie" value="'+ furl +'"/>');
	if (transoption == "t")	{
		document.write('<param name="wmode" value="transparent"/>');
	} else if	(transoption == "o")	{
		document.write('<param name="wmode" value="opaque"/>');
	}
	document.write('<!-- Hixie method -->');
	document.write('<!--[if !IE]> <-->');
	document.write('<object type="application/x-shockwave-flash" allowScriptAccess="always" data="'+ furl +'" width="'+ fwidth +'" height="' + fheight +'" id="movie1"');
	if (transoption == "t")	{
		document.write(' wmode="transparent"');
	} else if	(transoption == "o")	{
		document.write(' wmode="opaque"');
	}
	document.write('<embed src="'+ furl +'" width="'+ fwidth +'" height="' + fheight +'" wmode="transparent"  allowScriptAccess="always" menu="false"/>');
	document.write('></object>');
	document.write('<!--> <![endif]-->');
	document.write('</object>');
}

function leftTreeMn(obj) {
 var target = document.getElementById(obj);
 target.style.display = (target.style.display=='none' ? 'block':'none');
}

function quickMenu(chk) {
	if (!(document.getElementById('quickBtn') && document.getElementById('quick-con'))) {
		return false;
	}
	var quickBtn = document.getElementById('quickBtn').getElementsByTagName('img'),
		quickCon = document.getElementById('quick-con').getElementsByTagName('div'),
		len = quickCon.length,
		i = 0;
	if (chk < len) {
		for (; i < len; i++) {
			quickCon[i].style.display = 'none';
		}
		quickCon[chk].style.display = 'block';
	}
}

function closeQuickCon(el) {
	el.parentNode.style.display = 'none';
}

// quick
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('dvquick').style.top, 10);
	end = document.documentElement.scrollTop + 100;
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 20 );
		if ( end < start )	scale = -scale;
		document.getElementById('dvquick').style.top = parseInt (document.getElementById('dvquick').style.top, 10)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('dvquick').style.top = document.documentElement.scrollTop + 100 + "px"; //숫자가 같으면 슬라이드 없다.
	getPosition();00
	return true;
}

// lnb
/*function MenuLoad(a,b){
	// a : 1depth
	// b : 2depth
	
	 for(var i=1; i < 12; i++)
	 {
		var obj_menus = document.getElementById("lm-"+i);
		if (i == b)
		{
			if(obj_menus){obj_menus.className = "on";}
		}
	 }
}
function uf_popup(url,w,h){
	window.open(url,"","width="+w+", height="+h+",scrollbars=yes")
}*/

function MenuLoad(a/* 1 depth */, b/* 2 depth */) {
	a = a || 1;
	b = b || 1;
	a = (a > 1) ? (a - 1) : 0;
	b = (b > 1) ? (b - 1) : 0;
	var lnb = $('#lnb ul'),
		d1 = $('> li', lnb),
		d1_on,
		d2;
	if (a <= d1.length) {
		d1_on = $(d1[a]);
		d1_on.addClass('on');
		if (d1_on.hasClass('has-child')) {
			d1_on.addClass('has-child-on');
			d2 = $('ul li', d1_on);
			if (b <= d2.length) {
				$(d2[b]).addClass('on');
			}
		}
	}
}
function uf_popup(url,w,h){
	window.open(url,"","width="+w+", height="+h+",scrollbars=yes")
}

//tab
function tabChange(obj,num,imgId,total) {
    for (i=1; i<=total; i++)    {
        var imgIds = document.getElementById(imgId+i);
        var imgSrc = imgIds.getAttribute("src");
        if (i==num)    {
            document.getElementById(obj+i).style.display = '';
            imgIds.setAttribute("src",imgSrc.replace("_off","_on"));
        }
        else {
            document.getElementById(obj+i).style.display = 'none';
            imgIds.setAttribute("src",imgSrc.replace("_on","_off"));
        }
    }
}
//faq
	function tabView(num,total) {
		for (i=1; i<=total; i++)	{
			if (i==num)	{ document.getElementById("contDivarea"+i).style.display = 'block'; }
			else { document.getElementById("contDivarea"+i).style.display = 'none'; }
		}
	}

//campus_map
function campusmap_open(){
	window.open("/Ducsi/ducsi/intro/campusmap.jsp","campusmap","scrollbars=no,width=960,height=655");
}



/**************************************************************/
/*      print 및 닫기버튼                                        */
/**************************************************************/

   var initBody;
   
   function beforePrint(){ 
		initBody = document.body.innerHTML; 
		document.body.innerHTML = printContent.innerHTML;
   } 

   function afterPrint(){ 
	  document.body.innerHTML = initBody; 
   } 

   function printArea() { 
      window.print(); 
   }
   
   window.onbeforeprint = beforePrint; 
   window.onafterprint = afterPrint; 

   function initPrint(){
       
       getCssParser();

	   var s_str = opener.document.getElementById("print_area");
	   var t_str = document.getElementById("printContent");
	  
	   if(s_str == null || t_str == null) self.close();
	   
	   t_str.innerHTML = doStripLinktag(s_str.innerHTML);

   }

   
    function doStripLinktag(str) {
        str = str.replace(/onclick=\"(.*?)\"/gi,"");
  	    str = str.replace(/<a(.*?)\>/gi,"");
		str = str.replace(/<\/>/gi,"");
	    return str;
    }

    function getCssParser(){
      

	}