var Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

function $(o){ return document.getElementById(o); }
function evalJSON(str){ return eval('(' + str + ')'); }

/*** ÀÌº¥Æ® Ãß°¡ ***/
function bindEvent(element, event, callback){
	if (element.addEventListener) element.addEventListener(event, callback, false); 
	else if (element.attachEvent) element.attachEvent("on" + event, callback);
}

function getInnerText(o){
  return o.textContent ? o.textContent : o.innerText;
}

function embed(src,width,height,vars)
{
	document.write('\
	<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\
	<PARAM NAME=movie VALUE="'+src+'">\
	<PARAM NAME=quality VALUE=high>\
	<PARAM NAME=wmode VALUE=transparent>\
	<PARAM NAME=bgcolor VALUE=#FFFFFF>\
	<PARAM NAME=allowScriptAccess VALUE="always">\
	<param name=flashvars value="' + vars + '">\
	<EMBED src="'+src+'" quality=high bgcolor=#FFFFFF wmode=transparent allowScriptAccess=always WIDTH="'+width+'" HEIGHT="'+height+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" flashvars="' + vars + '"></EMBED>\
	</OBJECT>\
	');
}

function addFavorite() {
    window.external.AddFavorite('http://www.footgear.co.kr','¡ÚÇ²±â¾î¡ÚÃÖ°­¸ÖÆ¼¼¥¡Ú¸ÅÀÏ½Å»ó¾÷µ«');
}


/*** »óÇ° ½ºÅ©·Ñ ***/
var eScroll = function(id,param)
{
	/******************************************************************
	 * eScroll Script v1.0
	 * by mirrh (imirrh@gmail.com)
	 *****************************************************************/
	this.param = {
		itemsize	: 100,	// °³´ç ¾ÆÀÌÅÛ »çÀÌÁî(°¡·Î ¶Ç´Â ¼¼·Î pixel)
		direction	: 'h',	// ½ºÅ©·Ñ ¹æÇâ (h:°¡·Î, v:¼¼·Î)
		speed		: 2,	// ½ºÅ©·Ñ ¼Óµµ (ÇÑ¹ø¿¡ ÀÌµ¿µÇ´Â pixel)
		delay		: 100	// ¾ÆÀÌÅÛÀÌ Àá±ñ ¸ØÃß´Â ½Ã°£
	};
	for (var x in param) this.param[x] = param[x];

	var _self = this;
	var box = document.getElementById(id), ul = box.getElementsByTagName('ul')[0];
	var sleep = 0, ea = 0, cutline = 0, move_stop = 0, course = 1;

	/*** mouse event ***/
	box.onmouseover = function(){_self.stop_move(1)}
	box.onmouseout = function(){_self.stop_move(0)}

	if (this.param.direction=="h") box.scrollLeft = 0;
	else box.scrollTop = 0;

	this.scroll = function(){
		var pos = (this.param.direction=="h") ? box.scrollLeft : box.scrollTop;
		if (move_stop || (pos%this.param.itemsize==0 && ++sleep<this.param.delay)) return;
		sleep = 0; pos = pos + course * this.param.speed;
		if (pos>=cutline) pos = 0;
		else if (pos<=0) pos = cutline;
		if (this.param.direction=="h") box.scrollLeft = pos;
		else box.scrollTop = pos;
	}
	this.setLayout = function(ea){
		ul.style.cssText = "list-style: none; margin:0; padding:0;";
		ul.style.width = cutline * 2;
		if (this.param.vitem_ea && this.param.vitem_ea<=ea) ul.innerHTML += ul.innerHTML;
	}
	this.setDirection = function(idx){ sleep = this.param.delay; course = idx; }
	this.stop_move = function(idx){ move_stop = idx; }
	this.init = function(){
		ea = ul.getElementsByTagName('li').length;
		cutline = ea * this.param.itemsize;
		this.setLayout(ea);
		setInterval(function(){_self.scroll()},10);
	}
	this.init();
}

/*** ½ºÅ©·Ñ Á¦¾î ***/
function innerScroll(obj)
{
	if (event.wheelDelta >= 120) obj.scrollTop -= 40;
	else if (event.wheelDelta <= -120) obj.scrollTop += 40;
	//obj.scrollBy(0,event.wheelDelta / -3);
	return false;
}

/*** ¸¶¿ì½º ¿À¹ö ÀÌ¹ÌÁö ½º¿Ò left.mypage.htm ½ºÅ²¿¡ Àû¿ë***/
function swap_image(obj,mode){
	switch (mode)
	{
		case "over": obj.src=obj.src.replace(".gif","_over.gif"); break;
		case "out": obj.src=obj.src.replace("_over.gif",".gif"); break;
	}
}

function swap_image2(obj,mode){
	switch (mode)
	{
		case "over": obj.src=obj.src.replace(".gif","_ov.gif"); break;
		case "out": obj.src=obj.src.replace("_ov.gif",".gif"); break;
	}
}

function comma(x) {
	var temp = "";
	var x = String(uncomma(x));
	num_len = x.length;
	co = 3;
	while (num_len>0){
		num_len = num_len - co;
		if (num_len<0){
			co = num_len + co;
			num_len = 0;
		}
		temp = ","+x.substr(num_len,co)+temp;
	}
	return temp.substr(1);
}

function uncomma(x) {
	var reg = /(,)*/g;
	x = parseInt(String(x).replace(reg,""),10);
	return (isNaN(x)) ? 0 : x;
}

/*** ÆË¾÷ À©µµ¿ì ***/
function popupLayer(src){
	
	/*** ¹é±×¶ó¿îµå ·¹ÀÌ¾î ***/
	var bg = document.createElement("div");
	with (bg.style){
		position = "absolute";
		left = 0;
		top = 0;
		zIndex = 99;
		width = document.body.clientWidth;
		height = (document.body.clientHeight>document.body.scrollHeight) ? document.body.clientHeight : document.body.scrollHeight;
		backgroundColor = "#000";
		filter = "Alpha(Opacity=20)";
	}
	bg.setAttribute("id","popupWindowBg");
	document.body.appendChild(bg);

	var o = document.createElement("div");
	o.setAttribute("id","popupWindow");
	document.body.appendChild(o);

	var posX = (document.body.clientWidth - 600) / 2;
	var posY = document.documentElement.scrollTop + 100;

	with (o.style){
		width = "600px";
		height = "400px";
		position = "absolute";
		zIndex = 100;
		left = posX;
		top = posY;
		border = "1px solid #333";
	}
	o.innerHTML = "<div style='background:#333;height:18px;font:8pt verdana;padding:1px 5px 0 5px;'><div class='stxt left white' style='padding-top:3px'>¡á &nbsp;¹Ì¸£¸ô v1.0</div><div class=right><a href='javascript:parent.closeWindow()' class=white onfocus=blur()>+</a></div></div><iframe name='popupLayer' src='" + src + "' style='width:100%;height:380px;' frameborder=0></iframe>";

	/*
	
	$j("#popupWindow").animate(
	{width:"600px",height:"400px",left:"300px"},0,'',callback
	);

	function callback(){
		$j("#popupWindow").animate({opacity:1});
		//.css("border","2px solid #000")
		$j("#popupWindow").css("filter","progid:DXImageTransform.Microsoft.Shadow(color='#505050', Direction=135, Strength=3)").css("border","1px solid #333");
		$('popupWindow').innerHTML = "<div style='background:#333;height:18px;font:8pt verdana;padding:1px 5px 0 0;text-align:right'><a href='javascript:parent.closeWindow()' class=white onfocus=blur()>+</a></div><iframe src='" + src + "' style='width:100%;height:380px;' frameborder=0></iframe>";
	}
	*/
}

function closeWindowX()
{
	$('popupWindowBg').removeNode();
	$('popupWindow').innerHTML = "";
	$('popupWindow').removeNode();
}
