//ÀÌº¥Æ®½ºÄÉÁÙ ½ºÅ©¸³Æ® 
function chan(l,v){ 

var tab0 = document.getElementById(l);
if (v==1){
tab0.style.display = 'block';
}else{
tab0.style.display = 'none';
}

}

 // + - ¾ÆÀÌÄÜ
 function iconChn(this_img){
  if(this_img.src.match('open.gif'))   this_img.src=this_img.src.replace(/open.gif/,'close.gif');
  else if(this_img.src.match('close.gif')) this_img.src=this_img.src.replace(/close.gif/,'open.gif');
 }

 
function DIV_menu_open(is_div){
  is_div=document.getElementById(is_div);
  if(is_div.style.display=='none') is_div.style.display='inline';
  else is_div.style.display='none';
 }  

function g_c(y,m,d) {
innerhtml_ON('ajax_util4_cal_search','main_cal','gotos=1&parent=<?=$parent?>&iboard='+document.gift_cal.iboards.value+ '&requ_Y='+y+'&requ_M='+m+'&requ_D='+d); 
}

function board_go(board,field,keyword){ 
par=1; 


if (keyword){
location.href='/main/board.php?board='+board+'&search='+keyword+'&shwhere='+field+'&div_e=4'; 
}else{
location.href='/main/board.php?board='+board;
} 

 
  
}  
 


function board_go_save(b,s,num){  
par=1;

  
if (b=="ticket" || b=="contest"){
location.href='/main/board.php?board='+b+'&shwhere=temp3&search='+s+num +'|&div_e=4'; 
}else{
location.href='/main/board.php?board='+b+'&shwhere=user_add12&search='+s+num +'|&div_e=4'; 
} 
 



}     




//¹è°æÀÌ¹ÌÁö ·Ñ¿À¹ö
function cback(that,imgs){
div_is=document.getElementById(that);
div_is.style.backgroundImage ="url(" + "'" +imgs+"')";
   }


// ¿ÞÂÊ¸Þ´º ÄÁÆ®·Ñ,7¹øÀÌ»óÀº Å©±â¸¸ º¯°æµÊ
function hidemenus(no) {
var sc=document.getElementById("hmenu0");


if(no==0){
if(sc.style.display=='none'){var wplus=60;}else{var wplus=0;}
}else{
var wplus=0;
}

if(sc){

var all_width=eval(1140 + wplus);
var left_width=eval(190 + wplus);
var contents_w=eval(all_width-1);
var header_warp=document.getElementById("header_warp");
var menu_warp=document.getElementById("menu_warp");
var search_warp=document.getElementById("search_warp");
var main_left=document.getElementById("main_left");


header_warp.style.width=all_width + "px";
menu_warp.style.width=all_width + "px";
search_warp.style.width=all_width + "px";
main_left.style.width=left_width + "px";

}




for(var i = 0; i < 8; i++){
var menu_title=document.getElementById('hmenu_t'+i);
var menu_contents=document.getElementById('hmenu'+i);
var menu_img = document.getElementById('imgm'+i);
if(!menu_contents) continue;



if(no==i){

if(menu_contents.style.display=='none'){
menu_contents.style.display='block';
menu_img.src=menu_img.src.replace('mv.gif','mh.gif');

}else{
menu_contents.style.display='none';
menu_img.src=menu_img.src.replace('mh.gif','mv.gif');


}

}else{

if(menu_contents.style.display!='none'){
menu_contents.style.display='none';
menu_img.src=menu_img.src.replace('mh.gif','mv.gif');
}

}



}
 
}


// ·¹ÀÌ¾î ¼û±è,º¸ÀÓ ±âº»°ª
function DIV_open(is_div,op){
is_div=document.getElementById(is_div);

if(op==1){

is_div.style.display='block';

}else if(op==2){

is_div.style.display='none';

}else{

if(is_div.style.display=='none') is_div.style.display='block';
else is_div.style.display='none';

}

}



// ·¹ÀÌ¾î »ç¿ë,±ÝÁö
function DIV_dis(is_div,op){
is_div=document.getElementById(is_div);

if(op==1){

is_div.disabled=0;

}else if(op==2){

is_div.disabled=1;

}else{

if(is_div.disabled)is_div.disabled=0;
else is_div.disabled=1;

}

}


// »ó´Ü °Ë»öÃ¢ ÀÚµ¿Ã¤¿ò

function ajax_key(div_id,topkey,s_key){
is_div=document.getElementById(div_id);
is_div.style.display='inline';
if(s_key > 1){
innerhtml_ON('ajax_topkey',div_id,'top_menu='+topkey); 
}else if(s_key){
innerhtml_ON('ajax_topkey',div_id,'topkey='+topkey +'&s_key='+s_key); 
}else{
innerhtml_ON('ajax_topkey',div_id,'topkey='+topkey); 
}

}



// ajax·Î ¸Þ´º ºÒ·Á¿À±â
function ajax_category(div_id,cateboard,open_id,count,message){
if(open_id!='opens'){ hidemenus(div_id);}else{open_id='open';}
if(!count) count=0;
if(!message) message=0;
menu_img = document.getElementById('imgm'+div_id);

if(menu_img.value=='open' || open_id=='open'){
t_div='hmenu'+div_id;
menu_img.value='close';
innerhtml_ON('ajax_category',t_div,'cateboard='+cateboard +'&count='+count+'&div_id='+div_id+'&message='+message);
}else{
menu_img.value='open';
}


}








// ¸Þ´ºÀÌµ¿-1:ÇöÀçÃ¢,2:»õÃ¢;3,ÆË¾÷,4:iwindows
function menu_go(go_type,board,field,keyword,category,body,width,height){ 
if(!board) return false;
var go_url;

//º»¹®º¸±â
if(body > 0){

if(go_type==4){
go_url='/main/board.php?board='+board+'&command=body&no='+body+'&body_only=y&button_view=y';

}else if(category){

go_url='/main/board.php?board='+board+'&command=body&no='+body+'&category='+category+'&shwhere='+field+'&search='+keyword;

}else{

go_url='/main/board.php?board='+board+'&command=body&no='+body+'&shwhere='+field +'&search='+keyword;

}


//Ä«Å×°í¸® ¸Þ´º
}else if(field=="c"){ 

go_url='/main/board.php?board='+board+'&category='+keyword;


//°Ë»ö¾î°¡ ÀÖ´Ù¸é
}else if(field && keyword){

if(board=='mtarget' && category > 1){
go_url='/main/board.php?board='+board+'&shwhere='+field+'&search='+keyword+'&keycount='+category; 
}else{
go_url='/main/board.php?board='+board+'&shwhere='+field+'&search='+keyword; 
}


//±âº» °Ô½ÃÆÇ
}else{

go_url='/main/board.php?board='+board;
} 


// ³¯Â¥°Ë»ö
if(go_type==6){



if(board=="none" && field){
var go_url='/main/today.php?savecheck='+field;

}else{

if(field){var savecheck='&savecheck='+field}else{ savecheck='';}

if(document.forms['date_form'].sfield[1].checked){
var go_url='/main/today.php?keyfield=user_add8&keyword='+board+savecheck;
}else{
var go_url='/main/today.php?keyfield=user_add7&keyword='+board+savecheck;
}

}


location.href=go_url;


// µµ¿ò¸»¸ðµå
}else if(go_type==5){
var css='btn_grow=y,autoclose=y';
iwindow_OPEN('iwindow_menu_help','bb_view','option='+board+'&title='+field,css);

//»õÃ¢À¸·Î ¿­±â
}else if(go_type==2){
window.open(go_url,'_blank');

//¸ð´ÞÀ©µµ¿ì
}else if(go_type==3 && width && height){

OpenWin_smart(go_url,'',width,height,20,20,1,1);

//·¹ÀÌ¾î
}else if(go_type==4 && width && height){
var css='width='+width+',height='+height+',btn_grow=y,autoclose=y';
iwindow_OPEN(go_url,'bb_view','',css);

}else{
window.open(go_url,'_self');
} 

}  





//  Ä«Å×°í¸®º° ÆîÄ§/Á¢Èû
	function category_display(click_img,util_block_id,uni_value,display_value){
		var tmp_ob = document.getElementById(util_block_id).getElementsByTagName("div");
		var tmp_leng=tmp_ob.length;
		for(var i = 0; i < tmp_leng; i++){
			if(tmp_ob[i].className!=uni_value) continue;
			if(display_value)  tmp_ob[i].style.display= display_value;
			else tmp_ob[i].style.display=(tmp_ob[i].style.display=='none') ? '' : 'none';
		}
		if(click_img){ // [+][-] ¾ÆÀÌÄÜ Å¬¸¯
			if(click_img.src.match('minus.gif')) 
				click_img.src=click_img.src.replace('minus.gif','plus.gif');
			else click_img.src=click_img.src.replace('plus.gif','minus.gif');
		}
		else{ // Ä«Å×°í¸® ¹®ÀÚ¿­ Å¬¸¯
			var tmp_img=document.getElementById(uni_value);
			if(!tmp_img) return;
			if(display_value=='block' || !display_value) tmp_img.src=tmp_img.src.replace('plus.gif','minus.gif');
			else	tmp_img.src=tmp_img.src.replace('minus.gif','plus.gif');
		}
	}

	// Ä«Å×°í¸® ÀüÃ¼ ÆîÄ§/Á¢Èû
	function category_display_all(click_img,util_block_id,uni_head){
		var display_value,img_fr,img_to;
		var tmp_ob = document.getElementById(util_block_id).getElementsByTagName("*");
		var tmp_leng=tmp_ob.length;
		var root_icon1='_open.gif';
		var root_icon2='_close.gif';
		if(click_img.src.match(root_icon1)){
			display_value = 'none';
			img_fr='minus.gif';
			img_to='plus.gif';
			click_img.src=click_img.src.replace(root_icon1,root_icon2);
		}
		else{
			display_value = '';
			img_fr='plus.gif';
			img_to='minus.gif';
			click_img.src=click_img.src.replace(root_icon2,root_icon1);
		}
		for(var i = 0; i < tmp_leng; i++){
			if(tmp_ob[i].className && tmp_ob[i].className.match(uni_head))	
				tmp_ob[i].style.display=display_value; // div display
			else if(tmp_ob[i].id && tmp_ob[i].id.match(uni_head))	
				tmp_ob[i].src=tmp_ob[i].src.replace(img_fr,img_to); // img [+][-]
		}
	}



			function goYozmDaum(link, prefix, parameter) 
			{
				var href="http://yozm.daum.net/api/popup/prePost?link="+encodeURIComponent(link)+"&prefix="+encodeURIComponent(prefix)+"&parameter="+encodeURIComponent(parameter);
				var a = window.open(href,'yozmSend','');
 
				if(a) {
					a.focus();
				}
			}
 
			function sendTwitter(title, url) {
				var wp = window.open("http://twitter.com/home?status="+encodeURIComponent(title)+" "+encodeURIComponent(url),'twitter','');
 
				if(wp) {
					wp.focus();
				}
			}
 
 
			function sendMe2Day(title, url, tag) {
				title="\""+title+"\":"+url;
				var wp = window.open("http://me2day.net/posts/new?new_post[body]="+encodeURIComponent(title)+"&new_post[tags]="+encodeURIComponent(tag),'me2Day','');
 
				if(wp) {
					wp.focus();
				}
			}
 
			function sendFaceBook(title,url) {
 
				var wp = window.open("http://www.facebook.com/sharer.php?u=" + url + "&t="+encodeURIComponent(title),'facebook', '');
				if(wp) {
					wp.focus();
				}
			}
 
			function sendCyWorld(url,title,thumbnail,summary) {
 
				var wp = window.open("http://csp.cyworld.com/bl/bo_recommend_pop.php?url="+encodeURIComponent(url)+"&title="+encodeURIComponent(title)+"&thumbnail="+encodeURIComponent(url)+"&summary="+encodeURIComponent(summary),"xu",'');
				if(wp) {
					wp.focus();
				}
			}
 
			function sendGoogle(title,url,labels) {
 
				var wp = window.open("http://www.google.com/bookmarks/mark?op=add&title="+encodeURIComponent(title)+"&bkmk="+encodeURIComponent(url)+"&labels="+encodeURIComponent(labels),"google",'');
				if(wp) {
					wp.focus();
				}
 
			}


