var spantimecnt = 5;
var spantimetid = "";
var orginX = 0;
var orginType = "";
var nav = (document.layers);
var iex = (document.all);
var skn = (nav) ? document.topdeck : topdeck.style;
if(nav) document.captureEvents(Event.MOUSEMOVE);
//document.onmousemove = get_mouse;

function pop(type) {
	var msg = "", width = "";
	orginType = type;

	if(type == "detailclassinfo") {
		msg = "클릭해 보세요! 과목상세 설명을 확인하실 수 있습니다.";
		width = "350";
	} else if(type == "detailtimeinfo"){
		msg = "클릭해 보세요! 수업별 상세설명을 확인하실 수 있습니다.";
		width = "350"
	} else if(type == "teacherinfo"){
		msg = "클릭해 보세요! 강사님정보를 확인하실 수 있습니다.";
		width = "300"
	} else if(type == "addcartresult"){
		msg = "<b>" + pclassname + "[" + ptimeperiod + "]</b><br>과정을 강의 장바구니에 추가하였습니다.<br><br>";
		msg += "<a href='javascript:window.scroll(0,2000);'><font color='green'>[강의 장바구니 보기]</font></a>(<span id='spantimecnt'>5</span>초 후 사라집니다.)";
		width = "350";
		skn.left = orginX - 500;
		spantimecnt = 5;
		spantimetid = setInterval(off_pop, 1000);
	}

	if(type != "none" && msg != "") {
		var content ="<TABLE WIDTH="+width+" height='18px' BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=#336699><TR><TD valign=middle><TABLE WIDTH=100% border=0 BORDER=0 CELLPADDING=0 CELLSPACING=1 BGCOLOR=#FFFFFF><TR><TD align=center style='padding-top: 2px;'>"+msg+"</TD></TR></TABLE></TD></TR></TABLE>";

		if(nav) {
			skn.document.write(content);
			skn.document.close();
		} else {
			$("topdeck").innerHTML = content;
		}

		$("topdeck").show();
	} else {
		off();
	}
}

function get_mouse(e) {
	var x = (nav) ? e.pageX : event.x+document.body.scrollLeft;   
	var y = (nav) ? e.pageY : event.y+document.body.scrollTop;
	
	skn.left = x + 10;  
    skn.top  = y - 5; 

	orginX = x;
}

function off(divid) {
	$("topdeck").hide();
}

function off_pop() {
	try {
		document.getElementById("spantimecnt").innerHTML = spantimecnt--;
		if(spantimecnt == 0) {
			clearInterval(spantimetid);
			$("topdeck").hide();
			orginType = "";
		}
	} catch(e) {}
}
