/***** Top ¹öÆ° Ã³¸® ½ÃÀÛ  ***/
function CheckUIElements() {
  var yMenu1From, yMenu1To, yOffset, timeoutNextCheck;
  var wndWidth = parseInt(document.body.clientWidth);
  yMenu1From   = parseInt (webminiLayer.style.top, 10);
  yMenu1To     = document.body.scrollTop + 363; // À§ÂÊ À§Ä¡
  timeoutNextCheck = 500;

  if ( yMenu1From != yMenu1To ) {
    yOffset = Math.ceil( Math.abs( yMenu1To - yMenu1From ) / 20 );
    if ( yMenu1To < yMenu1From )
      yOffset = -yOffset;

    webminiLayer.style.top = parseInt (webminiLayer.style.top, 10) + yOffset;

    timeoutNextCheck = 10;
  }
  webminiLayer.style.left = (document.body.clientWidth/2)+394;
  setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function MovePosition() {
  var wndWidth = parseInt(document.body.clientWidth);

  // Æä¿¡Áö ·Îµù½Ã Æ÷Áö¼Ç
  webminiLayer.style.top = 200;
  webminiLayer.style.left = (document.body.clientWidth/2)+440;  // ¿·ÂÊ À§Ä¡
  webminiLayer.style.visibility = "visible";

  // initializing UI update timer
  CheckUIElements();
  return true;
}
/***** Top ¹öÆ° Ã³¸® ³¡  ***/

/***** ·¹ÀÌ¾î ÆË¾÷ ½ÃÀÛ  ***/

function _ID(obj){return document.getElementById(obj)}
/*** ·¹ÀÌ¾î ÆË¾÷Ã¢ ¶ç¿ì±â ***/
function popupLayer(s,w,h)
{
	if (!w) w = 323;
	if (!h) h = 154;

	var pixelBorder = 0;
	var titleHeight = 0;
//	w += pixelBorder * 2;
//	h += pixelBorder * 2 + titleHeight;

	var bodyW = document.body.clientWidth;
	var bodyH = document.body.clientHeight;

	var posX = (bodyW - w) / 2;
	var posY = (bodyH  - h) / 2;

	hiddenSelectBox('hidden');

	/*** ¹é±×¶ó¿îµå ·¹ÀÌ¾î ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		backgroundColor = "#FFFFFF";
		filter = "Alpha(Opacity=50)";
		opacity = "0.5";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	/*** ³»¿ëÇÁ·¹ÀÓ ·¹ÀÌ¾î ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = "0px solid #FFFFFF";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	/*** ¾ÆÀÌÇÁ·¹ÀÓ ***/
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 0;
		height = h - pixelBorder * 0 - titleHeight - 0;
		//border = "3 solid #000000";
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	ifrm.scrolling = "no";
	//ifrm.className = "scroll";
	obj.appendChild(ifrm);
}
function closeLayer()
{
	hiddenSelectBox('visible');
	_ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
	_ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}
function hiddenSelectBox(mode)
{

	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
		
		obj[i].style.visibility = mode;
	}
}

/***** ·¹ÀÌ¾î ÆË¾÷ ³¡  ***/

/***** Æò°¡ ·¹ÀÌ¾î ÆË¾÷ ½ÃÀÛ  ***/

function move_box(an, box) {
//¸µÅ©µÈ À§Ä¡¿¡¼­ ºÎÅÍÀÇ ¼³Á¤°ª ÁöÁ¤
  var cleft = 0;  //¿ÞÂÊ¸¶Áø 
  var ctop = -9;  //»ó´Ü¸¶Áø
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}

function show_hide_box(an, width, height, borderStyle) {
  var href = an.href;
  var boxdiv = document.getElementById(href);

  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#fff';

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);

  return false;
}

/***** Æò°¡ ·¹ÀÌ¾î ÆË¾÷ ³¡ ***/

function ShowFlash(url,id,width,height){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id='+ id +' >');
	document.write('<param name="movie" value="' + url + '">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<PARAM NAME=scale VALUE=noscale>');
	document.write('<param name="quality" value="high">');
	document.write('<PARAM NAME=wmode VALUE=transparent>');
	document.write('<embed src="' + url + '" quality="high" scale=noscale allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent"></embed>');
	document.write('</object>');
	
}

function td_onclick(url,no)
{
	if(url=="")
	  alert('ÕýÔÚ¼ÓÔØÖÐ£¬ÇëÉÔºó·ÃÎÊ!!')	
	else
	{	
		if(no==1)
		  window.open(url);
		else
		  window.location.href=url
	}
}

