var HTTP_URL = "http://www.yes24.com";
var HTTPS_URL = "https://www.yes24.com";
var BLOG_URL = "http://blog.yes24.com";
var IMAGE_URL = "http://image.yes24.com";

// JScript source code 
function insert_comt(){
	if (document.FRM.COMT_CONT.value.replace(/^\s+|\s+$/g,"") == '' || document.FRM.COMT_CNT.value ==  "0") {
		alert("ÅäÅ©¹éÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
		//document.FRM.COMT_CONT.focus();
	}else{
	    document.FRM.page.value = "1";
		document.FRM.TalkType.value= "Insert";
		document.FRM.submit();
	}
}

function delete_comt(iCommentSerial){
	document.FRM.TalkType.value= "Delete";
	document.FRM.TalkiSerial.value = iCommentSerial;
	document.FRM.submit();
}

function updateEdit_comt(iCommentSerial){
	document.FRM.TalkType.value= "UpdateEdit";
	document.FRM.TalkiSerial.value = iCommentSerial;
	document.FRM.submit();
}

function updateSave_comt(iCommentSerial){
	document.FRM.TalkType.value= "UpdateSave";
	document.FRM.TalkiSerial.value = iCommentSerial;
	document.FRM.submit();
}

function PopupMailSend(OriServiceGB, OriServiceID, iSerial){
	window.open("/home/chyes/SendMail/popup1_mail.asp?OriserviceGB="+OriServiceGB+"&OriServiceID="+OriServiceID+"&OriServiceIdx="+iSerial, "winFAQ10", "toolbars=no, scrollbars=no, width=380, height=400");
}


function openBlogPopup(titleSortNo, contNo){
	document.getElementById("menuLayerScrap").style.visibility="hidden";
	centerNewWinNoScroll(BLOG_URL + "/yes24/ChyesScrapPop.aspx?cont_no=" + contNo + "&title_sort_no=" + titleSortNo, "winBlog", 330, 220);
	//window.open(BLOG_URL + "/yes24/ChyesScrapPop.aspx?cont_no=" + contNo + "&title_sort_no=" + titleSortNo, "winBlog", "toolbars=no, scrollbars=no, width=330, height=180");	
}


function openClubPopup(OriServiceGB, OriServiceID, iSerial){
	window.open("/home/chyes/Scrap/popup1_Club.asp?OriserviceGB="+OriServiceGB+"&OriServiceID="+OriServiceID+"&OriServiceIdx="+iSerial, "winClub", "toolbars=no, scrollbars=no, width=370, height=365");
}

function copyContent(titleSortNo, contNo, cornerName, title, chyesPage) {
    // 2010.04.20 ÀÓµ¿Çö
    window.clipboardData.clearData();
    //debugger;
    var cornerImage = $("#cellSubImg").html();
    var strContent='';
    var content = $("#lblContent").html();
    
    var media = '';
    var tempMedia = '';
    var tempParam='';
    var tempEmbed='';
    var makedMedia = '';
	
	if($("#lblMedia").length > 0 && $("#lblMedia").html().length > 0)
    {   
		media=$("#lblMedia").html();
        tempMedia = media.split("src=");
        tempMedia= tempMedia[1].split("name"); // µ¿¿µ»óÁÖ¼Ò        
        tempParam = "<PARAM NAME='Filename' VALUE="+tempMedia[0]+">";
        tempEmbed = media.split("<embed");
        makedMedia = tempEmbed[0] + tempParam + "<PARAM NAME='AutoStart' VALUE='False'>"+"<embed" + tempEmbed[1];
    }   
        
    var tempContent = '';
    var temp = '';
    
    if(titleSortNo.length > 3)
    {   // title ³Ñ¹ö 013XXX, 012XXX, 002003, 002004, 002005  ¼Ò½º ÀüÃ¼¸¦ º¹»ç
        if(titleSortNo.substring(0,3)=='012' || titleSortNo.substring(0,3)=='013' || titleSortNo.substring(0,6)=='002003' || titleSortNo.substring(0,6)=='002004' || titleSortNo.substring(0,6)=='002005' )
        {
            tempContent = content;
        }
        else
        {
            // <BR><BR> À¸·Î ¹®´Ü ±¸ºÐÇÔ. 7¹øÂ° ±îÁö ³»¿ë Ãâ·Â.
            if(content.length > 3000)
            {
                temp = content.split("<BR><BR>",7);
                for(var i = 0; i < 7; i++)
                {
                    if(i != 6)
                        tempContent += temp[i] + "<BR><BR>";
                    else
                        tempContent += temp[i];
                }
                tempContent += " (...)";
            }
            else
            {
                tempContent = content;
            }            
        }
    }    
 
    strContent +="<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
    strContent +="<tr>";
    strContent +="<td height='32' style='padding:0 14px'><img src=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/Bl_Source.gif\" width='29' height='16' align='absmiddle' alt='ÃâÃ³'> YES24 Ã¤³Î¿¹½º<span style='font-size:11px; color:#999;'> | ";
    strContent +="<a href=\""+HTTP_URL+"/chyes/"+chyesPage+"View.aspx?title="+titleSortNo+"&cont="+contNo+"&y_contents=Ã¤³Î¿¹½º&y_channel=¿ÜºÎ½ºÅ©·¦&y_area="+contNo+"\" target='_blank'>"+HTTP_URL+"/chyes/"+chyesPage+"View.aspx?title="+titleSortNo+"&cont="+contNo+"</a></span></td>";
    strContent +="</tr>";
    strContent +="<tr>";
    strContent +="<td height='1' background=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/dotline.gif\"></td>";
    strContent +="</tr>";    
    strContent +="<tr>";
    strContent +="<td style='line-height:150%; padding:10px;'><big><b>["+cornerName+"]</b>"+title+"</big></td>"; // Á¦¸ñ ÀÚ¸®
    strContent +="</tr>";
    strContent +="<tr>";
    strContent +="<td style='text-align:center; padding: 20px 0 10px 0;'>"+makedMedia+"</td>";    // µ¿¿µ»óÀÚ¸®
    strContent +="</tr>";
    strContent +="<tr>";
    strContent +="<td style='line-height:150%; padding:10px;'>"+tempContent+"</td>";
    strContent +="</tr>";
    strContent +="<tr>";
    strContent +="<td height='1' background=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/dotline.gif\"></td>";
    strContent +="</tr>";
    strContent +="</table>";

    strContent +="<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
    strContent +="<tr>";
    strContent +="<td style='padding:0 0 0 10px;'><a href=\""+HTTP_URL+"/ChYes/"+chyesPage+"View.aspx?title="+titleSortNo+"&cont="+contNo+"&y_contents=Ã¤³Î¿¹½º&y_channel=¿ÜºÎ½ºÅ©·¦&y_area="+contNo+"\" target='_blank'>";
    strContent +="<img src=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/Btn_Original.gif\" width='61' height='22' border='0' alt='¿ø¹®º¸±â'></a>";
    strContent +="<a href=\""+HTTP_URL+"/ChYes/"+chyesPage+"List.aspx?title="+titleSortNo+"\" target='_blank'><img src=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/Btn_OtherNews.gif\" width='100' height='22' border='0' alt='´Ù¸¥±â»ç´õº¸±â'></a></td>";
    strContent +="<td align='right' style='padding:10px 14px 10px 0;'><a href=\""+HTTP_URL+"\" target='_blank'><img src=\""+IMAGE_URL+"/images/chyes_new/03_BookMedia/scrap/YesLogo.gif\" width='81' height='32' border='0' alt='YES24'></a></td>";
    strContent +="</tr>";
    strContent +="</table>";
    
    window.clipboardData.setData("Text", strContent);    
    
    alert("¼Ò½º°¡ º¹»çµÇ¾ú½À´Ï´Ù.\n html ¿¡µðÅÍ Ã¢¿¡ ºÙ¿©³Ö±â(Ctrl+V)ÇÏ¼¼¿ä.");
}

var nMouseEvent = 0;

function BlogDataScrap(e)
{
	var gstrMenuName = "menuLayerScrap";
    if (e == null) 
    {
        e = window.event;
    }
	if (document.all)
	{
		//¸Þ´º·¹ÀÌ¾îÀÇ À§Ä¡¸¦ °áÁ¤ÇÑ´Ù.
		//º¸ÅëÀº Å¬¸¯ÇÑ »óÅÂ¿¡¼­ ¾Æ·¡·Î ³»·Á°¡°í.. ÇöÀç Å¬¸¯ÇÑ À§Ä¡ + ·¹ÀÌ¾îÀÇ ±æÀÌ°¡ ÇöÀç Ã¢±æÀÌº¸´Ù ±æ¸é À§·Î ¿Ã¸°´Ù.
		if (document.body.clientHeight >= (event.y + 130))
		{
			document.getElementById(gstrMenuName).style.pixelLeft=(document.body.scrollLeft+event.x)-8;
			document.getElementById(gstrMenuName).style.pixelTop=(document.body.scrollTop+event.y)-8;
		}		
		else
		{
			document.getElementById(gstrMenuName).style.pixelLeft=(document.body.scrollLeft+event.x)-8;
			document.getElementById(gstrMenuName).style.pixelTop=(document.body.scrollTop+event.y)-160;
		}

		document.getElementById(gstrMenuName).style.visibility="visible";
	}
	else
	{
		//¸Þ´º·¹ÀÌ¾îÀÇ À§Ä¡¸¦ °áÁ¤ÇÑ´Ù.
		//º¸ÅëÀº Å¬¸¯ÇÑ »óÅÂ¿¡¼­ ¾Æ·¡·Î ³»·Á°¡°í.. ÇöÀç Å¬¸¯ÇÑ À§Ä¡ + ·¹ÀÌ¾îÀÇ ±æÀÌ°¡ ÇöÀç Ã¢±æÀÌº¸´Ù ±æ¸é À§·Î ¿Ã¸°´Ù.
		if (document.body.clientHeight >= (e.clientY + 130))
		{
			document.getElementById(gstrMenuName).style.left=(document.body.scrollLeft+e.clientX)-8;
			document.getElementById(gstrMenuName).style.top=(document.body.scrollTop+e.clientY)-8;
		}		
		else
		{
			document.getElementById(gstrMenuName).style.left=(document.body.scrollLeft+e.clientX)-8;
			document.getElementById(gstrMenuName).style.top=(document.body.scrollTop+e.clientY)-160;
		}

		document.getElementById(gstrMenuName).style.visibility="visible";
	}
}

//´ë»ó°ú Á¢¼ÓÀÚ°¡ µ¿ÀÏÇÏÁö ¾ÊÀ» °æ¿ì
	
function clearText(text){
	if(	document.FRM.COMT_CNT.value == "0"){
		document.FRM.COMT_CNT.value =  "1";		
		document.FRM.COMT_CONT.value= "";
	}
}



function MailChk()
{
	//var form = document.forms[0];
	var form = document.Form1;

	if((document.Form1.SendName.value=="" ) || (document.Form1.SendName.value.indexOf(" ") == 0 )){
		document.Form1.SendName.focus();
		alert("º¸³»´Â »ç¶÷ ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		return;
	}else if((document.Form1.SendMail.value=="" ) || (document.Form1.SendMail.value.indexOf(" ") == 0 )){
		document.Form1.SendMail.focus();
		alert("º¸³»´Â ¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		return;
	}else if(!(/^[a-zA-Z0-9\-_]+[/@][a-zA-Z0-9\-_]+[\.][a-zA-Z0-9\-_]+[\.]?[a-z]+$/.test(document.Form1.SendMail.value)) ){
		document.Form1.SendMail.focus();
		alert("º¸³»´Â »ç¶÷ ÀÌ¸ÞÀÏ ÁÖ¼ÒÇü½ÄÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
		return;
	}else if((document.Form1.ReceiveName.value=="" ) || (document.Form1.ReceiveName.value.indexOf(" ") == 0 )){
		document.Form1.ReceiveName.focus();
		alert("¹Þ´Â »ç¶÷ ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		return;
	}else if(form.ReceiveMail.value==""){
		alert("¹Þ´Â ¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		form.ReceiveMail.focus();
		return;
	}else if(!(/^[a-zA-Z0-9\-_]+[/@][a-zA-Z0-9\-_]+[\.][a-zA-Z0-9\-_]+[\.]?[a-z]+$/.test(form.ReceiveMail.value)) ){
		form.ReceiveMail.focus();
		alert("¹Þ´Â »ç¶÷ ÀÌ¸ÞÀÏ ÁÖ¼ÒÇü½ÄÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
		return;
	}else if(form.Contents.value==""){
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		form.Contents.focus();
		return;
	}else{
		form.Mode.value ="SEND";
		//document.Form1.action="http://momo.yes24.com/home/chyes/SendMail/MailToMail.asp";
		document.Form1.submit();
		//return true;
	}
}

function CheckCTS()
{
	var form = document.Form1;
	form.SendType[1].checked = false;
}

function CheckURL()
{
	var form = document.Form1;
	form.SendType[0].checked = false;
}

//¸¶ÀÌ¸®½ºÆ® ³Ö±â
function GO_MyList(goods_no){
	document.FTCategoryMain.action ="/Order/FTMyListReg.aspx?AllGoodsNo="+goods_no+"&AuctionTp=MYLIST";
	document.FTCategoryMain.submit();
}

//Ä«Æ®¿¡ ³Ö±â
function GO_Cart(goods_no){
	document.FTCategoryMain.action ="/Order/FTCartReg.aspx?AllGoodsNo="+goods_no;
	document.FTCategoryMain.submit();
}


function alertLogin(strPath, contNo, titleNo){
	document.location = HTTPS_URL + "/Templates/FTLogin.aspx?ReturnURL=" + strPath + "&ReturnParams=cont=" + contNo + "`title=" + titleNo;
}

