//로그아웃하기
function Logout() {
	document.exefield.location.href='/login/act_logout.php';
}
//로그아웃하기
function mainLogout() {
	document.location.href='/bbs2/bbs/logout.php';
}
//로그인팝업창
function login_pop(url,target){
	window.open('/bbs2/bbs/login_pop.php?url='+url,target,'width=600,height=320,scrollbars=no');
}

//코디로그인팝업창
function login_pop_codi(url,sca,wr_id,target){
	window.open('/bbs2/bbs/login_pop.php?url='+url+'&sca='+sca+'&wr_id='+wr_id,target,'width=600,height=320,scrollbars=no');
}

//관심담기
function favorate(ms_id,mb_id,url,homepage) {
	document.exefield.location.href='/cart/addscrab.php?ms_id='+ms_id+'&mb_id='+mb_id+'&url='+url+'&homepage='+homepage;
}


//관심담기팝업페이지열기
function addscrap() {
        url = g4_path + "/" + g4_bbs + "/member_scrab_search.php";
        //alert(url);
		win_open(url, "winHomepage", "left=50,top=50,width=616,height=460,scrollbars=1");
}


//평가하기
function rating(ms_id,mb_id,url,homepage) {
	//document.exefield.location.href='/cart/addscrab.php?ms_id='+ms_id+'&mb_id='+mb_id+'&url='+url+'&homepage='+homepage;
}


//쿠폰다운
function down_coupon(ms_id,mb_id,url,homepage) {
	//document.exefield.location.href='/cart/addscrab.php?ms_id='+ms_id+'&mb_id='+mb_id+'&url='+url+'&homepage='+homepage;
}



//제휴문의
function Search_Pop_id(id){
	All_chk = "on";
	var Chk_search = document.getElementById(id);
	

	if(Chk_search.style.display != 'block'){
		Chk_search.style.display = "block";
	} else {
		Chk_search.style.display = "none";
	} 
}

//팝레이어

function item_comments(e,val) {
	var Layers = document.getElementById("choicerems");
	var comment;
	comment = val;
	//if(val2){
	//	Layers.innerHTML= comment;// + "<p><font color=24BCE8>"+val3+"</font></br><b><font color=000000>" + val2+"</font>";
	//}else{
		Layers.innerHTML= comment;
	//}
	Layers.style.top=e.clientY+document.body.scrollTop+10+'px';//TrueBody().scrollTop+
	Layers.style.left=1*e.clientX+10+'px';//scrollLeft+
	Layers.style.visibility="visible";		
}

function item_comments1(e,val) {
	var Layers = document.getElementById("choicerems1");
	var comment;
	comment = val;
	//if(val2){
	//	Layers.innerHTML= comment;// + "<p><font color=24BCE8>"+val3+"</font></br><b><font color=000000>" + val2+"</font>";
	//}else{
		Layers.innerHTML= comment;
	//}
	Layers.style.top=e.clientY+document.body.scrollTop+-34+'px';//TrueBody().scrollTop+
	Layers.style.left=1*e.clientX+10+'px';//scrollLeft+
	Layers.style.visibility="visible";		
}

 

function search_item_comments(e,val,width) {
	var Layers = document.getElementById("choicerems");
	Layers.innerHTML= val;
	Layers.style.top=e.clientY+document.body.scrollTop+10+'px';
	Layers.style.left=1*e.clientX-width+'px';//scrollLeft+
	//Layers.style.bottom=1*e.clientX+10+'px';//scrollLeft+
	Layers.style.right=1*e.clientX+200+'px';//scrollLeft+
	Layers.style.visibility="visible";		
}

function search_item_comments_right(e,val,width) {
	var Layers = document.getElementById("choicerems");
	var comment;
	comment = val;
	Layers.innerHTML= comment;
	Layers.style.top=e.clientY+document.body.scrollTop+'px';
	Layers.style.left=1*e.clientX+30+'px';//scrollLeft+
	//Layers.style.bottom=1*e.clientX+10+'px';//scrollLeft+
	Layers.style.right=1*e.clientX+width+'px';//scrollLeft+
	Layers.style.visibility="visible";		
}

function coupon_item_comments(e,val,val2) {
	var Layers = document.getElementById("choicerems");
	var comment;
	comment = val;
	//if(val2){
	//	Layers.innerHTML= comment;// + +val3+"</font>;
	//}else{
		Layers.innerHTML= "<font color=24BCE8>"+comment+"</font></br><b><font color=000000>" + val2+"</font>";
	//}
	Layers.style.top=e.clientY+document.body.scrollTop+10+'px';//TrueBody().scrollTop+
	Layers.style.left=1*e.clientX+10+'px';//scrollLeft+
	Layers.style.visibility="visible";
		
}
function item_close(e) {
	var Layers = document.getElementById("choicerems");
	Layers.style.visibility="hidden";
}
function item_close1(e) {
	var Layers = document.getElementById("choicerems1");
	Layers.style.visibility="hidden";
}
 


//검색
function do_search(thisform) {
	if (thisform.searchquery.value == '') {
		alert('검색어를 입력해주세요.'); return;
	}else if (thisform.searchquery.length < 1) {
		alert('질의어가 너무 짧습니다.'); return;
	}else{
		thisform.action = 'http://www.fashiondir.co.kr/search/search.html';
		thisform.submit();
	}
}


				/*
				' ------------------------------------------------------------------
				' Function    : fc_chk_byte(aro_name)
				' Description : 입력한 글자수를 체크
				' Argument    : Object Name(글자수를 제한할 컨트롤)
				' Return      : 
				' ------------------------------------------------------------------
				*/
				function fc_chk_byte(aro_name,ari_max)
				{
				   var ls_str     = aro_name.value; // 이벤트가 일어난 컨트롤의 value 값
				   var li_str_len = ls_str.length;  // 전체길이

				   // 변수초기화
				   var li_max      = ari_max; // 제한할 글자수 크기
				   var i           = 0;  // for문에 사용
				   var li_byte     = 0;  // 한글일경우는 2 그밗에는 1을 더함
				   var li_len      = 0;  // substring하기 위해서 사용
				   var ls_one_char = ""; // 한글자씩 검사한다
				   var ls_str2     = ""; // 글자수를 초과하면 제한할수 글자전까지만 보여준다.

				   for(i=0; i< li_str_len; i++)
				   {
					  // 한글자추출
					  ls_one_char = ls_str.charAt(i);

					  // 한글이면 2를 더한다.
					  if (escape(ls_one_char).length > 4)
					  {
						 li_byte += 2;
					  }
					  // 그밗의 경우는 1을 더한다.
					  else
					  {
						 li_byte++;
					  }

					  // 전체 크기가 li_max를 넘지않으면
					  if(li_byte <= li_max)
					  {
						 li_len = i + 1;
					  }
				   }

				   //화면에 지금 바이트수 출력
				   //document.getElementById('comment_byte').innerHTML = '<span>' + li_byte + '</span>';

				   // 전체길이를 초과하면
				   if(li_byte > li_max)
				   {
					  alert( li_max + " byte를 초과 입력할수 없습니다. \n 초과된 내용은 자동으로 삭제 됩니다. ");
					  ls_str2 = ls_str.substr(0, li_len);
					  aro_name.value = ls_str2;
					  
				   }
				   aro_name.focus();   
				}

				/*
				' ------------------------------------------------------------------
				' Function    : fc_chk2()
				' Description : Enter키를 못치게한다.
				' Argument    : 
				' Return      : 
				' ------------------------------------------------------------------
				*/
				function fc_chk2()
				{
				   //if(event.keyCode == 13)
					//  event.returnValue=false;
				}




function modify_meminfo(){
	var f= document.fregisterform;
	f.action="/mydir/register_form_update.php";
	f.target="exefield";
	f.submit();
}

function modify_meminfo_company(f){
	
	f.action="/mydir/register_form_company_update.php";
	f.target="exefield";
	f.submit();
}


/*파일체크*/
   function getFileSize(filePath)
    {
        var len = 0;
        
        if ( navigator.appName.indexOf("Netscape") != -1) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
            } catch(e) {
                alert("signed.applets.codebase_principal_support를 설정해주세요!\n"+e);
                return -1;
            }
            try {
                var file = Components.classes["@mozilla.org/file/local;1"]
                                     .createInstance(Components.interfaces.nsILocalFile);
                file.initWithPath ( filePath );
                
                len = file.fileSize;
            } catch(e) {
                alert("에러 발생:"+e);
            }
        } else if (navigator.appName.indexOf('Microsoft') != -1) {
            var img = new Image();
            img.dynsrc = filePath;
            len = img.fileSize;
        }
        return len;
    }

function checkbyte(file,id){
	var len = getFileSize(file.value);
	if (len > 500 * 1024) {
		alert("파일 크기는 500KByte보다 작아야 합니다.");
		file.select();
		document.selection.clear();
		return false;
	}
	
   var extention = file.value.split(".");
   var ext = extention[1].toLowerCase();
   if(ext != "gif" && ext != "jpg")
   {
		alert(" gif,와 jpg만 가능합니다");
		file.select();
		document.selection.clear();
		return false;
   }

   var img = new Image();
   img.dynsrc = file;
   len = img.fileSize;
	

}


//팝업
function swinPop(u,n,w,h,s){	
LeftPosition=(screen.width-w)/2;
TopPosition=(screen.height-h)/2;
    var g_pop = window.open(u,n,'menubar=0,toolbar=0,location=0,directories=0,resizable=0,scrollbars='+s+',status=0,width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition);
	g_pop.focus();
}



//검색상세순위,순위메뉴
function stylechange(){var f = document.getElementById("rankingtotal");f.style.background = "ffc";}
function stylechange1(){var g = document.getElementById("rankingtotal");g.style.background = "ccc";}
function bigfont(){var h = document.getElementById("stylearr");h.style.background = "ffcf48";h.style.color = "ffffff";}
function bigfont1(){var i = document.getElementById("stylearr1");i.style.background = "95ddff";i.style.color = "ffffff";}
function bigfont_out(){var h = document.getElementById("stylearr");h.style.background = "ffffff";h.style.color = "cc0000";}
function bigfont1_out(){var i = document.getElementById("stylearr1");i.style.background = "ffffff";i.style.color = "cc0000";}
