// Copyright 2005 PLPTFT, Daum Communications Corp.

var global_dragging=false;var global_debugmode=false;var Browser=new browserCheck();function browserCheck(){var agt=navigator.userAgent.toLowerCase();var is_major=parseInt(navigator.appVersion);var is_minor=parseFloat(navigator.appVersion);var is_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var is_ie3=(is_ie&&(is_major<4));var is_ie4=(is_ie&&(is_major==4)&&(agt.indexOf("msie 4")!=-1));var is_ie4up=(is_ie&&(is_major>=4));var is_ie5=(is_ie&&(is_major==4)&&(agt.indexOf("msie 5.0")!=-1));var is_ie5_5=(is_ie&&(is_major==4)&&(agt.indexOf("msie 5.5")!=-1));var is_ie5up=(is_ie&&!is_ie3&&!is_ie4);var is_ie5_5up=(is_ie&&!is_ie3&&!is_ie4&&!is_ie5);var is_ie6=(is_ie&&(is_major==4)&&(agt.indexOf("msie 6.")!=-1));var is_ie6up=(is_ie&&!is_ie3&&!is_ie4&&!is_ie5&&!is_ie5_5);var is_xp=((agt.indexOf("windows")!=-1)&&(agt.indexOf("5.1")!=-1));var is_xp_sp2=(is_xp&&(agt.indexOf("sv1")!=-1));this.is_ie=is_ie;this.is_ie5up=is_ie5up;this.is_ue5_5up=is_ie5_5up;this.is_ie6up=is_ie6up;this.is_xp=is_xp;this.is_xp_sp2=is_xp_sp2;}
var alert2=function(msg,moduleID,width,height,params,url){if(Browser.is_ie){showModal(msg,moduleID,width,height,params,url,'alert');}else{alert(msg);}}
var confirm2=function(msg,moduleID,width,height,params,url){if(moduleID=='common.confirm.friend.add'){alert2("Ä£±¸°¶·¯¸®¿¡ Ãß°¡µÇ¾ú½À´Ï´Ù.");return true;}
if(Browser.is_ie){return(showModal(msg,moduleID,width,height,params,url,'confirm'));}else{return(confirm(msg));}}
function showModal(msg,moduleID,width,height,params,url,type){if(typeof moduleID=='undefined'||!moduleID){if(type=='alert')
moduleID="common.alert";else if(type=='confirm')
moduleID="common.confirm";else
return false;}
if(!width||'undefined'==typeof(width))
var width=420;if(!height||'undefined'==typeof(height))
var height=220;if(!msg||'undefined'==typeof(msg))
var msg="¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";if(!url||'undefined'==typeof(url)){if(global_logType=='ilog'){var url=global_contextPath+"/common/ShowModal.do";}else{var url=global_contextPath+"/plog/ShowModal.do";}}
if(Browser.is_xp)
height=height+30;if(typeof params!='object')params={};var args=new Array();args["msg"]=msg;var userparamQueryString='';for(var p in params){if(p!='extend'){args[p]=params[p];if(p=='userparam'){userparamQueryString='&userparam='+params[p]}}}
if(!args["title"])args["title"]="Daum ÇÃ·¡´Ö";if(global_logType=='ilog'){var modalurl=url+"?PCPHOMEUSER="+homeUserParam+userparamQueryString+"&moduleID="+moduleID;}else{var modalurl=url+"?pid="+global_pId+"&pcode="+global_pCode+userparamQueryString+"&moduleID="+moduleID;}
return(window.showModalDialog(modalurl,args,"dialogWidth:"+width+"px; dialogHeight:"+height+"px; edge:sunken; center:yes; resizable:no; status:no; scroll:no;"));}
global_disable_select=function(){debug("global_disable_select");document.onselectstart=new Function('return false');}
global_enable_select=function(){document.onselectstart=new Function('return true');}
function global_textarea_limiter(textarea,max){if(textarea.value.length>max)textarea.value=textarea.value.substring(0,max);}
_pi=function(str){return parseInt(str);}
_ge=function(id){return document.getElementById(id);}
String.prototype.chop=function(){return this;}
function getRandomId(){return(new Date().getTime());}
function trim(s){while(s.substring(0,1)==' '){s=s.substring(1,s.length);}
while(s.substring(s.length-1,s.length)==' '){s=s.substring(0,s.length-1);}
return s;}
String.prototype.nl2br=function(){return this.split('\n').join('<br \/>\n');}
String.prototype.replace=function(find,replace){return this.split(find).join(replace);}
String.prototype.escapeForXML=function(){return this.replace('&','&amp;').replace('"','&quot;').replace('<','&lt;').replace('>','&gt;');}
String.prototype.escapeForDisplay=function(){return this.replace('<','&lt;');}
String.prototype.truncate_with_ellipses=function(chars_allowed){var t=this;if(t.length>chars_allowed-3){t=t.substr(0,chars_allowed-3)+'...'}
return t;}
function getEventSrc(e){if(e){return e.target;}
if(window.event){return window.event.srcElement;}
return null;}
function el_is_in_a_link(el){if(el.href)return 1;if(el.parentNode.href)return 1;if(el.parentNode.parentNode.href)return 1;if(el.parentNode.parentNode.parentNode.href)return 1;return 0;}
function findPosX(obj){var curleft=0;if(obj.offsetParent){while(obj.offsetParent){curleft+=obj.offsetLeft
obj=obj.offsetParent;}}
else if(obj.x)curleft+=obj.x;return curleft;}
function findPosY(obj){var curtop=0;if(obj.offsetParent){while(obj.offsetParent){curtop+=obj.offsetTop
obj=obj.offsetParent;}}
else if(obj.y)curtop+=obj.y;return curtop;}
document.getElementsByClass=function(needle,tagName){if(!tagName)tagName='*';var my_array=document.getElementsByTagName(tagName);var retvalue=new Array();var i;var j;for(i=0,j=0;i<my_array.length;i++){var c=" "+my_array[i].className+" ";if(c.indexOf(" "+needle+" ")!=-1)retvalue[j++]=my_array[i];}
return retvalue;}
hyperlink=function(txt){if(txt.indexOf('http://')>-1){var txtA=txt.split('\n');for(var y=0;y<txtA.length;y++){var subtxtA=txtA[y].split(' ');for(var t=0;t<subtxtA.length;t++){var openParen='';if(subtxtA[t].substr(0,1)=='('){subtxtA[t]=subtxtA[t].replace('(','')
openParen='(';}
if(subtxtA[t].substr(0,7)=='http://'){var url=subtxtA[t];var paren='';if(url.substr(url.length-1,1)==')'){url=url.substr(0,url.length-1);paren=')';}
var period='';if(url.substr(url.length-1,1)=='.'){url=url.substr(0,url.length-1);period='.';}
subtxtA[t]='<a href="'+url+'" target="_blank">'+url+'<\/a>'+paren+period;}
subtxtA[t]=openParen+subtxtA[t]}
txtA[y]=subtxtA.join(' ');}
txt=txtA.join('<br \/>');}
return txt;}
if(!Array.prototype.push){Array.prototype.push=function(){var i=0,b=this.length,a=arguments;for(i;i<a.length;i++)this[b+i]=a[i];return this.length;}}
if(!Array.prototype.pop){Array.prototype.pop=function(){var b=this[this.length-1];this.length--;return b;}}
function setCookie(name,value,days){var expires='';if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires='; expires='+date.toGMTString();}
document.cookie=name+'='+value+expires+'; path=/; domain=daum.net';}
function getCookie(name){var nameEQ=name+'=';var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function deleteCookie(name){setCookie(name,'',-1);}
function setCookieForGallery(name,value,days){setCookie(name,value,days);document.location.reload();}
function setCookieForGalleryWithoutReload(name,value,days){setCookie(name,value,days);}
function debug_init(init){if(typeof init!='undefined'&&init==false)
return false;var _debug=document.getElementById("debugText");if(_debug!=null)
return false;var _debug=document.createElement("div");var html='<textarea id="debugWindow" style="position:fixed;top:10px;left:40px;width:450px;height:100px;border:1px solid red;z-index:20"></textarea>';_debug.innerHTML=html;document.body.appendChild(_debug);global_debugmode=true;}
function debug(txt){var _debug=document.getElementById("debugWindow");if(_debug==null)
var _debug=document.getElementById("debugText");if(_debug==null)
return false;if(typeof txt=='undefined'||txt==null)
return false;txt=txt.toString();if(_debug)_debug.value=txt+'\n\n'+_debug.value;}
function OpenWindowWithoutReturn(p_sURL,p_sName,p_iTopMargin,p_iLefMargin,p_bScrollBars,p_bResizable,p_iWidth,p_iHeight){l_sSpecialty='topmargin='+p_iTopMargin;l_sSpecialty=l_sSpecialty+', leftmargin='+p_iLefMargin;l_sSpecialty=l_sSpecialty+', scrollbars='+p_bScrollBars;l_sSpecialty=l_sSpecialty+', resizable='+p_bResizable;l_sSpecialty=l_sSpecialty+', width='+p_iWidth;l_sSpecialty=l_sSpecialty+', height='+p_iHeight;window.open(p_sURL,p_sName,l_sSpecialty);}
function copyClipboard(url){window.clipboardData.setData('Text',url);alert('Å¬¸³º¸µå¿¡ º¹»çµÇ¾ú½À´Ï´Ù.');}
function cutStr2(str,limit){var tmpStr=str;var byte_count=0;var len=str.length;var dot="";for(i=0;i<len;i++){byte_count+=chr_byte(str.charAt(i));if(byte_count==limit-1){if(chr_byte(str.charAt(i+1))==2){tmpStr=str.substring(0,i+1);dot="...";}else{if(i+2!=len)dot="..";tmpStr=str.substring(0,i+2);}
break;}else if(byte_count==limit){if(i+1!=len)dot="..";tmpStr=str.substring(0,i+1);break;}}
tmpStr=tmpStr+dot;document.write(tmpStr);}
function msglen(contentFormElement)
{var length_limit=300;var length=calculate_msglen(contentFormElement.value);if(length>length_limit){alert2("ÃÖ´ë "+length_limit+"byteÀÌ¹Ç·Î ÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");contentFormElement.value=contentFormElement.value.replace(/\r\n$/,"");return assert_msglen(contentFormElement,length_limit);}
return length}
function calculate_msglen(message)
{var nbytes=0;for(i=0;i<message.length;i++){var ch=message.charAt(i);if(escape(ch).length>4){nbytes+=2;}else if(ch=='\n'){if(message.charAt(i-1)!='\r'){nbytes+=1;}}else if(ch=='<'||ch=='>'){nbytes+=4;}else{nbytes+=1;}}
return nbytes;}
function assert_msglen(contentFormElement,maximum){var message=contentFormElement.value;var inc=0;var nbytes=0;var msg="";var msglen=message.length;for(i=0;i<msglen;i++){var ch=message.charAt(i);if(escape(ch).length>4){inc=2;}else if(ch=='\n'){if(message.charAt(i-1)!='\r'){inc=1;}}else if(ch=='<'||ch=='>'){inc=4;}else{inc=1;}
if((nbytes+inc)>maximum){break;}
nbytes+=inc;msg+=ch;}
contentFormElement.value=msg;return nbytes;}
function b64eURL(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;do{chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+
keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<input.length);output=output.replace(/[\=]/g,"_");return output;}
function b64dURL(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[\_]/g,"=");input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}while(i<input.length);return output;}
function resize_images(){var img=document.images;for(var i=0;i<img.length;i++){if(img[i].width>600){img[i].width=600;}}}