//function w3cMovie(fileName,width,height,autoStart){
//  document.write("<embed id='WinMedia' src='"+fileName+"' width='"+width+"' height='"+height+"' autostart='"+autoStart+"'></embed>");
//}
function w3cMovie(fileName,width,height,autoStart){
//  document.write('<object id="LIVEXPLAY1" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://actiivex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="'+width+'" height="'+height+'">');
//  document.write('  <param name="autostart" value="'+autoStart+'">');
//  document.write('  <param name="filename" value="'+fileName+'">');
//  document.write('</object>');
  document.write('<embed src="'+fileName+'" width="'+width+'" height="'+height+'" autostart="'+autoStart+'"></embed>');
}
function w3cFlash(furl,fwidth,fheight,transoption,fname){
  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+fwidth+'" height="'+fheight+'" id="'+fname+'" align="middle">');
  document.write('<param name="movie" value="'+furl+'"/><param name="allowScriptAccess" value="always">');
  /*
  if(transoption=="t"){
    document.write('<param name="wmode" value="transparent"/>');
  }else if(transoption=="o"){
    document.write('<param name="wmode" value="opaque"/>');
  }*/
  
  /* 플래쉬 기본 세팅을 레이어가 겹침이 가능하도록 변경함 */
  document.write('<param name="wmode" value="opaque"/>');
  
  document.write('<!-- Hixie method -->');
  document.write('<!--[if !IE]> <-->');
  document.write('<object type="application/x-shockwave-flash" data="'+furl+'" width="'+fwidth+'" height="'+fheight+'" id="'+fname+'"');
  if(transoption=="t"){
    document.write(' wmode="transparent"');
  }else if(transoption=="o"){
    document.write(' wmode="opaque"');
  }
  document.write(' wmode="transparent"');
  document.write('></object>');
  document.write('<!--> <![endif]-->');
  document.write('</object>');
}
function w3cFlash2(furl,fwidth,fheight,transoption,fname){
  var obj='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+fwidth+'" height="'+fheight+'" id="'+fname+'" align="middle">';
  obj+='<param name="movie" value="'+furl+'"/><param name="allowScriptAccess" value="always">';
  if(transoption=="t"){
    obj+='<param name="wmode" value="transparent"/>';
  }else if(transoption=="o"){
    obj+='<param name="wmode" value="opaque"/>';
  }
  obj+='<!-- Hixie method -->';
  obj+='<!--[if !IE]> <-->';
  obj+='<object type="application/x-shockwave-flash" data="'+furl+'" width="'+fwidth+'" height="'+fheight+'" id="'+fname+'"';
  if(transoption=="t"){
    obj+=' wmode="transparent"';
  }else if(transoption=="o"){
    obj+=' wmode="opaque"';
  }
  obj+='></object>';
  obj+='<!--> <![endif]-->';
  obj+='</object>';

  return obj;
}
function iframeAutoresize(arg){
  try{
    arg.height=eval(arg.name+".document.body.scrollHeight");
    if(arg.height==0){
      location.reload();
    }
  }catch(e){
  }
}
var newWin;
function popupOpen(url,name,w,h,r,s){
  var l=(screen.width-w)/2;
  var t=(screen.height-h)/2;
  w=eval(w);
  h=eval(h);
  if(newWin)newWin.close();
  newWin=window.open(url,name,"titlebar=0, resizable="+r+", scrollbars="+s+", width="+w+", height="+h+", top="+t+", left="+l);
}
function image_window(img){
  popupOpen('/util/common/imgView.htm?img='+img.src,'imgview','20','20','no','yes');
}

// HTML 濡� �섏뼱�� <img ... > �쒓렇�� ��씠 �뚯씠釉뷀룺蹂대떎 �щ떎硫� �뚯씠釉뷀룺�� �곸슜�쒕떎.
function resizeBoardImage(imageWidth,borderColor){
  var target=document.getElementsByName('target_resize_image[]');
  var imageHeight=0;

  if(target){
    for(i=0;i<target.length;i++){
      // �먮옒 �ъ씠利덈� ��옣�� �볥뒗��
      target[i].tmp_width  = target[i].width;
      target[i].tmp_height = target[i].height;
      // �대�吏� ��씠 �뚯씠釉� ��낫�� �щ떎硫� �뚯씠釉뷀룺�� 留욎텣��
      if(target[i].width>imageWidth){
        imageHeight=parseFloat(target[i].width/target[i].height)
        target[i].width=imageWidth;
        target[i].height=parseInt(imageWidth/imageHeight);
        target[i].style.cursor='pointer';

        // �ㅽ��쇱뿉 �곸슜�� �대�吏�쓽 ��낵 �믪씠瑜� ��젣�쒕떎
        target[i].style.width='';
        target[i].style.height='';
      }

      if(borderColor){
        target[i].style.borderWidth='1px';
        target[i].style.borderStyle='solid';
        target[i].style.borderColor=borderColor;
      }
    }
  }
}
//xhtml form �덉뿉 type=button onclick �먮윭 愿�젴
function back(cnt){
  history.go(cnt);
}
function goBack(){
  if(self.opener)self.close();
  else history.go(-1);
}
function wresttrim(str){
  var pattern = /(^\s*)|(\s*$)/g;
  str=str.replace(pattern,"");
  return str;
}
function imgview(idname){
  img_pre=idname;
  if(event.srcElement.value.match(/(.jpg|.jpeg|.gif|.png|.JPG|.JPEG|.GIF|.PNG)/)){
    document.images[img_pre].src=event.srcElement.value;
    document.images[img_pre].style.display='';
  }else{
    document.images[img_pre].style.display='none';
  }
}
function updateChar(form,length_limit,innerText_show){
  var length=form.value.length;
  if(innerText_show==1){
    textlimit.innerText=length;
  }
  if(length>length_limit){
    alert(length_limit+"臾몄옄 �댄븯濡� �낅젰�� 二쇱꽭��.");
    form.value=form.value.replace(/\r\n$/,"");
    form.value=assert_msglen(form.value, length_limit, innerText_show);
  }
}
function assert_msglen(message,maximum,innerText_show){
  var inc=0;
  var nbytes=0;
  var msg="";
  var msglen=message.length;
  for(i=0;i<msglen;i++){
    var ch=message.charAt(i);

    inc=1;

    if((nbytes+inc)>maximum){
      break;
    }
    nbytes+=inc;
    msg+=ch;
  }
  if(innerText_show==1){
    textlimit.innerText=nbytes;
  }
  return msg;
}
function isRadioCheck(radioName){
  for (var i=0; i<radioName.length; i++){
    if (radioName[i].checked)return true;
  }       
  return false;
}
function allprocess(f,pname){
  len=f.elements.length;
  count=0;

  for(i=0;i<len;i++){
    if(f.elements[i].name=="index"&&f.elements[i].checked==true)
      count++;
  }
  if(count<=0){
    alert("�섎굹 �댁긽 �좏깮�댁＜�몄슂.");
    return;
  }
  ret='';
  for(i=0;i<len;i++){
    if(f.elements[i].name=="index"&&f.elements[i].checked==true){
      if(ret==''){
        ret=f.elements[i].value;
      }else{
        ret+=','+f.elements[i].value;
      }
    }
  }
  if(pname){
    if(confirm(pname+" �⑸땲源�?")==false)return;
  }
  f.indexar.value=ret;
  f.submit();
}
function togglebox(f){
  flag=f.togglecode.value;
  len=f.elements.length;
  for(i=0;i<len;i++){
    if(f.elements[i].name=="index"){
      if(flag==1)
        f.elements[i].checked=true;
      else
        f.elements[i].checked=false;
    }
  }
  if(flag==1)f.togglecode.value=2;
  else if(flag==2)f.togglecode.value=1;
}
function asclen(s){
  var i,len=0;
  for(i=0;i<s.length;i++)(s.charCodeAt(i)>255)?len+=2:len++;
  return len;
}
function hne_check(text){
  var regexp=/[^\u0030-\u0039\u0041-\u005a\u0061-\u007a\uac00-\ud7af]/; 
  var result=!regexp.test(text); 
  return result; 
}
function addSel(max_count,objName){
  var show_count=0;
  if(!objName)var objName='addSel';
  if(!max_count)var max_count=3;
  for(var i=1;i<max_count;i++){
    divName=objName+i;
    if(document.getElementById(divName).style.display=="")show_count++;
  }

  var this_count=parseInt(show_count+1);  

  if(this_count>=max_count){
    alert(max_count+"媛쒓퉴吏�쭔 異붽� �좎닔 �덉뒿�덈떎.");
    return;
  }else{
    divName=objName+this_count;
    document.getElementById(divName).style.display="";
  }
}
function formatNumber(numStr,decimals){
  var numStr=numStr.toString();
  var c=isNaN(decimals = Math.abs(decimals)) ? ( numStr.indexOf(".") == -1 ) ? 0 : numStr.split('.')[1].length : decimals;
  var d="." , t = ",";
  var s=numStr < 0 ? "-" : "";
  var i=parseInt(numStr = Math.abs(+numStr || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
  return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(numStr - i).toFixed(c).slice(2) : "");
}
function delComma(str){
  var str2="";
  str2=str.replace(/,/g,"");
  return str2;
}
function ceilling(val,precision){
  return Math.ceil(val*Math.pow(10,precision))/Math.pow(10,precision);
}
function onlyNumeric(obj){
  var str=parseInt(obj.value.replace(/[^0-9]/g,''));
  if(str)obj.value=str;
  else obj.value="";
}
function onlyNumeric2(obj){
  var str=obj.value.replace(/[^0-9]/g,'');
  if(str)obj.value=str;
  else obj.value="";
}
Array.prototype.keys=function(){ //諛곗뿴�� �ㅺ컪�� 諛섑솚 php array_keys();
  var Result=new Array();
  var j=0;
  for(var i in this){
    if(typeof(this[i])!="function"){
      Result[j]=i;
      j++;
    }
  }
  return Result;
}
Array.prototype.values=function(){ //諛곗뿴�� value瑜� 諛섑솚
  var Result=new Array();
  var j=0;
  for(var i in this){
    Result+=(typeof(this[i])=="function")?"":this[i]+"\n";
    if(typeof(this[i])!="function"){
      Result[j]=this[i];
      j++;
    }
  }
  return Result;
}

//xss cross site script 遊됱뇙
var curPageXSS = window.location.search;
if(curPageXSS.indexOf("script") != -1 || curPageXSS.indexOf("<") != -1 || curPageXSS.indexOf("\'") != -1  ) {
    window.top.location.replace("http://www.highcut.com");
}

function dontMouseRight(e){
  evt=e||event;
  try{
    if(document.all){
      if(evt.button==2||evt.button==3){
        ignoreEvent(evt);
        return false;
      }
    }else{
      if(evt.which==3||evt.which==2){
        ignoreEvent(evt);
        return false;
      }
    }
  }catch(ex){
    return false;
  }
}

function ignoreEvent(evt){
  if(window.event){
    window.event.keyCode=0;
    window.event.cancelBubble=true;
    window.event.returnValue=true;
  }else{
    evt.stopPropagation();
    evt.preventDefault();
    evt.initEvent;
  }
  return false;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_showHidemms() { //v6.0
  var i,p,v,obj,args=MM_showHidemms.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.mms&&i<d.mms.length;i++) x=MM_findObj(n,d.mms[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function bluring(){
  if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

/** 플래쉬 투명 출력 **/
function printFlash(url, width, height){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">');
	document.write('<param name="movie" value="'+url+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="bgcolor" value="000000" />');
	document.write('<param name="base" value=".">');
	document.write('<embed src="'+url+'" quality="high" WIDTH="'+width+'" HEIGHT="'+height+'" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" wmode="transparent"/>');
	document.write('</object>');
}

/** 함수 추가 090615 채수임 **/
function logoutWrite(){
	if (confirm("로그인 후 이용하실 수 있습니다. 로그인 하시겠습니까?") == true){
		document.location.href="https://www.highcut.co.kr/bbs/login.php?url="+document.location.href;
	} 
}

//댓글 로그인시 글로 안가는 버그 수정 
function logoutWrite2(wr_id, url){
	if (confirm("로그인 후 이용하실 수 있습니다. 로그인 하시겠습니까?") == true){
		document.location.href="https://www.highcut.co.kr/bbs/login.php?wr_id="+wr_id+"&url="+url;
	} 
}

/** 글 퍼가기 **/
function getContent(){
	var url = document.location.href;
	var content_ = document.getElementById("content_box").innerHTML;

	content_ = content_.replace("<IMG ", "<IMG border=\"0\" ");

	var getText = "<a href='"+url+"'>"+content_+"</a>";

	window.clipboardData.setData("text", getText);
	window.alert("내용이 복사되었습니다. Ctrl + V 로 붙여넣기 하세요");
}

// 메뉴 마우스 오버시 이미지 변경
function menuOverlap(obj, img_src){
	obj.src = img_src;
}

//페이지 이동
function pageMove(url, msg){
	if (msg){
		window.alert(msg);
	}

	document.location.href = url;
}

//시작 페이지
function set_start(){
	document.body.style.behavior="url(#default#homepage)";
	document.body.setHomePage("http://www.highcut.co.kr");
}

//즐겨찾기
function addFavorite(){
	window.external.AddFavorite("http://www.highcut.co.kr", "하이컷, 스타&스타일 커뮤니티 <HIGH CUT>");
}