// For Iframe Resizing
//document.domain = 'Cygo.net';

var mainFrame = parent.document.getElementById('contentFrame');

window.onload = function(){
	if(mainFrame != null){
		mainFrame.width = "100%";
		mainFrame.height = document.body.scrollHeight + 30 + "px";
	}
}

function autoResize(obj)
{
	var theHeight= obj.contentWindow.document.body.scrollHeight;
	obj.height = theHeight + "px";
}

var browserType=''; 

if(navigator.userAgent.indexOf("MSIE") >-1) {
   browserType = 'IE'; 
} else if(navigator.userAgent.indexOf("Firefox") >-1) {
   browserType = 'FF'; 
} else {
   browserType = 'OTHER'; 
}
function gnbinToggle(id, mmblock) {
	if(browserType == 'FF') {
		gnbinToggleFF(id, mmblock);
	} else {
		gnbinToggleIE(id, mmblock);
	}
}

// Local Navigation Toggle
function gnbinToggleIE(id, mmblock) {
	var mmid_count = 8;
	for(num=0; num<mmid_count; num++) {
		document.getElementById('mmid'+num).style.display='none';
		document.getElementById('mmli'+num).setAttribute('className', 'off');
	}
//	alert(mmid_count);
//	alert(document.getElementById('mmli0').className);
	document.getElementById('mmid'+id).style.display='';
	mmblock.className = "on";
}

// Local Navigation Toggle
function gnbinToggleFF(id, mmblock) {
//    var mobj = document.getElementsByName('mmli');
	for(var num=0; 8; num++) {
//		mobj[num].className = null;

		document.getElementById('mmid'+num).style.display='none';
		document.getElementById('mmli'+num).className = null;
	}
	document.getElementById('mmid'+id).style.display = 'block';
	mmblock.className = 'on';
}

// Hide And Show Toggle
var cc=0
function hideShow(id) {
	if (cc==0) {
        cc=1
        document.getElementById(id).style.display="none";
    } else {
        cc=0
        document.getElementById(id).style.display="block";
    }
}

// Show And Hide Toggle
var cc=0
function showHide(id) {
    if (cc==0) {
        cc=1
        document.getElementById(id).style.display="block";
    } else {
        cc=0
        document.getElementById(id).style.display="none";
    }
}

// Local Navigation Toggle
function lnbToggle(id) {
	for(num=1; num<=3; num++) document.getElementById('D3MG'+num).style.display='none'; //D4MG1~D4MG3 ±îÁö ¼û±ä ´ÙÀ½
	document.getElementById(id).style.display='block'; //ÇØ´ç ID¸¸ º¸ÀÓ
}

// IS
function chkIsKind(key, value) {
    showHide('selectOrder');
    xGetElementById('search_target'+key).checked = true;
    xInnerHtml('search_target_label', value);
}

 function resizeFrame(iframeObj){
/* ¾ÆÀÌÇÁ·¹ÀÓ¿¡¼­ ÀÐ¾îµéÀÎ ÆäÀÌÁöÀÇ body */
var innerBody = iframeObj.contentWindow.document.body;

/* ³ôÀÌ ´Ù½Ã¼³Á¤ */
var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
iframeObj.style.height = innerHeight;

/* ³ÐÀÌ ´Ù½Ã¼³Á¤ */
var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
iframeObj.style.width = innerWidth;     

this.scrollTo(1,1); 
}
function selectChg(obj,value){
obj=obj.replace(/\&/g,'&amp;');
document.getElementById("search_layer").style.display = "none";
document.getElementById("selectTxt").innerHTML = obj;
document.getElementById("selectTxt2").innerHTML = obj;
document.getElementById("D_Search0").style.display='none'; //ID¼û±è
}
function Chgbg(obj, color) {
obj.style.backgroundColor = color;
return false;
}
function selectHide() {
var selectObj = document.getElementById("search_layer");
selectObj.style.display = "none";
}
function selectView() {
var selectObj = document.getElementById("search_layer");
if (selectObj.style.display == "block") {
selectObj.style.display = "none";
} else {
selectObj.style.display = "block";
}
}

function move1(whichlayer){
	tlayer=eval(whichlayer)
	if (tlayer.top>0&&tlayer.top<=5){
		tlayer.top=0
		setTimeout("move1(tlayer)",pausebetweenimages)
		setTimeout("move2(document.main.document.second)",pausebetweenimages)
	return
	}
	if (tlayer.top>=tlayer.document.height*-1){
		tlayer.top-=5
		setTimeout("move1(tlayer)",50)
	}
	else{
		tlayer.top=scrollerheight
		tlayer.document.write(slideimages[i])
		tlayer.document.close()
	if (i==slideimages.length-1)
		i=0
	else
		i++
	}
}

function move2(whichlayer){
	tlayer2=eval(whichlayer)
	if (tlayer2.top>0&&tlayer2.top<=5){
		tlayer2.top=0
		setTimeout("move2(tlayer2)",pausebetweenimages)
		setTimeout("move1(document.main.document.first)",pausebetweenimages)
	return
	}
	if (tlayer2.top>=tlayer2.document.height*-1){
		tlayer2.top-=5
		setTimeout("move2(tlayer2)",50)
	}
	else{
		tlayer2.top=scrollerheight
		tlayer2.document.write(slideimages[i])
		tlayer2.document.close()
	if (i==slideimages.length-1)
		i=0
	else
		i++
	}
}

function move3(whichdiv){
	tdiv=eval(whichdiv)
	if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
		tdiv.style.pixelTop=0
		setTimeout("move3(tdiv)",pausebetweenimages)
		setTimeout("move4(second2)",pausebetweenimages)
	return
	}
	if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
		tdiv.style.pixelTop-=5
		setTimeout("move3(tdiv)",50)
	}
	else{
		tdiv.style.pixelTop=scrollerheight
		tdiv.innerHTML=slideimages[i]
	if (i==slideimages.length-1)
		i=0
	else
		i++
	}
}

function move4(whichdiv){
	tdiv2=eval(whichdiv)
	if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
		tdiv2.style.pixelTop=0
		setTimeout("move4(tdiv2)",pausebetweenimages)
		setTimeout("move3(first2)",pausebetweenimages)
	return
	}
	if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
		tdiv2.style.pixelTop-=5
		setTimeout("move4(second2)",50)
	}
	else{
		tdiv2.style.pixelTop=scrollerheight
		tdiv2.innerHTML=slideimages[i]
	if (i==slideimages.length-1)
		i=0
	else
		i++
	}
}

function startscroll(){
	if (document.all){
		move3(first2)
		second2.style.top=scrollerheight
	}
	else if (document.layers){
		document.main.visibility='show'
		move1(document.main.document.first)
		document.main.document.second.top=scrollerheight+5
		document.main.document.second.visibility='show'
	}
}
function window_open(url,width,height){
  if(!url || !width || !height) return false;
  var width = "width="+width;
  var height = "height="+height;
  var op = width+","+height;
  var op = op+",scrollbars=yes"
  window.open(url,"myminihomepage",op);
}
function box_open(el)
{
	if(el=="reply") {
		document.all["reply_box"].style.display = "block";
		document.all["new_box"].style.display = "none";
		document.all["reply_title"].style.background = "";
		with(document.all["new_title"].style){
		backgroundImage = "url('http://tapa.cygo.net/images/bg_re.gif')";
		backgroundRepeat = "repeat-x";
		}					
		document.all["reply_title"].style.fontWeight = "bold";
		document.all["new_title"].style.fontWeight = "";
	}
	else if(el=="new") {
		document.all["new_box"].style.display = "block";
		document.all["reply_box"].style.display = "none";
		with(document.all["reply_title"].style){
		backgroundImage = "url('http://tapa.cygo.net/images/bg_re.gif')";
		backgroundRepeat = "repeat-x";
		}					
		document.all["new_title"].style.background = "";
		document.all["reply_title"].style.fontWeight = "";
		document.all["new_title"].style.fontWeight = "bold";
	}
}
function box_open1(el)
{
	if(el=="down") {
		document.all["down_box"].style.display = "block";
		document.all["vote_box"].style.display = "none";
		with(document.all["vote_title"].style){
		backgroundImage = "url('http://tapa.cygo.net/images/bg_re.gif')";
		backgroundRepeat = "repeat-x";
		}					
		document.all["down_title"].style.background = "";
		document.all["down_title"].style.fontWeight = "bold";
		document.all["vote_title"].style.fontWeight = "";
	}
	else if(el=='vote') {
		document.all["vote_box"].style.display = "block";
		document.all["down_box"].style.display = "none";
		document.all["vote_title"].style.background = "";
		with(document.all["down_title"].style){
		backgroundImage = "url('http://tapa.cygo.net/images/bg_re.gif')";
		backgroundRepeat = "repeat-x";
		}					
		document.all["down_title"].style.fontWeight = "";
		document.all["vote_title"].style.fontWeight = "bold";
	}
}

