// ÀÌ¹ÌÁö ¸®»çÀÌÁî ÇÔ¼ö
function image_resize(obj,img_width,img_height)
{
	if(obj.width>img_width)
	{
		obj.style.width=img_width;
	}

	if(obj.height>img_height)
	{
		obj.style.height=img_height;
	}
}

function image_over(obj,over_img,dir)
{
	obj.src="/admin/upload/"+dir+"/"+over_img;
}

// ¼ýÀÚ¸¸ µî·Ï
function checkNum()
{
	if(event.keyCode <48 || event.keyCode >57)
	{
		 event.keyCode = null;
	}
}

// Æ¯¼ö¹®ÀÚ ¹æÁö
function special_key()
{
	if((event.keyCode >= 33 && event.keyCode <= 47) || (event.keyCode >= 58 && event.keyCode <= 64) || (event.keyCode >= 91 && event.keyCode <= 96) || (event.keyCode >= 123 && event.keyCode <= 126) )
	{
		event.keyCode = null;
	}	// if( (event.keyCode >= 33 && event.keyCode <= 47) || (event.keyCode >= 58 && event.keyCode <= 64) || (event.keyCode >= 91 && event.keyCode <= 96) || (event.keyCode >= 123 && event.keyCode <= 126) )
}


// »õÃ¢¶ç¿ì±â
function win_open(url,width,height)
{
	window.open(url,'','width='+width+',height='+height+',fullscreen=no,menubar=no,status=yes,toolbar=no,titlebar=no,location=no,scrollbars=no');
}

// ½ºÅ©·Ñ¹Ù ÀÖ´Â »õÃ¢¶ç¿ì±â
function win_open2(url,width,height)
{
	window.open(url,'','width='+width+',height='+height+',fullscreen=no,menubar=no,status=no,toolbar=no,titlebar=no,location=no,scrollbars=yes');
}

// ÀÌº¥Æ®ÇÚµé·¯ ÀÌ¹ÌÁö ±³Ã¼
function change_image(obj,imgUrl)
{
	obj.src = imgUrl;
}

function change_bgcolor(obj,color)
{
	obj.style.backgroundColor = color;
}

// ±×·¡ÇÁ ¿òÁ÷ÀÌ´Â ÇÔ¼ö
function UpGraph(objId,graphNum,limit,speed)
{
	var obj = document.all(objId);
	var numObj = document.all(graphNum);
	var objWidth = obj.width - 1;
	numObj.value =  Math.floor(objWidth/speed);
	obj.width = eval(objWidth) + eval(speed);
	timer = setTimeout("UpGraph('"+objId+"','"+graphNum+"',"+limit+","+speed+")",15);
	limit = limit - 1;
	if(objWidth > limit)
	{
		clearTimeout(timer);
	}	// if(objWidth > limit)

}

// 3ÀÚ¸®¸¶´Ù ÄÞ¸¶ Âï±â
function number_format(Num)
{
	var reg = /(^[+-]?\d+)(\d{3})/;   // Á¤±Ô½Ä
	Num += '';                          // ¼ýÀÚ¸¦ ¹®ÀÚ¿­·Î º¯È¯

	while (reg.test(Num))
	{
		Num = Num.replace(reg, '$1' + ',' + '$2');
	}	// while (reg.test(Num))]
	
	return Num;
}


// 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 '';
}



// ¾ç ¿·Ä­¿¡ ºóÄ­ ¾ø¾Ö±â
String.prototype.trim = function ()
{
    return this.replace(/^ *| *$/g, "");
}

// ÄíÅ° »ðÀÔ
function setCookie(name, value, expiredays)
{
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


function change_input_border(obj,border_color)
{
	obj.style.border = "2px solid " + border_color;
}


String.prototype.toInteger = function() {
	return this.replace(/[^0-9]/g, '') * 1;
}

function follow_banner(div_id, origin_top, limit_top, margin_top)
{
 var d, t, s, g, target_height;
 origin_top *= 1;
 limit_top *= 1;
 margin_top *= 1;
 
 d = document.getElementById(div_id);
 s = document.body.scrollTop + "";

 target_height = s.toInteger() + margin_top;
 if(target_height < limit_top) {
  target_height = origin_top;
 }
 
 t = d.style.top.toInteger();
 
 if(t != target_height) {
  g = Math.ceil((t - target_height) / 5);
  if(g > 1000) {
   g = 50;
  } else if (g < -50) {
   g = -50;
  }
  d.style.top = (t - g) + "px";
 }
 
 setTimeout("follow_banner('" + div_id + "', " + origin_top + ", " + limit_top + ", " + margin_top + ");", 1);
}

function add_flash(WidthSize,HeightSize,SwfSrc) {
	var flash_tag = "";
	flash_tag ='<embed src="'+SwfSrc+'" type="application/x-shockwave-flash"  WIDTH="'+WidthSize+'" HEIGHT="'+HeightSize+'" wmode="transparent" scale="exactfit"></embed>'
	document.write(flash_tag);
}
