var assigned="";


//----------------------- assign ----------------------------
function assign(sg,obj,href){
var i=0;
var valist = sg.split(";");
var temp;

for(i=0;i<valist.length;i++){
temp = valist[i].split("->");
if(temp[0]&&temp[1]){document.cookie = obj+"["+temp[0]+"]="+encodeURIComponent(temp[1])+";path=/;";}
}

if(!assigned){
if(href){assigned = href;}
else{assigned = location.href;}
}


}






//------------------------ 해당 객체 값 클리어 --------------------------
function assign_clear(obj){
var temp = document.cookie.split(';');
var temp2;
var i=0;

for(i=0;i<temp.length;i++){
temp2 = temp[i].split('=');

if(obj){
if(temp2[0].indexOf(obj+'[')!=-1){document.cookie = (temp2[0]+"=;path=/;");}
}else{
if(temp2[0].indexOf('[')!=-1){document.cookie = (temp2[0]+"=;path=/;");}
}

}



}







//----------------------- assign flush ----------------------------
function assign_flush(){


if(assigned){
if(location.href!=assigned){location.href=assigned;}
else{document.location.reload();}
assigned = ("");
}}

document.onclick = assign_flush;














//---------------------------------------- 위지윅 에디터 --------------------------------------

function ddhblog_editor_exec1(execcmd,opt1,opt2){
if(!opt1){opt1=false;}if(!opt2){opt2=null;}
if(document.getElementById("ddhblog_editor_iframe").contentDocument){
document.getElementById("ddhblog_editor_iframe").contentDocument.execCommand(execcmd,opt1,opt2);
}else{
if(execcmd.indexOf('insertimage')!=-1){
document.frames['ddhblog_editor_iframe'].document.body.innerHTML += ("<img src='"+opt2+"'>");
document.frames['ddhblog_editor_iframe'].document.body.scrollTop=(999999);
}else{
document.frames['ddhblog_editor_iframe'].document.execCommand(execcmd,opt1,opt2);
}}}




function ddhblog_editor_exec_addhtml(html){
if(document.getElementById("ddhblog_editor_iframe").contentDocument){
document.getElementById("ddhblog_editor_iframe").contentDocument.body.innerHTML += html;
document.getElementById("ddhblog_editor_iframe").contentDocument.body.scrollTop=(999999);
}else{
//var oRng = document.frames['ddhblog_editor_iframe'].document.selection.createRange(); oRng.collapse(false);oRng.pasteHTML(html);
document.frames['ddhblog_editor_iframe'].document.body.innerHTML += html;
document.frames['ddhblog_editor_iframe'].document.body.scrollTop=(999999);
}}


function ddhblog_editor_addhtml(){
document.getElementById('ddhblog_editor_addhtml').innerHTML=document.getElementById('ddhblog_editor_temp12').innerHTML;
}






//----------------------------------------- 업로드 부분 닫기 -------------------------------
function ddhblog_editor_upload_close(){
document.getElementById('file_upload_dsp').innerHTML='';
}





//--------------------------------------- 폼 첵박 스케너 ---------------------------------
function ddh_checkbox_scan(form_id){
var result="";
if(!document.getElementById(form_id))return false;
var form = document.getElementById(form_id);
for(i=0;i<form.length;i++){
if(form[i].type!='checkbox')continue;
if(form[i].checked==true&&form[i].value!="false")
result+=form[i].value+",";
}
return result;
}





//---------------------------------------- 카테고리 이동 --------------------------------------
function move_ct(link,ct){
var cart = ddh_checkbox_scan('main_list_form');
if(!cart){alert('포스트를 선택 하세요.');return false;}
assign_clear('main.blog.list');
location.href=link+cart+'&ct='+ct;
}




//---------------------------------------- 게시물 삭제 --------------------------------------
function remove_article(link){
var cart = ddh_checkbox_scan('main_list_form');
if(!cart){alert('포스트를 선택 하세요.');return false;}
location.href=link+cart;
}




//--------------------------------------- 트랙백 폼 생성----------------------------------
function make_trackback_form(){
document.getElementById('trackback').innerHTML=
document.getElementById('trackback2').innerHTML;
}



//--------------------------------------- 트랙백 폼 삭제----------------------------------
function delete_trackback_form(){
document.getElementById('trackback').innerHTML='';
}




//-------------------------------------- 이미지 맞추기 ------------------------------------
function image_fit_size(obj){if(obj.width>600){obj.width = 580;}}






//-------------------------------------------------------- 꼬마창을 띄워 준다 -------------------------------------------------
function _wopen(url,width,height,scroll){
if(!scroll){scroll=="no";}
temp_window = window.open('','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=yes,left=0,top=0,width='+width+',height='+height+'');
temp_window.document.open(); 
temp_window.document.write ("<body bgcolor=black oncontextmenu=\"return false\" leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" onselectstart=\"return false\" ondragstart=\"return false\"><img src=\""+url+"\" style=\"cursor:pointer;\" onclick=\"window.close();\" onload=\"window.resizeTo((this.width+40),(this.height+100));\"></body>"); 
temp_window.document.close(); 
}




//------------------------------------ 이미지 사이즈 마추어서 새창 -------------------------------
function view_image(src){
_wopen(src,200,100,'yes');
}








//--------------------------------- 업로드 다이얼 로그 추가 하기 ------------------------------------
function showbox(url){
	window.showModalDialog(url,'','dialogWidth:500px;dialogHeight:220px;dialogleft:100px;dialogtop:100px;');
}





