/*
 * div center moving
 * choi.bs
 */
var divOBJ=null;


function reSize(obj)
{
    try{
    var objBody = document.body;
    var objFrame = document.getElementById(obj);
    var ifrmWidth = objBody.clientWidth;
	var ifrmLeft=(ifrmWidth-838)/2;
	objFrame.style.left=ifrmLeft;
    }catch(e){}
}

function loop_center()
{
	try {
		if (divOBJ!=null)
		{
			reSize(divOBJ);
		}
	} catch(e) {}
	setTimeout('loop_center()',300)
}
//window.onload = loop_center;

setTimeout('loop_center()',1000)

/*initMoving */
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 300;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

// Embeded function image Over
function imageOver(imgEl) {
	imgEl.src = imgEl.src.replace("_off.gif", "_on.gif");
}
function imageOut(imgEl) {
	imgEl.src = imgEl.src.replace("_on.gif", "_off.gif");
}


function menuOver() {	this.src = this.src.replace("off.gif", "on.gif");}
function menuOut() {	this.src = this.src.replace("on.gif", "off.gif");}

// Tabbed menu
function initTabMenu(menuElId) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	if(tabMenu.length > 0){
		for(i=0; i<tabMenu.length; i++) {
			thismenu = tabMenu.item(i);
			thismenu.menuContainer = document.getElementById(menuElId);
			thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
			thismenu.targetEl.style.display = "none";
			if(thismenu.getElementsByTagName("img").length>0)	{
				thismenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
				thismenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			}
			thismenu.onclick = tabMenuClick;
		}
		initmenu = tabMenu.item(0);
		initmenu.menuContainer = document.getElementById(menuElId);
		initmenu.targetEl = document.getElementById(initmenu.href.split("#")[1]);
		initmenu.targetEl.style.display = "block";
		initmenu.className = "activate";
		if(initmenu.getElementsByTagName("img").length>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";
		currentmenu.className = null;
		if(currentmenu.getElementsByTagName("img").length>0)	{
			currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
			currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			currentmenu.getElementsByTagName("img").item(0).onmouseout();
		}
		this.targetEl.style.display = "block";
		this.className = "activate";
		if(this.getElementsByTagName("img").length>0)	{
			this.getElementsByTagName("img").item(0).onmouseover = null;
			this.getElementsByTagName("img").item(0).onmouseout = null;
		}
		this.menuContainer.current = this;
	}
	return false;
}


function viewDisplay(obj){
  Obj = document.getElementById(obj);
  if (Obj.className == '' || Obj.className == 'visible') {
		Obj.className = 'hidden';
  } else {
	  Obj.className = 'visible';
  }
 }


 /* top show/hide */
  function ReverseDisplay(obj) {
	 
	if(document.getElementById(obj).style.display == "" || document.getElementById(obj).style.display == "none")	{ 
		document.getElementById(obj).style.display = "block";
		document.getElementById("net").src="/images/common/layout/btn_cmcfm_close.gif";
	}
	else { 
			document.getElementById(obj).style.display = "none"; 
			document.getElementById("net").src="/images/common/layout/btn_cmcfm_open.gif";
		}
}


var old_index="0";
 function ReverseDisplay2(index) {
	var obj="question";

		document.getElementById(obj +index+"_1").style.visibility = "visible"; 
		document.getElementById(obj +index+"_2").style.visibility = "visible"; 
		document.getElementById(obj +index+"_1").style.display = ""; 
		document.getElementById(obj +index+"_2").style.display = ""; 

		if (old_index!="0")
		{
		document.getElementById(obj +old_index+ "_1").style.display = "none"; 
		document.getElementById(obj +old_index+ "_2").style.display = "none"; 
		document.getElementById(obj +old_index+ "_2").style.visibility = "hidden"; 
		document.getElementById(obj +old_index+ "_1").style.visibility = "hidden"; 
			
		}
		if(old_index==index)
		{
			old_index="0"
		} else {
			old_index=index;
		}
}


function HideContent(obj) {
document.getElementById(obj).style.display = "none";
divOBJ=null;
}
function ShowContent(obj) {
	if (divOBJ!=null)
	{
		HideContent(divOBJ);
	}
	document.getElementById(obj).style.display = "block";
	if (obj=="bgsearch" || obj=="reserwrap")
	{
		divOBJ=obj;
	}
}

// fmeduView
function fmeduView(obj) {
	var target = document.getElementById(obj);
	target.style.display = (target.style.display=='none' ? 'block':'none');
}

/* png24 */
function setPNG24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bPNG24\b/i,'');
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}

/* font_zomm */
var arrTag = new Array( 'div','td','tr', 'a');
var arrSize = new Array( '8','9','10','11','12','13','14','15','16','17','18' );
var stSize = 4;

function AutoTextSize(tget,cnt) {
	var cText = null, sSize = stSize, cTag;

	sSize += cnt;
	
	if ( sSize < 0 ) sSize = 0;
	if ( sSize > 10 ) sSize = 10;

	stSize = sSize;

	if (!( cText = document.getElementById(tget))) 
		cText = document.getElementsByTagName(tget)[0];
		cText.style.fontSize = arrSize[sSize]+'px';
	
	for ( i = 0 ; i < arrTag.length ; i++ ) {
		cTag = cText.getElementsByTagName(arrTag[i]);
		for ( j = 0 ; j < cTag.length ; j++ ) {
			cTag[j].style.fontSize = arrSize[sSize]+'px';
		}
	}
}

//flash
function swfprint(furl,fwidth,fheight,transoption, Id) {
    if (Id) {
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+ fwidth +'" height="' + fheight +'" align="middle" id="'+Id+'">');
    } else {
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+ fwidth +'" height="' + fheight +'" align="middle">');
    }
    document.write('<param name="movie" value="'+ furl +'"/>');
    document.write('<param name="allowScriptAccess" value="always"/>');
    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 +'"');
    if (transoption == "t") {
        document.write(' wmode="transparent"');
    } else if (transoption == "o") {
        document.write(' wmode="opaque"');
    }
    if (Id) {
        document.write(' id="'+Id+'"');
    }
    document.write('></object>');
    document.write('<!--> <![endif]-->');
    document.write('</object>');
}

//png

var clear="/images/common/quick/clear.gif" //path to clear.gif

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
window.attachEvent('onload',pngfix);
function Openview()
{
		popupNoscroll("/popup/rss.pop.jsp","",780,520);
}


/* popup center */
function WinPop(url,name,w,h,s) {
 if(s!=0) {
  sOp = ",scrollbars=yes";
 } else {
  sOp = "status=1";
 }
 var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
 winOptions = 'width='+w+',height='+h+',top='+wint+',left='+winl+','+sOp;
 var winObj = window.open(url,name,winOptions);
 return winObj;
}