
function add_announce(id){
	var id = id;
	var Win = window.open('../popup/add_announce.php?id='+id,'','width=500,height=300,scrollbars=yes');    					
	Win.focus();
}

function add_pron(id,dictype){
	var id = id;
	var Win = window.open('../popup/add_pron.php?id='+id+'&dictype='+dictype,'','width=500,height=300,scrollbars=yes');    					
	Win.focus();
}
function add_exam_pron(id,dictype){
	var id = id;
	var Win = window.open('../popup/add_exam_pron.php?id='+id+'&dictype='+dictype,'','width=500,height=300,scrollbars=yes');    					
	Win.focus();
}

function modify_pron(id,dictype){	
	var id = id;
	var Win = window.open('../popup/add_pron.php?id='+id+'&dictype='+dictype+'&modify=Y','','width=500,height=400,scrollbars=yes');    					
	Win.focus();
}
function modify_exam_pron(id,dictype){	
	var id = id;
	var Win = window.open('../popup/add_exam_pron.php?id='+id+'&dictype='+dictype+'&modify=Y','','width=500,height=400,scrollbars=yes');    					
	Win.focus();
}

function add_synonym(div,language){
	var id = id;
	var Win = window.open('../popup/add_synonym.php?div='+div+'&language='+language,'','width=500,height=350,scrollbars=yes');    					
	Win.focus();
}

function add_match(group_id,language,view){
	
	var id = id;
	var Win = window.open('../popup/add_match.php?group_id='+group_id+'&language='+language+'&view='+view,'','width=500,height=350,scrollbars=yes');    					
	Win.focus();
}

function add_mean(div,language){
	var id = id;
	var Win = window.open('../popup/add_mean.php?div='+div+'&language='+language,'','width=500,height=500,scrollbars=yes');    					
	Win.focus();
}

function add_description(div,language){
	var id = id;
	var Win = window.open('../popup/add_description.php?div='+div+'&language='+language,'','width=500,height=600,scrollbars=yes');    					
	Win.focus();
}

function add_pos(div,language){
	var id = id;
	var Win = window.open('../popup/add_pos.php?div='+div+'&language='+language,'','width=500,height=600,scrollbars=yes');    					
	Win.focus();
}

function add_sentence(div,language){

	var id = id;
	var Win = window.open('../popup/add_sentence.php?div='+div+'&language='+language,'','width=500,height=350,scrollbars=yes');    					
	Win.focus();
}

function add_idiom(div,language){

	var id = id;
	var Win = window.open('../popup/add_idiom.php?div='+div+'&language='+language,'','width=500,height=350,scrollbars=yes');    					
	Win.focus();
}


function add_conjugation(id,cate){
	var id = id;
	var Win = window.open('../popup/add_conjugation.php?cate='+cate+'&id='+id,'','width=500,height=500,scrollbars=yes');    					
	Win.focus();
}

function modify_conjugation(id,cate){
	var id = id;
	var Win = window.open('../popup/add_conjugation.php?cate='+cate+'&id='+id+'&modify=Y','','width=500,height=500,scrollbars=yes');    					
	Win.focus();
}

function add_post(id,div){
	var id = id;
	var Win = window.open('../popup/add_post.php?id='+id+'&div='+div,'','width=500,height=300,scrollbars=yes');    					
	Win.focus();
}

function add_ban(id){
	var Win = window.open('../popup/add_ban.php?uid='+id,'','width=500,height=300,scrollbars=yes');    					
	Win.focus();
}




// 날짜정하기

 now=new Date();
 Y=now.getYear();
 M=now.getMonth()+1;
 D=now.getDate();

 function makeSel(tgt,fr,to,def){
	  var cnt=0;
	  var f=document.form2;
	  f.elements[tgt].options.length=0;
	  var str='';
	  for(var i=fr;i<=to;i++){
		   window.status=i;
		   newItem=new Option(cnt);
		   f.elements[tgt].options[cnt]=newItem;
		   f.elements[tgt].options[cnt].text=i;
		   f.elements[tgt].options[cnt].value=i;
		   if(i==def)
		   f.elements[tgt].options[cnt].selected=true;
		   cnt++;
	   }    
 }

 function init(){
	var tday = new Date(Y,M,0);
	makeSel('s0',2006,2010,Y);
	makeSel('s1',1,12,M);
	makeSel('s2',1,tday.getDate(),D);   

	makeSel('e0',2006,2010,Y);
	makeSel('e1',1,12,M);
	makeSel('e2',1,tday.getDate(),D);   
 }

 function chk(v){

  var f=document.form2;
  var tday=new Date(f.s0.value,f.s1.value,0);
  yearInFtl = document.all.form2.s0.value;
  monthInFtl = makeTwoDigit(document.all.form2.s1.value);
  dayInFtl = makeTwoDigit(document.all.form2.s2.value);
  endYearInFtl = document.all.form2.e0.value;
  endMonthInFtl = makeTwoDigit(document.all.form2.e1.value);
  endDayInFtl = makeTwoDigit(document.all.form2.e2.value); 
  makeSel('s2',1,tday.getDate(),D);
 }

function chke(v){
  var f=document.form2;
  yearInFtl = document.all.form2.s0.value;
  monthInFtl = makeTwoDigit(document.all.form2.s1.value);
  dayInFtl = makeTwoDigit(document.all.form2.s2.value);
  endYearInFtl = document.all.form2.e0.value;
  endMonthInFtl = makeTwoDigit(document.all.form2.e1.value);
  endDayInFtl = makeTwoDigit(document.all.form2.e2.value);   
  var tday=new Date(f.e0.value,f.e1.value,0);
  
  makeSel('e2',1,tday.getDate(),D);
 }

 function view_detail(url,id,dictype){
	window.open("http://"+url+"/EntryDetailView.php?entry_id="+id+"&dictype="+dictype);

 }
function checkSearchForm(str)
{
	var f = document.getElementById(str);

	// Form Checker Object
	var fc = new FormChecker(f);

	try
	{
		// 검색어 공백유무 체크 안함
//		fc.assertNotNull("query", "insert query string!", true);
		f.submit();
	}
	catch(e)
	{
		alert(e.message);

		if(e.focus && e.field != "")
		{
			f[e.field].select();
			f[e.field].focus();
		}
	}
}

function openWinWithNothing(url,name,w,h)
{
	var options = "width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";

	openWin(url, name, options);
}

function openWinWithResizable(url,name,w,h)
{
	var options = "width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes";

	openWin(url, name, options);
}

function openWinWithScroll(url,name,w,h)
{
	var options = "width="+w+",height="+h+",scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no";

	openWin(url, name, options);
}

function openWin(url,name,options)
{
	winName = open(url, name, options);
	winName.focus();
}

function eleminateWhitespace(str)
{
	return str.replace(/[ \n\r]/g,"");
}

function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
			      ((expires) ? "; expires=" + expires.toGMTString() : "") +
			      ((path) ? "; path=" + path : "") +
			      ((domain) ? "; domain=" + domain : "") +
			      ((secure) ? "; secure" : "");

	document.cookie = curCookie;
}

function getCookie(name)
{
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;

	if((!start) && (name != document.cookie.substring(0, name.length)))
	{
		return null;
	}

	if(start == -1)
	{
		return null;
	}

	var end = document.cookie.indexOf(";", len);

	if(end == -1)
	{
		end = document.cookie.length;
	}

	return unescape(document.cookie.substring(len, end));
}

function delCookie(name, path, domain)
{
	if(getCookie(name))
	{
		document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}

function changeSiteLanguage(lang)
{
	if(lang == null || lang == undefined)
	{
		lang = "en";
	}

	delCookie("SITE_LANGUAGE", "/", ".nciku.com");
	setCookie("SITE_LANGUAGE", lang, 0, "/", ".nciku.com");

	window.location.reload();
}

function login()
{
    if(confirm("login ok?"))
	{
        window.location.href = "http://id.nciku.com/Account/loginForm.nhn";
	}
}

function checkBanWords(content)
{
	var url = "/rpc/CheckBanWords.php";
	var params = "content="+content;
	var ajax = new Ajax.Request
							(
								url,
								{
									asynchronous: false,
									method: "post",
									postBody: params
								}
							);

	var ret = ajax.transport.responseText.replace(/[ \n\r]/g,"");

	return ret;
}

function GetCookie(sName)
{
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  return null;
}
