/*
window.onerror = ErrorH; 

function ErrorH(message, url, line) { 
  var str = "" 
  + "Error: " + line + "" + message; 
  window.status = str; 
  return true; 
}
*/

var isIE = (document.all)? true:false;

//»èÁ¦°ü·Ã ÇÔ¼ö
  function del(url,msg)
  {
	  if(confirm(msg)){document.location.href = url;}
  }

//±Û ¼öÁ¤ »èÁ¦½Ã
	function form_check()
	{
		var f = document.form;
		if(!f.b_pw.value){alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');f.b_pw.focus();return false;}
	}

//±Û ÀÛ¼º½Ã
	function write_check()
	{
		var f = document.write_form;
		if(!f.category.value){alert('Ä«Å×°í¸®¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');f.category.focus();return false;}
		if(!f.subject.value){alert('Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä');f.subject.focus();return false;}
		if(!f.memo.value){alert('³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä');f.memo.focus();return false;}
	}

	function write_check2()
	{
		var f = document.write_form;
		if(!f.b_name.value){alert('ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä');f.b_name.focus();return false;}
		if(!f.b_pw.value){alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');f.b_pw.focus();return false;}
		if(!f.subject.value){alert('Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä');f.subject.focus();return false;}
		if(!f.memo.value){alert('³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä');f.memo.focus();return false;}
	}
//Ä«Å×°í¸® µî·Ï,¼öÁ¤½Ã ÇÊ¿äÇÑ ÇÔ¼ö 3°³
	function category_check()
	{
		var f = document.category_form;
		var icnt = f['category_no[]'].length;
		var icnt2 = icnt -1;
		for(i=0; i<icnt; i++)
		{
			tts = f.tt.value.split(',');
			if(!f['category_name[]'][i].value && i != icnt2)//ºÐ·ù¸íÀ» Áö¿üÀ»°æ¿ì
			{
				alert('ºÐ·ù¸íÀ» ³Ö¾îÁÖ¼¼¿ä');f['category_name[]'][i].focus();return false;
			}
			for(t=0;t<tts.length;t++)
			{
				if(!f['category_name[]'][icnt -1].value && i != icnt2)//ºÐ·ùµî·Ï¿¡ ºÐ·ù¸íÀÌ ¾ø°í ¿ì¼±¼øÀ§°¡ °¡Àå ³ôÀ»°æ¿ì
				{
					if(icnt2 == f['category_no[]'][i].value)
					{
						f['category_no[]'][i].value = f['category_no[]'][icnt2].value;
						f['category_no[]'][icnt2].value = icnt2;
						f.tt.value = "";
						alert('ºÐ·ùµî·Ï¿¡ ºÐ·ùÀÌ¸§ÀÌ ¾øÀ»°æ¿ì\n\n ÃÖÇÏÀ§ ¿ì¼±¼øÀ§°¡ ºÐ·ù¿¡ µé¾î°¥¼ö¾ø½À´Ï´Ù.');return false;
					}
				}
				if(tts[t] == f['category_no[]'][i].value)//Áßº¹µÇ´Â °ªÀÌ ÀÖÀ»°æ¿ì ¾ø°ÚÁö¸¸ ¸¸¾àÀ» À§ÇØ¼­
				{
					alert('¿ì¼±¼øÀ§¿¡ Áßº¹µÇ´Â °ªÀÌ ÀÖ½À´Ï´Ù.');return false;
				}
			}
			f.tt.value += f['category_no[]'][i].value+",";
		}
	}

	function category_check2(no)
	{
		var f = document.category_form;
		f.ttl.value = no;
	}
	function category_check3(no,no2)
	{
		var f = document.category_form;
		if(!f['category_no[]'][no2].value)//¿ì¼±¼øÀ§¸¦ Áö¿üÀ»°æ¿ì
		{
			alert('¿ì¼±¼øÀ§¸¦ Áö¿ì½Ã¸é ¾ÈµÇÁ®~ ±×·³ ¹Ì¿À¹Ì¿À');f['category_no[]'][no2].value=f.ttl.value;
		}
		if(f['category_no[]'][no2].value>=f['category_no[]'].length)//°¡ÀåÅ« ¼øÀ§º¸´Ù Å¬°æ¿ì
		{
			alert('°¡Àå³ôÀº ¿ì¼±¼øÀ§º¸´Ù ¼ýÀÚ°¡ Å®´Ï´Ù');f['category_no[]'][no2].value=f.ttl.value;
		}
		if(isNaN(f['category_no[]'][no2].value))//¼ýÀÚ¸¸ °¡´ÉÇÏ°Ô
		{
			alert('¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù. ÀÚ²Ù ¹®ÀÚ¾²¸é ¹Ì¿À ÇÒ²¿¾ß!!');f['category_no[]'][no2].value=f.ttl.value;
		}
		for(i=0;i<f['category_no[]'].length;i++)
		{
			if(i == no2){continue;}
			if(no == f['category_no[]'][i].value)
			{
				f['category_no[]'][i].value = f.ttl.value;
			}
		}
	}
//ÀÌ¹ÌÁö Ã¼Å©
	function img_check (img,name)
	{
		var ch = /.jpg|.gif/;
		var file = img.value;
		var f = eval("document.user_"+name);
		imgs = eval("img_"+name);
		if(ch.test(file))
		{
			this.imgs.innerHTML = "<img src=\""+img.value+"\" border=0 style=\"cursor:hand;width=50;height=50;\" onclick=\"img_pop(this);\">";
		}
		else
		{
			alert('gif,jpg ÆÄÀÏ¸¸ ¾÷·Îµå°¡ °¡´ÉÇÕ´Ï´Ù.');
		}
	}
//Å¬¸¯½Ã ÆË¾÷À¸·Î º¸¿©ÁÖ±â
	function img_pop(image) {
	var width = 1;
	var height = 1;
	ypwindow = window.open("", "Image_Mlang", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width="+width+",height="+height+",top=100,left=100");
	ypwindow.document.open();
	ypwindow.document.write("<html><head><title>Snow Board ÀÌ¹ÌÁö ¹Ì¸®º¸±â</title></head>");
	ypwindow.document.write("<body leftmargin=0 topmargin=0 onclick=self.close();>");
	ypwindow.document.write("<script>function resize(w,h){w = w+35;h=h+55;top.resizeTo(w,h);mw = (screen.width-w)/2;mh = (screen.height-h)/2;if(mw<0){mw=0;}if(mh<0){mh=0;}top.moveTo(mw,mh)}</script>");
	ypwindow.document.write("<img src=\""+image.src+"\" onload=resize(this.width,this.height)>");
	ypwindow.document.write("</body></html>");
	ypwindow.document.close(); 
	}


//°¶·¯¸®ÀÏ°æ¿ì Å¬¸¯½Ã ÆË¾÷À¸·Î º¸¿©ÁÖ±â
	function img_bbs(image) {
	var width = 1;
	var height = 1;
	ypwindow = window.open("", "Image_Mlang", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width="+width+",height="+height+",top=100,left=100");
	ypwindow.document.open();
	ypwindow.document.write("<html><head><title>Snow Board ÀÌ¹ÌÁö ¹Ì¸®º¸±â</title></head>");
	ypwindow.document.write("<body leftmargin=0 topmargin=0 onclick=self.close();>");
	ypwindow.document.write("<script>function resize(w,h){w = w+35;h=h+55;top.resizeTo(w,h);mw = (screen.width-w)/2;mh = (screen.height-h)/2;if(mw<0){mw=0;}if(mh<0){mh=0;}top.moveTo(mw,mh)}</script>");
	ypwindow.document.write("<img src=\""+image+"\" onload=resize(this.width,this.height)>");
	ypwindow.document.write("</body></html>");
	ypwindow.document.close(); 
	}

//È¸¿ø·¹ÀÌ¾î
	document.write("<div id=\"member_layer\" style=\"position:absolute;\"></div><div id=\"member_layer2\" style=\"position:absolute;\"></div>");
	function yp_layer(wuser_id,user_id,url,e)
	{
		var f = document.getElementById("member_layer");
		f.style.display = "block";
		if(document.all)
		{
			x = event.clientX;
			y = event.clientY;
		}
		else
		{
			x = e.pageX;
			y = e.pageY;
		}
		f.style.top = y;
		f.style.left = x-20;
		yp_layer_fun(url+"member/member_layer.php?wuser_id="+wuser_id+"&user_id="+user_id,"member_layer");
	}
	function yp_layer_memo(url,div_id)
	{
		var of = document.getElementById("member_layer");
		var f = document.getElementById(div_id);

		f.style.display = "block";
		f.style.top = of.style.top;
		f.style.left = parseInt(of.style.left)+100;
		yp_layer_fun(url,div_id);
	}
	function yp_layer_memo_send(url,obj,div_id)
	{
		var va = "";
		cnt = obj.length;
		for(i=0;i<cnt;i++)
		{
			if(obj[i].title && !obj[i].value)
			{
				alert(obj[i].title);
				obj[i].focus();
				return false;
			}
			va += obj[i].name+"="+obj[i].value+"&";
		}
		if(document.all)
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			http = new XMLHttpRequest();
		}
		http.open("POST", url, true);
		http.onreadystatechange = function(){yp_friend_open(div_id);yp_layer_close('member_layer2');}
		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		http.send(va);
		return false;
	}
	function yp_layer_open(div_id)
	{
		var f = document.getElementById(div_id);
		if(f.style.display == "none")
		{
			f.style.display = "block";
		}
	}
	function yp_layer_close(div_id)
	{
		var f = document.getElementById(div_id);
		f.style.display = "none";
		f.innerHTML = "";
	}
	function yp_layer_fun(url,div_id) 
	{
		if(document.all)
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			http = new XMLHttpRequest();
		}
		http.open("GET", url, true);
		http.onreadystatechange = function(){yp_layer_open(div_id);}
		http.send(null);
	} 

	function yp_layer_open(div_id) 
	{
		if (http.readyState == 4) {
			var textout = http.responseText;
			document.getElementById(div_id).innerHTML = textout;
		}
	}
	function yp_friend_fun(url) 
	{
		if(document.all)
		{
			http = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			http = new XMLHttpRequest();
		}
		http.open("GET", url, true);
		http.onreadystatechange = yp_friend_open;
		http.send(null);
	} 
	function yp_friend_open() 
	{
		if (http.readyState == 4) {
			var textout = http.responseText;
			alert(textout);
		}
	}
  function popup_window(form,user_id) {
    window.open('../bbs/edit.php?form='+form+'&wuser_id='+user_id, 'popup', 'width=600, height=500, menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no, top=, left=');
  }

  function popup(url,s,w,h,t,l) {
	var f = eval("document.write_form."+s+".value")
    window.open(url+f, 'popup', 'width='+w+', height='+h+', menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no, top='+t+', left='+l+'');
  }

  function popups(url,w,h,t,l) {
    window.open(url, 'popup', 'width='+w+', height='+h+', menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no, top='+t+', left='+l+'');
  }
  function popupy(url,w,h,t,l) {
    window.open(url, 'popup', 'width='+w+', height='+h+', menubar=no, scrollbars=yes, toolbar=no, location=no, resizable=no, top='+t+', left='+l+'');
  }

//°Ë»ö°ü·Ã
	function search_check()
	{
		var f = document.fsearch;
		if(!f.sn.value){alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');f.sn.focus();return false;}
	}

//¿¡·¯Ç¥½ÃÇÏ±â

	function YP_error(msg)
	{
		alert(msg);
	}

//È¸¿ø±Ûº¸±â°ü·Ã
	function user_write_link(url,id,u_no,no)
	{
		opener.location.href = url+"?wuser_id="+id+"&u_no="+u_no+"&no="+no;
	}

//º¹»ç°ü·Ã
function list_copy(obj) {
	
	var text = obj.innerText;
	if (window.clipboardData) 
	{
		window.clipboardData.setData('Text',text);
		document.execCommand("Copy");
		window.clipboardData.getData("Text");
		alert(text+' °¡ º¹»çµÇ¾ú½À´Ï´Ù.');
	}
}

function list_copys(theField,no) {
	var td = eval("document."+no+".trackback_copy.createTextRange()");
	var ts = eval("document."+no+".trackback_copy.select()");
	var tv = eval("document."+no+".trackback_copy.value");
    var doc = td;
    ts;
    doc.execCommand('copy');
	alert(tv+' °¡ º¹»çµÇ¾ú½À´Ï´Ù.');
}

function copy_ypboard(s,msg) 
{
	var cnt = s.length;
	if(isIE)
	{
		var doc = document.body.createTextRange(); 
		doc.moveToElementText(s);
		doc.select(); 
		doc.execCommand('copy');
		alert(msg);
	}
	else
	{

	}
}

function secession(url)
{
	if(confirm("Å»ÅðÇÏ½Ã¸é °°Àº ¾ÆÀÌµð·Î´Â °¡ÀÔÇÏ½Ç¼ö ¾ø°í ¸ðµç Á¤º¸°¡ »ç¶óÁý´Ï´Ù."))
	{
		location.href=url+'member/secession.php';
	}
}

function email_link_fun(url) 
{
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	var f = document.test;


	http.open("GET", url, true);
	http.onreadystatechange = emailopen;
	http.send(null);
} 

function emailopen() 
{
	if (http.readyState == 4) {
		var textout = http.responseText;
		location.href = "mailto:"+textout;
	}
}

function siren_fun(url,wuser_id,nos)
{
	window.open(url+"bbs/siren.php?wuser_id="+wuser_id+"&no="+nos,"siren","menubar=no, scrollbars=no, toolbar=no, location=no, resizable=no");
}
function ax_get_submit(url,obj,fc)
{
	var va = "";
	cnt = obj.length;
	for(i=0;i<cnt;i++)
	{
		if(obj[i].title && !obj[i].value)
		{
			alert(obj[i].title);
			obj[i].focus();
			return false;
		}
		va += obj[i].name+"="+obj[i].value+"&";
	}
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	http.open("GET", url+va, true);
	http.onreadystatechange = eval(fc);
	http.send(null);
	return false;
}