// JavaScript Document
function add_favorite()
{
	window.external.AddFavorite("http://www.bikem.co.kr","¹ÙÀÌÅ©¸Å°ÅÁø - ¿Â¶óÀÎ ÀÚÀü°Å Á¾ÇÕ Á¤º¸");
	//window.open("/favorite_addlog.php","favorite","width=100,height=100");
}

function show_big_img(num)
{
	//var url = "/files/popupimg.php?num="+num;
	var url = "/files/view_content_img.php?num="+num;
	var win = window.open(url,"photo","width=200,height=200,scrollbars=yes");
	win.focus();
}

function show_big_img_path(imgpath)
{
	var url = "/files/popupimg_path.php?img_path="+imgpath;
	var win = window.open(url,"photo","width=200,height=200,scrollbars=yes");
	win.focus();
}

function writeFlashPlayer(url,width,height,param)
{
	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+'" align="middle">');
	document.write('<param name="movie" value="'+url+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="FlashVars" value="'+param+'">');
	document.write('<embed src="'+url+'" quality="high" width="'+width+'" height="'+height+'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function img_change(img_name, img_src)
{
	var el = document.getElementById(img_name);
	el.src = img_src;
}

function submit_search()
{
	var tform = document.psearch;
	if(tform.q.value == "")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		return false;
	}
	return true;
}

function ch_newsicon(idname, mtype)
{
	var el = document.getElementById(idname);
	if(mtype == "on")
		el.src = "/image/home/icon_arrow.gif";
	else
		el.src = "/image/home/icon_dot.gif";
}

function login_only()
{
	alert("·Î±×ÀÎ ÈÄ »ç¿ë °¡´ÉÇÕ´Ï´Ù.");
}

function find_zip(fname, zipcode, addr0, addr1)
{
	var url = "/zipcode/find_zip.php?fname="+fname+"&zipcode="+zipcode+"&addr0="+addr0+"&addr1="+addr1;
	var win = window.open(url,"zipcode","width=320,height=275,scrollbars=yes");
	win.focus();
}

function find_id()
{
	var url = "/mypage/find_id.php";
	var win = window.open(url,"mypage","width=300,height=180");
	win.focus();
}

function open_company_info(url)
{
	var win = window.open(url,"bm","width=500,height=610");
	win.focus();
}

function copy_str(form_name, input_name)
{
	var obj = eval("document."+form_name+"."+input_name);
	var doc = obj.createTextRange();
	doc.select();
	doc.execCommand('copy'); 
	alert("º¹»çµÇ¾ú½À´Ï´Ù.");
	//alert('Å¬¸³º¸µåÀÇ ³»¿ëÀÌ ºÙ¿©³Ö±â µÇ¾ú½À´Ï´Ù.'); 
}

function foxwinopen(url, win_name, option)
{
	window.open(url, win_name, option);
}

function show_element(elname, showyn)
{
	var el = document.getElementById(elname);
	if(showyn == "y")
	{
		el.style.display = "block";
	}
	else
	{
		el.style.display = "none";
	}
}

function MyBrBody(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function move_element_mouse(elname,e)
{
	var el = document.getElementById(elname);
	el.style.top=e.clientY+15+MyBrBody().scrollTop+'px';
	el.style.left=e.clientX+15+MyBrBody().scrollLeft+'px';
}

function open_copyurl(num, ctype)
{
	var url = "/copyurl.php?num="+num+"&ctype="+ctype;
	window.open(url,"copyurl","width=320,height=60");
}

function reEmbed(str)
{
	document.write(str);
}

///////////////ÀÌº¥Æ® ·Ñ¸µ
function rolling_view()
{
	this.item_cnt = 0;
	this.item_height = 0;
	this.min_item = 0;
	this.item_el = new Array();
	this.item_top = new Array();
	this.name = "";
	
	this.set_fn_name = function(fn_name, item_h, min_cnt)
	{
		this.name = fn_name;
		this.item_height = item_h;
		this.min_item = min_cnt;
	}
	
	this.add_item = function(el_name)
	{
		this.item_el[this.item_cnt] = document.getElementById(el_name);
		this.item_cnt++;
	}
	
	this.show_item = function()
	{
		
		for(var i=0;i<this.item_cnt;i++)
		{
			this.item_top[i] = i * this.item_height;
			this.item_el[i].style.top = this.item_top[i];
		}
		if(this.item_cnt >= this.min_item)
		{
			window.setTimeout(this.name+'.move_item()',3000);
		}
	}
	
	this.move_item = function()
	{
		var new_reset = 0;
		for(var i=0;i<this.item_cnt;i++)
		{
			this.item_top[i] -= 1;
			if(this.item_top[i] <= (0 - this.item_height))
			{
				this.item_top[i] = this.item_height * (this.item_cnt - 1);
				new_reset = 1;
				//alert(this.item_left[i]);
			}
			this.item_el[i].style.top = this.item_top[i];
		}
		if(new_reset == 1)
			window.setTimeout(this.name+'.move_item()',3000);
		else
			window.setTimeout(this.name+'.move_item()',20);
	}
}

//////////////¾ÆÀÌµð Å¬¸¯½Ã/////////
function user_sel(userid)
{
	window.open("/paper/pop_write.php?tid="+userid,"paper","width=408,height=385");
}

////////////ÂÊÁö/////////////////
function paper_read(num, stype)
{
	var url = "/paper/pop_read.php?num="+num+"&stype="+stype;
	var win = window.open(url,"paper_read","width=408,height=385,scrollbars=no");
	win.focus();
}

function paper_close()
{
	var el = document.getElementById("paper_list");
	el.style.visibility = "hidden";
}
//////////////////////////////////