//¸ÞÀÎ & ¼­ºê È­¸é ÁÖ¿ä ¾Ë¸² ¸¶´ç ºÎºÐ - 2009/09/28
var main_allim = new Array("a","b","c","d","e");
function getMainAllimFocus(obj,cnt)
{
	var i=0 ; 
	for(i=0 ; i < main_allim.length ; i++)
	{
		if(obj==main_allim[i]) document.getElementById(main_allim[i]).style.display='block';
		else document.getElementById(main_allim[i]).style.display='none';	
	}
	count1 = cnt;
	clearInterval(intervalPointer);
}

function getSetOverNone(obj)
{
	var i=0 ; 
	for(i=0 ; i < main_allim.length ; i++)
	{
		if(obj==main_allim[i]) document.getElementById(main_allim[i]).style.display='block';
		else document.getElementById(main_allim[i]).style.display='none';	
	}
}

//Å¸ÀÔºñ±³ (ºñ±³¹®ÀÚ , ºñ±³Çü½Ä ; ex: getTypeCheck(string , "1234567890") ) 
function getTypeCheck (s, spc)
{
	var i;

	for(i=0; i< s.length; i++) 
	{
		if (spc.indexOf(s.substring(i, i+1)) < 0) 
		{
			return false;
		}
	}        
	return true;
}

//¼ýÀÚÃ¼Å©
function InPutCheck(field,str)
{
	if (!getTypeCheck(field.value,str))
	{
		alert('Çã¿ëÄ¡ ¾Ê´Â ÀÔ·Â°ªÀ» ÀÔ·Â ÇÏ¼Ì½À´Ï´Ù.');
		field.value = '';
		field.focus();
		return false;
	}
}

var firstCall = true;
var font_size=0;
function changeFontsize(fSize, increment,is_set) {

	if(is_set==null&&increment!='') {
		if(increment!=-1) {
			if(font_size>=5) {  //ÆùÆ® Å©±â Á¦ÇÑ
				alert('´õ ÀÌ»ó È®´ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.');
				return false;
			}
			font_size++;
		}
		else {
			if(font_size<=0) {  //ÆùÆ® Å©±â Á¦ÇÑ
				alert('´õ ÀÌ»ó Ãà¼ÒÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.');
				return false;
			}
			font_size--;
		}

		setCookie("font_size",font_size,1,"/");
	}

	if (firstCall) {
		firstCall = false;
		if (increment != "") {
			changeFontsize('12', '',is_set);  //Ã³À½½ÇÇàÇÏ¸é 12·Î °íÁ¤½ÃÅ°±â
		}
	}	

	if (document.getElementsByTagName) {
	//var getElement = document.getElementsByTagName("td");
	//var getElement = getElementsByTagNames("td,a,span","");
	var getElement = getElementsByTagNames("body,td,a,span,div","");
	var eachElement, currentFontSize, fontIncrease, newFontSize;
	for (i=0; i<getElement.length; i++) {
		alert(getElement[i]);
		eachElement = getElement[i];
		if (increment != "") {
			currentFontSize = parseInt(eachElement.style.fontSize);
			fontIncrease = parseInt(increment);
			newFontSize = currentFontSize + fontIncrease;
		}
		else if (fSize != "") {
			newFontSize = parseInt(fSize);
		}
		eachElement.style.fontSize = newFontSize + "px";
	}
}
}

//±ÛÀÚÅ©±â 
//ex) onclick="setFontSize(+10);"	 onclick="setFontSize(-10);" //´ÜÀ§%
//function setFontSize(a) {
//	defaultFontSize = "75%";
//	obj = document.getElementsByTagName("body")[0];
//	var objFontSize = obj.style.fontSize;
//	if (!objFontSize) { objFontSize = parseInt(defaultFontSize); }
//	obj.style.fontSize =	parseInt(objFontSize)+ a+ "%";
//}

function setFontSize(a) {
	var defaultFontSize = 1;//em
	var minFontSize = 1;//em
	var maxFontSize = 2;//em
	//obj = document.getElementById("mainWrap");
	obj = document.getElementById("layout");
	if(!obj) obj = document.getElementById("wrap");
	var objFontSize = obj.style.fontSize;
	if (!objFontSize) { objFontSize = parseFloat(defaultFontSize)+"em"; }
//	alert("objFontSize=" + objFontSize);
	var checkFontSize = (Math.round(12*parseFloat(objFontSize))+(a))/12;
	if (checkFontSize >= maxFontSize) { checkFontSize = maxFontSize; obj.style.fontSize = checkFontSize+"em"; alert("´õÀÌ»ó ´Ã¸± ¼ö ¾ø½À´Ï´Ù."); }
	else if (checkFontSize <= minFontSize) { checkFontSize = minFontSize; obj.style.fontSize = checkFontSize+"em"; alert("´õÀÌ»ó ÁÙÀÏ ¼ö ¾ø½À´Ï´Ù."); }
	else { obj.style.fontSize = checkFontSize+"em"; }
	alert("checkFontSize=" + checkFontSize);
	alert(obj.style.fontSize);
}

//footer window.open
function subFooterCopyRight()
{
	window.open('/copyright.html','','width=500 height=673' );
}

//button onmouseover status 
function pageWindowStatus(str)
{
	window.status=(str);
	return true;
}

//page Enlarge and Collapse
function changeFontSizeX(mode)
{
	var targetSpan = document.getElementById('layout');
	var targetElm = targetSpan.getElementsByTagName('*');

	for (var i=0; i< targetElm.length ; i++)
	{
		try
		{
			var targetConentArea = targetElm[i];
			var currentSize = parseInt(targetConentArea.style.fontSize);
			if(targetConentArea.id=="main_new")
			{
				targetConentArea.style.fontSize = '0px';		//font-size:0pt
			}
			else{
				if (!currentSize)
				{
				currentSize = 9;										//±âº» ÆùÆ®Å©±â
				}
				if(mode=="0")
				{
				targetConentArea.style.fontSize = '9pt';		//±âº»ÆùÆ®Å©±â
				}
				else if (mode=="+1") {

				if (currentSize <= 20)								//ÃÖ´ëÆùÆ®Å©±â
				{
				var newSize = currentSize + 1 + 'pt';
				targetConentArea.style.fontSize = newSize;
				} else {
				var newSize = '20pt';							//ÃÖ´ëÆùÆ®Å©±â
				alert("´õ ÀÌ»ó È®´ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
				return false;
				}

				} else {

				if (currentSize >= 6)									//ÃÖ¼ÒÆùÆ®Å©±â
				{
				var newSize = currentSize - 1 + 'pt';
				targetConentArea.style.fontSize = newSize;
				} else {
				var newSize = '6pt';							//ÃÖ¼ÒÆùÆ®Å©±â
				alert("´õ ÀÌ»ó Ãà¼ÒÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
				return false;
				}

				}
			}
		} catch (e) {}		
	}
}

function changelineHeight(mode)
{
	var targetSpan = document.getElementById('layout');
	var targetElm = targetSpan.getElementsByTagName('*');

	for (var i=0; i< targetElm.length ; i++)
	{
		 try
		 {
			var targetConentArea = targetElm[i];
			var currentHeight = parseInt(targetConentArea.style.lineHeight);
			if (!currentHeight)
			{
				 currentHeight = 130; //±âº» ÁÙ°£°Ý
			}
			if (mode)
			{
				 if (currentHeight <= 250) //ÃÖ´ë ÁÙ°£°Ý (´ÜÀ§ %)
				 {
					  var newHeight = currentHeight + 10 + '%';
					  targetConentArea.style.lineHeight = newHeight;
				 } else {
					  var newHeight = '250%'; //ÃÖ´ë ÁÙ°£°Ý
				 }
			} else {
				 if (currentHeight >= 100) //ÃÖ¼Ò ÁÙ°£°Ý (´ÜÀ§ %)
				 {
					  var newHeight = currentHeight - 10 + '%';
					  targetConentArea.style.lineHeight = newHeight;
				 } else {
					  var newHeight = '100%'; //ÃÖ¼Ò ÁÙ°£°Ý
				 }
			}
		  } catch (e) {}
	}
}

/* ³ó¾÷±â¼ú¿ø µå·¡±×ÇÑ ³»¿ë ÀÌ¹ÌÁö º¸±â Ã³¸® ºÎºÐ */
var win1Open = null
var win2Open = null

function doNothing(){}  // does nothing but required by JavaScript in this case

function displayImage(picName, titlename, windowName){
  var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,resizable=no,width=300,height=200")
  if(winHandle != null){
    var htmlString = "<html><head><title>" + titlename +"</title></head>"  
    htmlString += "<body background=" + picName + ">"
    htmlString += "</body></html>"
    winHandle.document.open()
    winHandle.document.write(htmlString)
    winHandle.document.close()
    } 
  if(winHandle != null) winHandle.focus()
  return winHandle
}


//¸ÞÀÎÈ­¸é ÅÇ¸Þ´º over 
function tabOn(tabid,a) 
{
	var inn = "";
	for (i=1;i<=5;i++) {
		inn=""+i;
		tabMenu = document.getElementById("tab"+tabid+"m"+i);
		tabContent = document.getElementById("tab"+tabid+"c"+i);
//		tabMore = document.getElementById("tab"+tabid+"more"+i);
		if (tabMenu) { 
			if (tabMenu.tagName=="IMG") { tabMenu.src="/img/main/" + "tab" + a + "_" + inn + "" + ".gif"; } //ÀÌ¹ÌÁö
			if (tabMenu.tagName=="A") {
				tabMenu.style.padding="1px 0 0 0";
				tabMenu.style.fontWeight="normal";
				}
		}
		if (tabContent) { tabContent.style.display="none"; }
//		if (tabMore) { tabMore.style.display="none"; }
	}
	tabContent = document.getElementById("tab" + tabid + "c" + a);
	if (tabContent) { tabContent.style.display="block"; }
}


function getPopUpFlag(win)
{
	try{ win.focus(); return win; }
	catch(e)
	{
		//if (confirm('\nÆË¾÷(PopUp)ÀÌ Â÷´ÜµÇ¾î ÀÖ½À´Ï´Ù.\n\nÆË¾÷Â÷´ÜÀ» Ç®¾îÁÖ¼Å¾ß ¿äÃ»ÇÏ½Å ±â´ÉÀ» ¼öÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.               \n\nÆË¾÷ Â÷´Ü°ü·Ã ¾È³»ÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?'))
		//{
		//	location.href = "";
		//}
		alert('\nÆË¾÷(PopUp)ÀÌ Â÷´ÜµÇ¾î ÀÖ½À´Ï´Ù.\n\nÆË¾÷Â÷´ÜÀ» Ç®¾îÁÖ¼Å¾ß ¿äÃ»ÇÏ½Å ±â´ÉÀ» ¼öÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.               ');
	}
}


