
//***************************************************************************//
// Áñ°ÜÃ£±â
//***************************************************************************//

function bookmark()
{
	window.external.AddFavorite("http://www.topiaacademy.co.kr/bundang/","TOPIA ºÐ´çº»¿ø");
}



//***************************************************************************//
// Popup Window - URL, window name, width, height
//***************************************************************************//
function NewWindowOpen (str,str2,str3,str4) {
	var tmpUrl  = str;
	str3 = parseInt(str3) + 20;
	str4 = parseInt(str4) + 20;
	var tmp		= "width="+ str3 +", height="+ str4 +",scrollbars=yes";
	window.open(tmpUrl,str2,tmp);
}


//***************************************************************************//
// Numeric Check - form object
//***************************************************************************//
function DigitChk(str,str1) {

	var CurrObj = eval(str +"."+ str1);
	var chkstr = CurrObj.value;

	if(!NumberCheck(chkstr))
		CurrObj.value = "";
}

//***************************************************************************//
// Numeric Check - Checking ÇÒ º¯¼ö
//***************************************************************************//
function NumberCheck(str) {

	var residentValue = "0123456789";
	var string = str;

	var len = string.length;

	for(i=0; i < len; i++) {
		if(residentValue.indexOf(string.substring(i, i+1)) < 0) {
			alert("Çã¿ëµÈ ¹®ÀÚ°¡ ¾Æ´Õ´Ï´Ù. ¼ýÀÚ·Î ´Ù½Ã ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			return false;
		}
	}
	return true;

}

//***************************************************************************//
// Special Check - Checking ÇÒ º¯¼ö
//***************************************************************************//
function SpecialCheck(str) {

	var special = '%`~!@#$%^&*()-_=+|\\{}[];:"\'%<>,.?\/';
	var i;
	var t = str.length;

	for (i=0; i < t; i++) {
		if(special.indexOf(str.substring(i,i+1))>=0) {
			alert("Æ¯¼ö ¹®ÀÚ´Â »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù. ¿µ¹®ÀÚ³ª ¼ýÀÚ·Î ´Ù½Ã ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			return false;
		}
	}
    return true;
}

//***************************************************************************//
// Space Erase - Trim ÇÒ º¯¼ö
//***************************************************************************//
function TrimAll(str) {
	tmpstr = ""
	var chkstr = str;
	if (chkstr == "" ){
		return chkstr;
	}
	for (var i = 0; i < chkstr.length; i++){
		if (chkstr.charAt(i) == " "){
			tmpstr = tmpstr + ""
		}else{
			tmpstr = tmpstr + chkstr.charAt(i)
		}
	}
	return tmpstr;
}


/*######################## ÆË¾÷ »çÀÌÁî ÀÚµ¿ Á¶Àý #######################*/
	function resize_pop(){
		c_width = document.getElementById('resize_div').clientWidth;
		c_height = document.getElementById('resize_div').clientHeight;
		resizeTo(c_width+9,c_height+59);
	}
/*######################## ÆË¾÷ »çÀÌÁî ÀÚµ¿ Á¶Àý// #####################*/



// ÇÃ·¡½Ã
var EmbedStr = "";
	function GetFlash2(objid,url,x,y) { 
		
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', x,
			'height', y,
			'src', url,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', objid,
			'bgcolor', '#ffffff',
			'name', 'HubMain',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', url,
			'salign', ''
			); //end AC code
			//document.write(EmbedStr);
			//return;
			
		}
		
		
		
// ÇÃ·¡½Ã
var EmbedStr = "";
function GetFlash3(objid,url,x,y) { 
	
	AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', x,
		'height', y,
		'src', url,
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', objid,
		'bgcolor', '#ffffff',
		'name', 'HubMain',
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', url,
		'salign', ''
		); //end AC code
		//document.write(EmbedStr);
		//return;
		
	}
		

// ÇÃ·¡½Ã
var EmbedStr = "";
function GetFlash(objid,url,x,y) { 
	EmbedStr = "<object id='objid' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + x + "' height='" + y + "'>";
	EmbedStr += "<param name='allowScriptAccess' value='sameDomain' />";
	EmbedStr += "<param name='movie' value='" + url + "' />";
	EmbedStr += "<param name='quality' value='high' />";
	EmbedStr += "<param name='bgcolor' value='#ffffff' />";
	EmbedStr += "<param name='wmode' value='transparent' />";
	EmbedStr += "<embed src='" + url + "' quality='high' wmode='transparent' bgcolor='#ffffff' width='" + x + "' height='" + y + "' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	EmbedStr += "</object>";
	
	document.write(EmbedStr);
	return;
}

	

var EmbedStr1 = "";
function GetFlash1(objid,url,x,y) { 
	EmbedStr1 = "<object id='objid' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + x + "' height='" + y + "'>";
	EmbedStr1 += "<param name='allowScriptAccess' value='sameDomain' />";
	EmbedStr1 += "<param name='movie' value='" + url + "' />";
	EmbedStr1 += "<param name='quality' value='high' />";
	EmbedStr1 += "<param name='bgcolor' value='#ffffff' />";
	EmbedStr1 += "<param name='wmode' value='transparent' />";
	EmbedStr1 += "<param name='base' value='.' />";
	EmbedStr1 += "<embed src='" + url + "' quality='high' base='.' wmode='transparent' bgcolor='#ffffff' width='" + x + "' height='" + y + "' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	EmbedStr1 += "</object>";
	
	document.write(EmbedStr1);
	return;
}		

function initMoving(topPosition, topLimit, btmLimit) {

	GoTop.initTop = topPosition;
	GoTop.topLimit = topLimit;
	GoTop.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	GoTop.style.position = "absolute";
	GoTop.top = GoTop.initTop;
	GoTop.left = GoTop.initLeft;
	GoTop.style.top = GoTop.top + "px";

	GoTop.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	GoTop.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}
	GoTop.move = setInterval(function() {
		pos = GoTop.getTop() + topPosition;

		if (pos > GoTop.bottomLimit)
			pos = GoTop.bottomLimit
		if (pos < GoTop.topLimit)
			pos = GoTop.topLimit

		interval = GoTop.top - pos;
		GoTop.top = GoTop.top - interval / 8;
		GoTop.style.top = GoTop.top + "px";
	}, 30)
}

		
// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onmouseover = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}

			this.targetEl.style.display = "block";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onmouseover();
}



// sTab Content
function mOver()
{
	this.src = this.src.replace(".gif", "_on.gif");
}
function mOut()
{
	this.src = this.src.replace("_on.gif", ".gif");
}

function TabMenu(menuContainerID, menuTabName) {
	var tabMenu = document.getElementsByName(menuTabName);
	var i = 0;

	for(i=0; i<tabMenu.length; i++) {
		thismenu = tabMenu.item(i);
		thismenu.menuContainer = document.getElementById(menuContainerID);
		thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		if (thismenu.getElementsByTagName("img").item(0)) {
			thismenu.getElementsByTagName("img").item(0).onmouseover = mOver;
			thismenu.getElementsByTagName("img").item(0).onmouseout = mOut;
		}
		thismenu.onclick = tabMenuClick;
	}

	initmenu = tabMenu.item(0);
	initmenu.targetEl.style.display = "block";
	if (initmenu.getElementsByTagName("img").item(0)) {
		initmenu.getElementsByTagName("img").item(0).onmouseover();
		initmenu.getElementsByTagName("img").item(0).onmouseover = null;
		initmenu.getElementsByTagName("img").item(0).onmouseout = null;
	}
	initmenu.menuContainer.current = initmenu;
}


function tabMenuClick() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		if (currentmenu.getElementsByTagName("img").item(0)) {
			currentmenu.getElementsByTagName("img").item(0).onmouseover = mOver;
			currentmenu.getElementsByTagName("img").item(0).onmouseout = mOut;
			currentmenu.getElementsByTagName("img").item(0).onmouseout();
		}
	
		this.targetEl.style.display = "block";
		if (this.getElementsByTagName("img").item(0)) {
			this.getElementsByTagName("img").item(0).onmouseover = null;
			this.getElementsByTagName("img").item(0).onmouseout = null;
		}
		this.menuContainer.current = this;
	}
	return false;
}



//object ÆÄÀÏ ÆÐÄ¡ ´ëºñ 
	
	var paramInfo = new Array;
	
	function initParam()
	{
	  var oldSize = paramInfo.length;
	
		for (var i=0; i<oldSize; i++) {
			paramInfo.length--;
		}	
	}
	
	function setParam(paramName, paramValue)
	{
		var idx = paramInfo.length;
	
		paramInfo[idx] = [];
		paramInfo[idx][0] = paramName;  
		paramInfo[idx][1]= paramValue;
	}
	

	function playMedia(objID, objSource, objWidth, objHeight, objStyle)
	{
		document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ');
		document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');
	
		for (var i=0; i<paramInfo.length; i++) {
			document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');		
			
		}	
		
		document.write('</OBJECT>');
	}
	
	

					
					
//media player
		 var nVolLeftPosition = 0;							// º¼·ý ¹Ù ¹è°æ ½ÃÀÛÁ¡
		var nVolStartPosition = 0;							// º¼·ý ¹Ù ½ÃÀÛ Á¡
		var nVolEndPosition = 30;							// º¼·ý ¹Ù ³¡ Á¡
		var nVolume = 15;									// º¼·ý ÃÊ±â °ª
		var nPrevVol;										// º¼·ýÀÌ º¯°æµÇ±â ÀüÀÇ °ª
		var bIsVolumeSet		= false;						// º¼·ý¹Ù µå·¡±× ¿©ºÎ
		var nZoomed			= 0;							// ±âº»°ª 1 : ÁÜµÊ,   0 : Ãà¼ÒµÊ

		function killErr(){return true;}

		function setVolumeBar(){
			nPrevVol = event.clientX;
			nVolLeftPosition = sound.style.pixelLeft;

			bIsVolumeSet = true;
			document.onmousemove=drag_dropie;
			if (document.all){document.onmouseup=endVolume;}
		}

		function drag_dropie(){
			if (bIsVolumeSet==true){
				var mov = nVolLeftPosition+event.clientX-nPrevVol;
				if ((mov >= nVolStartPosition)  && (mov < nVolEndPosition)){
					cutpoint=nVolEndPosition-sound.style.pixelLeft;
					document.all.soundbg.style.pixelWidth=39-cutpoint;
					//document.all.sbg.width = 58-cutpoint;
					sound.style.pixelLeft=nVolLeftPosition+event.clientX-nPrevVol;
					mplayer.Volume = -2500*(cutpoint/37);
					nVolume=sound.style.pixelLeft
					nVolume1=document.all.sbg.width;
					mplayer.Mute=false;
				}
				return false;
			}
		}

		function endVolume(){
			bIsVolumeSet=false;
		}

		function ris(name, nsdoc)
		{
			var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
			if (name == '') return;
			if (img && img.altsrc) {
				img.src    = img.altsrc;
				img.altsrc = null;
			}
		}

		function cis(name, nsdoc, rpath, preload)
		{ 
			var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
			if (name == '')	return;
			if (img) {
				img.altsrc = img.src;
				img.src    = rpath;
			}
		}		
    
    function mutecheck(){
      if(document.all.mplayer.mute==0) document.all.mplayer.mute=1;
      else document.all.mplayer.mute=0;
    }
 
 function setScrollColor(objFrame) 
 {  
    try 
    { 
      self[objFrame.name].document.body.style.scrollbarFaceColor = "#eeeeee";
      self[objFrame.name].document.body.style.scrollbarHighlightColor = "#ffffff";
      self[objFrame.name].document.body.style.scrollbarShadowColor = "#FFFFFF";
      self[objFrame.name].document.body.style.scrollbar3dLightColor = "#b6b6b6";
      self[objFrame.name].document.body.style.scrollbarArrowColor = "#333333";
      self[objFrame.name].document.body.style.scrollbarTrackColor = "";
      self[objFrame.name].document.body.style.scrollbarDarkshadowColor = "";
    } 
    catch(oException) 
    { 
      // Á¢±Ùº¸¾ÈÀÏ¶§ ¾Æ¹«·± ÀÏµµ ÇÏÁö ¾Ê´Â´Ù. 
    } 

 }

	
	function handlePlay(){
    document.mplayer.play();
	
	}
	function handleStop(){
	    document.mplayer.Stop();
	}
	
	function handlepause(){
	    document.mplayer.pause();
	}
	
	function handleonForward() {
	 document.mplayer.FastForward();
	}
	
	
	function handleonReverse() {
		document.mplayer.FastReverse();
	}
	
	
	function setVolume(opt)
	{

	  delta = 300; 
	  if(opt==0)
	  {
	    mplayer.Mute();
	
	  }
	  else
	  {  
	    if ((mplayer.Volume + delta * opt) > 0)
			mplayer.Volume = 0;
	    else if((mplayer.Volume + delta * opt) < -10000)
	      mplayer.Volume = -10000;
	    else
	      mplayer.Volume = mplayer.Volume + opt*delta ;
	  }
	  mplayer.Play();
	}
	
	

	
// Â÷·®¿îÇà°ü·Ã

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' 
    win = window.open(mypage,myname,settings)
}


 var initBody 
 function beforePrint(){ 
  initBody = document.getElementById('Contents').innerHTML; 
  document.getElementById('Contents').innerHTML = idPrint.innerHTML; 
 } 
 function afterPrint(){ 
  document.getElementById('Contents').innerHTML = initBody; 
 } 
 function printArea() { 
  window.print(); 
 } 
 window.onbeforeprint = beforePrint; 
 window.onafterprint = afterPrint; 


	
	
//¸µÅ© ÁÖº¯ Á¡¼± ¾ø¾Ö±â_Ç×»ó ¸Ç¾Æ¸®¿¡ ½áÁÖ±â
var myAnchors=document.all.tags("A");
function allblur() {
	for (i=0;i<myAnchors.length;i++) {
		myAnchors[i].onfocus=new Function("blur()");
	}
}

allblur();

function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;



//ÆË¾÷ È­¸é Áß¾Ó¿¡ ¶ç¿ì±â
function OpenCenter(parm, width, height)
{
 var sw  = screen.availWidth ;
 var sh  = screen.availHeight ;

 px=(sw - width)/2 ;
 py=(sh - height)/2 ;

 var set  = 'top=' + py + ',left=' + px ;
 set += ',width=' + width + ',height=' + height + ',toolbar=0,resizable=0,status=0,scrollbars=0' ;

    window.open (parm , '' , set) ;
}

