﻿
// 플래쉬 관련
function flashView(_url, wsize, hsize, wmode){ 
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width='+wsize+' height='+hsize+' VIEWASTEXT ID="Object1">');
    document.write('<param name="movie" value='+_url+' />');
    document.write('<param name="quality" value="high">');
    document.write('<param name="wmode" value='+wmode+'>'); 
    document.write('<param name="z-index" value=-1>');
    document.write('<embed src='+_url+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+wsize+' height='+hsize+'></embed>');
    document.write('</object>');
} 


function mainlink(cd_shop) {
    if (cd_shop == 'naver') {
     document.write('<form method=post name=frm_naver action=/index_main.asp target=_self>');
     //document.write('<input type=text name=url value="" size=100>');
     //document.write('<input type=submit>');
     document.write('</form>'); 
     
     document.frm_naver.submit();
        
    } else {
         document.write('<form method=post name=frm_naver action=/index_main.asp target=_self>');
         //document.write('<input type=text name=url value="" size=100>');
         //document.write('<input type=submit>');
         document.write('</form>'); 
         
         document.frm_naver.submit();
    }
}







// 마우스 오버시 상품 아이콘
/**
* 
* @param	chr_case
* @param	product_code
*/
function product_icon_write(chr_case, gubun, product_code, size, mdtext, color) {
	var iconCommentTag = "";
	
	var imgsize = size;
	var qleft = imgsize-87;
	var qtop = imgsize-17;
	
	//아이콘을 넣자
	iconCommentTag +="<div id='" + gubun + "_" + product_code + "' style='display:none; POSITION:absolute; top:"+ qtop +"px; left:"+ qleft +"px; text-align:center; border:0px solid red;' >";
	iconCommentTag +="<a href='#'><img src='/images/view_btn.png' onclick='QuickViewOpen(" + '"' + product_code + '"' + ", event); return false;' border='0'></a>";
	iconCommentTag +="</div>";
	
	
	if(mdtext != "") {
	    //MDText를 넣자
	    iconCommentTag +="<div id='Brd" + gubun + "_" + product_code + "' style='background-image:url(/images/name.png); padding-top:6px; display:none; POSITION:absolute; width:"+ imgsize +"px; height:39px; top:0px; left:1px; text-align:center; border:5px solid "+ color +";' >";
	    iconCommentTag +="<span class=\"item_05k\">"+ mdtext +"</span>";
	    iconCommentTag +="</div>";
	}
	
	document.write(iconCommentTag); 
}


/**
* 
* @param	chr_case
* @param	product_code
*/
function product_icon(chr_case, gubun, product_code) {
	obj_product_code = document.getElementById(gubun + "_" +product_code);
	obj_brd_code = document.getElementById("Brd"+ gubun + "_" + product_code);
	
	if(chr_case=="01") {
		obj_product_code.style.display = 'block';
		if(obj_brd_code != null) {
    		obj_brd_code.style.display = 'block';
		}
	} else if(chr_case == "04") {
		obj_product_code.style.display = 'none';
		if(obj_brd_code != null) {
		    obj_brd_code.style.display = 'none';
		}
	}
}


function QuickViewOpen(prdcode, e) {

    ProductInfo("quickView", prdcode);

	var x = (e.pageX) ? e.pageX : document.documentElement.scrollLeft+event.clientX; 
	var y = (e.pageY) ? e.pageY : document.body.scrollTop+event.clientY; 
    var w = document.body.clientWidth / 2;

	y -= 500;
    w -= 319;
	
	x = w;

	document.getElementById("quickView").style.position = "absolute";
	document.getElementById("quickView").style.zIndex = "9999";
	document.getElementById("quickView").style.display = "block";
	document.getElementById("quickView").style.top = y;
	document.getElementById("quickView").style.left = x;
}

function QuickViewClose() {
    document.getElementById("quickView").style.display = "none";
}



// Quick View 관련
/* 상품 간략보기 */
function ProductInfo(divObj, code) {
    $(divObj).innerHTML = ProductLoading();

    new Ajax.Request("/Shop/QuickView.aspx", {
        method: 'get', 
        
        parameters: { prdcode : code },
        
        onComplete: function (req) {
                var prdinfo = showResponse(req);
                
                prdinfo = prdinfo.replace("<form name=\"quickForm\" method=\"post\" action=\"QuickView.aspx?prdcode="+ code +"\" id=\"quickForm\">", "");
                prdinfo = prdinfo.replace("</form>", "");
                //alert(prdinfo);
                $(divObj).innerHTML = prdinfo;
        }
    })
}

function showResponse(req) {
    return req.responseText;
}

function ProductLoading() {
    var str = "";
    
    str += "<div style=\"position:absolute; top:250px; left:250px; background-color:White; border:solid 1px gray;\"><table><tr><td>";
    str += "<img src=\"/images/waiting.gif\" /></td><td style=\"font-size:16px; font-weight:bold;\">자료 불러오는 중입니다.</td>";
    str += "</tr></table></div>";
    
    return str;
}




function CommonPrdQtyChange(obj, bprice, cprice) {
    var qty = obj.value;
    var bestPrice = bprice;
    var charge = cprice;
    var totPrice = 0;
    
    totPrice = bestPrice * qty;

    if(totPrice >= charge) {
        if(document.getElementById("DeliveryPayCode").value != "510201") {
            document.getElementById("DeliveryPayCode").options[0].selected = true;
        }
        
        document.getElementById("DeliveryPayText").innerHTML = "무료";
        document.getElementById("DeliveryPayComText").innerHTML = "";
        document.getElementById("DeliveryPayCode").style.display = "none";
        
        document.getElementById("deliveryText").style.display = "none";
        document.getElementById("deliveryTextOther").style.display = "block";
        document.getElementById("deliveryTextOther").innerHTML = "무료";
    }
    else {
    
        if(document.getElementById("DeliveryPayCode").value == "510102")
            document.getElementById("DeliveryPayText").innerHTML = "선불";
        if(document.getElementById("DeliveryPayCode").value == "510103")
            document.getElementById("DeliveryPayText").innerHTML = "착불";
    
        document.getElementById("DeliveryPayCode").style.display = "none";
        
        document.getElementById("deliveryText").style.display = "block";
        document.getElementById("DeliveryPayComText").style.display = "none";
        document.getElementById("deliveryTextOther").style.display = "none";
    }
}

function CheckQuickVewForm(prdCode, gubun) {
    //배송비 결제 체크
    var DeliveryPayCode = document.all["DeliveryPayCode"];
    var DeliveryPayCodeValue = "";
    
    if(DeliveryPayCode.value.trim() == ""){
        alert("배송비 결제 여부를 선택해주세요.");
        document.getElementById("DeliveryPayCode").focus();
        return false;
    }
    else {
        DeliveryPayCodeValue = DeliveryPayCode.value.trim();
    }
    
    //색상/사이즈
    var PrdOption = document.all["PrdOption"];
    var PrdOptionValue = "";
    
    if(PrdOption.value.trim() == ""){
        alert("색상/사이즈를 선택해주세요.");
        document.getElementById("PrdOption").focus();
        return false;
    }
    else {
        PrdOptionValue = PrdOption.value.trim();
    }
    
    //수량 체크
    var Qty = document.all["MaxQty"];
    var QtyValue = "";
        
    if(Qty.value.trim() == ""){
        alert("수량을 선택해주세요.");
        document.getElementById("MaxQty").focus();
        return false;
    }
    else {
        QtyValue = Qty.value.trim();
    }
    
    FrmQuickview.location.href = "/Shop/QuickViewIns.aspx?prdcode=" + prdCode + "&chk=" + gubun + "&paycode=" + DeliveryPayCodeValue + "&option=" + PrdOptionValue + "&qty=" + QtyValue;
}

function AddWishList(prdCode, gubun) {
    FrmQuickview.location.href = "/Shop/QuickViewIns.aspx?prdcode=" + prdCode + "&chk=" + gubun;
}





// JScript 파일

// 팝업창 가운데로 띄우기(팝업창페이지주소,창가로크기,창세로크기,창타이틀)
function OpenWindowCenter(url,x,y,Title){
    cw=screen.availWidth; //화면 너비
    ch=screen.availHeight; //화면 높이 
    sw=x;//띄울 창의 너비
    sh=y;//띄울 창의 높이
    ml=(cw-sw)/2;//가운데 띄우기위한 창의 x위치
    mt=(ch-sh)/2;//가운데 띄우기위한 창의 y위치

    var strURL = url;
    window.open(strURL,Title,'width='+sw+',height='+sh+',top='+mt+',left='+ml+',status=no,scrollbars=yes')
}

// 팝업창 위치 아무데나 (주소, 가로, 세로, 이름)
function OpenWindow(url,x,y,Title){
	window.open(url, Title ,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+x+',height='+y)
}

// 스크롤바 사용
function openWindow4(url,PopName, height,width, left, top){
	var popobj = window.open(url, PopName ,'resizable=no,toolbar=no,left='+left+',top='+top+',scrollbars=yes,directories=no,menubar=no,width='+width+',height='+height)
	popobj.focus();
}


function checkAlphaNum(obj,msg){
	// 영문, 숫자만 입력
	re=/[^A-Za-z0-9]/
	if(re.test(obj.value))
    {   
		alert(msg + '는 영문,숫자만 입력 가능 합니다');
		obj.value = "";
		obj.focus();
		return false;
	}

	return true;
}


// 주민등록 번호 체크 XXXXXX-XXXXXXX 형식
function ChkRegNum(formObj1, formObj2){

    var strtxt1 = formObj1.value; //첫번째 필드
    var strtxt2 = formObj2.value; //두번째 필드

    var chk = 0;
    var yy = strtxt1.substring(0, 2); //출생년도 추출
    var mm = strtxt1.substring(2, 4); //출생월 추출
    var dd = strtxt1.substring(4, 6); //출생일 추출
    var sex = strtxt2.substring(0, 1); //성별 추출

    //첫 번째필드가 6자리가 아니거나 출생월일이 날짜 형식에 위배될때
    if((strtxt1.length != 6) || (mm < 1 || mm > 12 || dd < 1 || dd > 31)){
        strtxt1 = '';
        alert('주민번호 첫번째자리 형식이 잘못 되었습니다.');
        formObj1.focus();
        return false;
    }

    //성별형식이 틀리거나 두 번째 필드가 7자리가 아닐때
    if((sex < 1 && sex > 4 ) || (strtxt2.length != 7 )){
        strtxt2 = '';
        alert('주민번호 두번째자리 형식이 잘못 되었습니다.');
        formObj2.focus();
        return false;
    }

    //주민등록번호 체크에 관한
    for(i = 0; i <= 5; i++)
        chk=chk+((i%8+2)*parseInt(strtxt1.substring(i, i+1)));

    for(i = 6; i <= 11; i++)
        chk=chk+((i%8+2)*parseInt(strtxt2.substring(i-6, i-5)));

    chk = (11-(chk%11))%10;
    if(chk != strtxt2.substring(6, 7)){
        strtxt1 = '';
        strtxt2 = '';
        alert('주민번호 형식이 잘못 되었습니다.');
        formObj1.focus();
        return false;
    }
    return true;
}


//숫자여부 확인
function ChkNum(formObj) { 
    var flag=true; 
    if (formObj.length > 0 && formObj != null) {
        for (j = 0; j < formObj.length; j++) {  
            if (formObj.charAt(j) < '0' || formObj.charAt (j) > '9') { 
                flag = false;
            } 
        }
    }else{
        flag = false;
    }
    return flag; 
}

// 콤마 찍기
function commify(n) {
  var reg = /(^[+-]?\d+)(\d{3})/;   // 정규식
  n += '';                          // 숫자를 문자열로 변환

  while (reg.test(n))
    n = n.replace(reg, '$1' + ',' + '$2');

  return n;
}

// 콤마 없애기
function unComma(str) {
	return str.replace(/,/g,"");
}

// 특수문자 체크
function isSpecialChar(val) {
    var chars = '!,*&^%$#@~;=+|\\`:"\'?/.';
    return containsChars2(val, chars);
}


//-- 공백체크질 
function spaceCheck(val) {
   
   var chkVar = val.split(' '); 
   return chkVar.length > 1 ? true : false;
   
}

// 문자 체크
function containsChars2(val, chars) {
    var cnt = 0;
	for (var inx = 0; inx < val.length; inx++) {
		if (chars.indexOf(val.charAt(inx)) > -1)
			cnt++;
	}
	
	if (cnt > 0) {
	    return true;
	} else {
	    return false;
	}
}


//-- 글자수를 체크합니다.

function checkByte(ob, bnum, msg)
{

        if(bnum == 0 )
        {
                if(ob.value.length == 0)
                {
                        alert( msg );
                        ob.focus();
                        return false;
                }
        }

        else if(ob.value.length < bnum)
        {
                //bnum_half = bnum / 2;
                alert( msg  );
                ob.focus();
                return false;
        }

        return true;

}



//-- 우편번호 검색기 

function CallZipPopup (  
                        formid, //-- Form 아이디 
                        zip1_ID, // 우편번호 아이디  
                        zip2_ID, // 우편번호 아이디 2 
                        addr1_ID, // 주소
                        addr2_ID  // 2번째  
                      ) {
                      
     
     var t_url = "/Common/ZipCode.aspx?formid={0}"
               + "&zip1_ID={1}&zip2_ID={2}&addr1_ID={3}&addr2_ID={4}";
     
     t_url = t_url.replace("{0}", formid);
     t_url = t_url.replace("{1}", zip1_ID);
     t_url = t_url.replace("{2}", zip2_ID);
     t_url = t_url.replace("{3}", addr1_ID);
     t_url = t_url.replace("{4}", addr2_ID);
     
     window.open( t_url , "ZipSearch", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=360,height=350,left=0,top=0");                 

}


// 학교 검색

function CallSchoolPopup (  
                        formid, //-- Form 아이디 
                        SchoolName_ID, //-- 학교이름 필드 
                        Focus_ID
                      ) {
                      
     
     var t_url = "/Common/SchoolSearch.aspx?formid={0}"
               + "&SchoolName_ID={1}&Focus_ID={2}";
     
     t_url = t_url.replace("{0}", formid);
     t_url = t_url.replace("{1}", SchoolName_ID);
     t_url = t_url.replace("{2}", Focus_ID);
     
     window.open( t_url , "SchPopup", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=360,height=350,left=0,top=0");                 

}
 



//-- 외국인 등록번호 체크 

function fgn_no_chksum(reg_no) {

    var sum = 0;
    var odd = 0;

    buf = new Array(13);
    for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));

    odd = buf[7]*10 + buf[8];

    if (odd%2 != 0) {
    return false;
    }

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
    return false;
    }

    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);


    sum=11-(sum%11);

    if (sum>=10) sum-=10;

    sum += 2;

    if (sum>=10) sum-=10;

    if ( sum != buf[12]) {
      return false;
    } else {
      return true;
    }
}


function check_no(obj1, obj2){

    var fgn_reg_no = obj1.value.trim() + obj2.value.trim();

    if (fgn_reg_no == ''){
        alert('외국인등록번호를 입력하십시오.');
        return false;
    }
    
    
    if (fgn_reg_no.length != 13) {
        alert('외국인등록번호 자리수가 맞지 않습니다.');
        return false;
    }
    if ((fgn_reg_no.charAt(6) == "5") || (fgn_reg_no.charAt(6) == "6"))
    {
    birthYear = "19";
    }
    else if ((fgn_reg_no.charAt(6) == "7") || (fgn_reg_no.charAt(6) == "8"))
    {
    birthYear = "20";
    }
    else if ((fgn_reg_no.charAt(6) == "9") || (fgn_reg_no.charAt(6) == "0"))
    {
    birthYear = "18";
    }
    else
    {
        alert("등록번호에 오류가 있습니다. 다시 확인하십시오.");
        return false;
    } 
    
    birthYear += fgn_reg_no.substr(0, 2);
    birthMonth = fgn_reg_no.substr(2, 2) - 1;
    birthDate = fgn_reg_no.substr(4, 2);
    birth = new Date(birthYear, birthMonth, birthDate);

    if ( birth.getYear() % 100 != fgn_reg_no.substr(0, 2) ||
    birth.getMonth() != birthMonth ||
    birth.getDate() != birthDate) {
    alert('생년월일에 오류가 있습니다. 다시 확인하십시오.');
    return false;
    }

    if (fgn_no_chksum(fgn_reg_no) == false){
      alert('외국인등록번호에 오류가 있습니다. 다시 확인하십시오.');
      return false;
    }
    
    return true;
    
}



//달력시작
function createCalendar() {

document.write("<div id='calDIV' style='z-index:+999;position:absolute;visibility:hidden;top:0;left:0'>");
document.write("<iframe align='center' valign='middle' name='frmCal' id='frmCal' frameborder='0' width='210' height='190' src='/Common/Calendar/blank.html'></iframe>")
document.write("</div>");

}

function printDates(sObj, eObj) {
	var pSObjName = "document.all['" + sObj.id + "']"; 
	var pEObjName = "document.all['" + eObj.id + "']";
    
     var strScript = "";
//     strScript = "<a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,0,0)\">"
//               + "<img src='/common/img/btn_ds1.gif' align='absmiddle' border='0'></a>&nbsp;"
//               + "<a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,0,-1)\">"
//               + "<img src='/common/img/btn_ds2.gif' align='absmiddle' border='0'></a>&nbsp;"
//               + "<a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,0,-3)\">"
//               + "<img src='/common/img/btn_ds3.gif' align='absmiddle' border='0'></a>&nbsp;"
        strScript =  "<td class=\"pd_2\"><a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,0,-7)\">"
               + "<img id='dateIcon1' onfocus='this.blur()' src=\"/Common/Img/mypage/my_dateicon_01c.gif\" onmouseover=\"this.src='/Common/Img/mypage/my_dateicon_01c.gif'\" onmouseout=\"this.src='/Common/Img/mypage/my_dateicon_01c.gif'\" border='0'/></a></td>"
               + "<td class=\"pd_2\"><a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,-1,0)\">" 
               + "<img id='dateIcon2' onfocus='this.blur()' src=\"/Common/Img/mypage/my_dateicon_02.gif\" onmouseout=\"this.src='/Common/Img/mypage/my_dateicon_02.gif'\" onmouseover=\"this.src='/Common/Img/mypage/my_dateicon_02c.gif'\" /></a></td>"
               + "<td class=\"pd_2\"><a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,-3,0)\">"
               + "<img id='dateIcon3' onfocus='this.blur()' src=\"/Common/Img/mypage/my_dateicon_03.gif\" onmouseout=\"this.src='/Common/Img/mypage/my_dateicon_03.gif'\" onmouseover=\"this.src='/Common/Img/mypage/my_dateicon_03c.gif'\" /></a></td>"
               + "<td class=\"pd_2\"><a href=\"javascript:moveDates(" + pEObjName + "," + pSObjName + ",0,-6,0)\">"
               + "<img id='dateIcon4' onfocus='this.blur()' src=\"/Common/Img/mypage/my_dateicon_04.gif\" onmouseout=\"this.src='/Common/Img/mypage/my_dateicon_04.gif'\" onmouseover=\"this.src='/Common/Img/mypage/my_dateicon_04c.gif'\" /></a></td>"

    document.write(strScript);
}

function moveDates(sObj,eObj,year,month,day) {
	  
	  var nowDate = new Date();
    
	  var now_year  = nowDate.getFullYear();
      var now_month = nowDate.getMonth(); 
      var now_day   = nowDate.getDate();
     
	  var newDate = new Date(now_year + year, now_month +  month, now_day + day);
	
	  var procYear = newDate.getFullYear(); 
      var procMonth = newDate.getMonth() + 1; 
	  var procDay = newDate.getDate();
	  
	  now_month += 1;
	  if (("" + now_month).length == 1) { now_month = "0" + now_month; }
      if (("" + now_day).length   == 1) { now_day   = "0" + now_day;   }
      

      if (("" + procMonth).length == 1) { procMonth = "0" + procMonth; }
      if (("" + procDay).length   == 1) { procDay   = "0" + procDay;   }
      
	  sObj.value = now_year + "-" + now_month + "-" + now_day; 
 	  eObj.value = procYear + "-" + procMonth + "-" + procDay; 
    
}


var objPrev; // 현재 보여주는 obj 

function popUpCalendar(ob,ob2,types,formats){
   
   var posTop, posLeft, leftPos, topPos;
   var aTag;
   
   posTop = 0;
   posLeft = 0;
   leftPos = 0;
   topPos = 0;
   
	aTag = ob;
	var posTop, posLeft;
    
	do {
		aTag = aTag.offsetParent;
		leftPos	+= aTag.offsetLeft;
		topPos += aTag.offsetTop;
	} while(aTag.tagName != "HTML" && aTag.tagName != "BODY");
    
   posTop =  ob.offsetTop + 20 + topPos ;
   posLeft = ob.offsetLeft + leftPos;
   
   calDIV.style.top = posTop + "px";
   calDIV.style.left = posLeft + "px";

 
   calDIV.style.visibility = "visible";
   frmCal.window.callCalandar(ob,ob2,types,formats);
   
   objPrev = ob;
}

function hideCalLayer(ob)	{
    
	if (objPrev == ob) {
	
		 if(calDIV.style.visibility == "visible" || calDIV.style.visibility == "") {
			calDIV.style.visibility = "hidden";
		} 
    }
	
	objPrev = null;

}
//달력끝

//딜러정보보기 팝업
function Go_DealerOpen(DEALERID){
    window.open( "/Mypage/seller_popup.aspx?DEALERID="+DEALERID , "DealerOpen", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=510,height=390,left=0,top=0");                 
}

//상품문의 
function Go_ProductQNAOpen(Productcode,DealerID,ProductType,Forderno,Orderno,BoardCode){
    window.open( "/Product/popup/Pop_ProductQA.aspx?ProductCode="+Productcode+"&DealerID="+DealerID+"&ProductType="+ProductType+"&FOrderNo="+Forderno+"&Orderno="+Orderno+"&BoardCode="+BoardCode , "DealerOpen", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=650,height=520,left=0,top=0");                 
}

//딜러정보보기
function Go_DealerOpen(DealerID){
    window.open( "/Mypage/seller_popup.aspx?DEALERID="+DealerID , "DealerOpen", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=540,height=390,left=0,top=0");                 
}

//카드결제 영수증 출력
function Go_CardBill(TNO){
    window.open( "http://admin.kcp.co.kr/Modules/Sale/Card/ADSA_CARD_BILL_Receipt.jsp?c_trade_no="+TNO , "Bill", "location=0,toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=420,height=670,left=0,top=0");                 
}

// 파라미터값 가져오기
function getParameter(valuename)
{
    var rtnval;
    var nowAddress = unescape(location.href); //현재 url주소값 가져오기
    var parameters = new Array();
    parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");
    for(var i = 0 ; i < parameters.length ; i++){
        if(parameters[i].indexOf(valuename) != -1){
            rtnval = parameters[i].split("=")[1];
            if(rtnval == undefined || rtnval == null){
                rtnval = "";
            }
            return rtnval;
        }
    }
}

// 플레이어 
function viewPlayer(params) {
    //OpenWindow("/Common/VOD/VODPlayer.aspx?PR=" + encodeURIComponent(params), 977, 650, "VODPlayer");
    window.open("/Common/VOD/VODPlayer.aspx?PR=" + encodeURIComponent(params), "VODPlayer", "width=977, height=650");
}


function viewFreePlayer(params)
{
    window.open("/Common/VOD/VODFreePlayer.aspx?PR=" + encodeURIComponent(params), "VODPlayer", "width=977, height=650");
}





//------------------------------------------------------------------
//아래 기타 함수들 추가
//2008-01-24
//윤성인
//주의: 아래의 모든 메소드는 입력폼의 필드이름(myform.myfield)을
//      파라미터로 받는다. 필드의 값(myform.myfield.value)이 아님을
//      유념할 것.
//------------------------------------------------------------------
/*예

if (isEmptyAlert(f.SSN[0], "주민번호 앞자리를 입력해주십시요.") == true ) {
	_cmdfocus(f.SSN[0]); return; 	}
if (isNumberAlert(f.SSN[0]) == false){
	_cmdfocus(f.SSN[0]); return; }
if (getByteLength(f.SSN[0]) < 6) {
	alert("주민번호 앞자리는 6자리입니다.\n\n다시 입력하세요.");
	_cmdfocus(f.SSN[0]); return;}
if (JuminChk(f.SSN[0], f.SSN[1]) == false) {
	alert("주민등록번호가 잘못 되었습니다.\n확인후 다시 입력해 주십시오");
	_cmdfocus(f.SSN[0]); return;	};
*/

/** Focus 맞춤 */
function _cmdfocus(formobj){
	formobj.select();
	formobj.focus();
}


// 용 도 : 입력 값이 NULL인지 체크
// return : boolean  
//          NULL이면 true, 아니면 false가 돌아간다.
function isNull(input) {
	if(input.value == null || input.value == "") return true;
	return false;
}

// 용 도 : 입력 값이 NULL인지 확인하여 NULL이면 msg를 출력한다.
// return : boolean  
//          NULL이면 true, 아니면 false가 돌아간다.
function isNullAlert(input, msg) {
   	var ret = isNull(input);
	if(ret) alert(msg);
	return ret;
}

// 용 도 : 입력 값에 Space 이외의 의미있는 값이 있는지 체크
// return : boolean  
//          있으면 true, 아니면 false가 돌아간다.
function isEmpty(input) {
	if(input.value == null || input.value.replace(/ /gi,"") == "") return true;
	return false;
}

// 용 도 : 입력 값에 Space 이외의 의미밌는 값이 없으면 msg를 출력한다.
// return : boolean  
//           space 이외의 의미있는 값이 없으면 true, 아니면 false가 돌아간다.
function isEmptyAlert(input, msg) {
	var ret = isEmpty(input);
	if(ret) alert(msg);
	return ret;
}

// 용 도 : 입력 값에 특정 문자(chars)가 있는지 체크한다. 특정 문자를 허용하지 않으려 할 때 사용
// return : boolean
//          있으면 true, 없으면 false 
// 사 용 예 : if(containsChars(form.name,"!,*&^%$#@~;")) {
//               alert("이름 필드에는 특수 문자를 사용할 수 없습니다.");
//           }
function containsChars(input, chars) {
	for(var inx = 0; inx < input.value.length; inx++)
		if(chars.indexOf(input.value.charAt(inx)) != -1)
		return true;
	return false;
}

// 용 도 : 입력 값이 특정 문자(chars)만으로 되어있는지 체크한다. 특정 문자만 허용하려 할 때 사용
// return : boolean
//          확인하려는 대상 문자만 있으면 true, 아니면 false
// 사 용 예 : if(!containsCharsOnly(form.blood,"ABO")) {
//               alert("혈액형 필드에는 A,B,O 문자만 사용할 수 있습니다.");
//           }
function containsCharsOnly(input, chars) {
	for (var inx = 0; inx < input.value.length; inx++)
		if(chars.indexOf(input.value.charAt(inx)) == -1)
			return false;
	return true;
}

// 용 도 : 입력 값이 알파벳인지 체크한다. 
//        아래 isAlphabet() 부터 isNumComma()까지의 메소드가 자주 쓰이는 경우에는 var chars 변수를 global 변수로 선언하고 사용하도록 한다.
// return : boolean, A에서 Z 까지의 문자만으로 되어있으면 true, 아니면 false
// 사 용 예 : ex) var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//               var lowercase = "abcdefghijklmnopqrstuvwxyz"; 
//               var number = "0123456789";
//               function isAlphaNum(input) {
//                   var chars = uppercase + lowercase + number;
//                   return containsCharsOnly(input,chars);
//               }
function isAlphabet(input) {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	return containsCharsOnly(input, chars);
}

// 용 도 : 입력 값이 알파벳인지 확인하여 알파벳 이외의 문자가 있으면 "영문자만 입력가능 합니다." 메시지를 보여주고 결과를 돌려준다.
// return : boolean, A에서 Z 까지의 문자만으로 되어있으면 true, 아니면 false
function isAlphabetAlert(input) {
	var ret = isAlphabet(input);
	if(!ret) alert("영문자만 입력가능 합니다.");
	return ret;
}

// 용 도 : 입력 값이 알파벳 대문자인지 체크
// return : boolean, 대문자만이면 true, 아니면 false  
function isUpperCase(input) {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	return containsCharsOnly(input, chars);
}

// 용 도 : 입력 값이 알파벳 대문자인지 확인하여 대문자 이외의 문자가 있으면 "알파벳 대문자만 입력하실 수 있습니다."라는 메시지를 보여주고 돌려준다.
// return : boolean, 대문자만이면 true, 아니면 false  
function isUpperCaseAlert(input) {
	var ret = isUpperCase(input);
	if(!ret) alert("알파벳 대문자만 입력하실 수 있습니다.");
	return ret;
}

// 용 도 : 입력 값이 알파벳 소문자인지 체크
// return : boolean 소문자만이면 true, 아니면 false
function isLowerCase(input) {
	var chars = "abcdefghijklmnopqrstuvwxyz";
	return containsCharsOnly(input, chars);
}

// 용 도 : 입력 값이 알파벳 소문자인지 확인하여 소문자 이외의 문자가 있으면  "알파벳 소문자만 입력하실 수 있습니다."라는 메시지를 보여주고 돌려준다.
// return :  boolean  소문자만이면 true, 아니면 false
function isLowerCaseAlert(input) {
	var ret = isLowerCase(input);
	if(!ret) alert("알파벳 소문자만 입력하실 수 있습니다.");
	return ret;
}

// 용 도 : 입력 값에 숫자만 있는지 체크
// return : boolean 숫자만 있으면 true, 아니면 false 
function isNumber(input) {
	var chars = "0123456789";
	return containsCharsOnly(input, chars);
}

// 용 도 : 입력 값에 숫자만 있는지 확인하여 숫자 이외의 문자가 있으면 "숫자만 입력 가능합니다"라는 메시지를 보여주고 돌려준다.
// return :  boolean 숫자만 있으면 true, 아니면 false   
function isNumberAlert(input) {
	var ret = isNumber(input);
	if(!ret) alert("숫자만 입력 가능합니다");
	return ret;
}

// 용 도 : 입력 값이 알파벳, 숫자로 되어있는지 체크
// return : boolean 알파벳과 숫자만이면 true, 아니면 false  
function isAlphaNum(input) {
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	return containsCharsOnly(input, chars);
}

// 용 도 : 입력 값이 알파벳, 숫자로 되어있는지 확인하여 알파벳과 숫자 이외의 문자가 있으면 "영문자와 숫자 입력만 가능합니다."라는 메시지를 보여주고 돌려준다.
// return : boolean 알파벳과 숫자만이면 true, 아니면 false
function isAlphaNumAlert(input) {
    var ret = isAlphaNum(input);
	if(!ret) alert("영문자와 숫자 입력만 가능합니다.");
	return ret;
}

// 용 도 : 입력 값이 숫자,대시(-)로 되어있는지 체크
// return : boolean 숫자와 대시(-)로 되어 있으면 true, 아니면 false  
function isNumDash(input) {
	var chars = "-0123456789";
	return containsCharsOnly(input,chars);
}

// 용 도 : 입력 값이 숫자,대시(-)로 되어있는지 확인하여 숫자와 대시(-) 이외의 문자가 있으면 체크 "숫자와 '-' 입력만 가능합니다."라는 메시지를 보여주고 돌려준다.
// return :  boolean 숫자와 대시(-)로 되어 있으면 true, 아니면 false
function isNumDashAlert(input) {
	var ret = isNumDash(input);
	if(!ret) alert(" 숫자와 '-' 입력만 가능합니다.");
	return ret;
}

// 용 도 : 입력 값이 숫자,콤마(,)로 되어있는지 체크
// return : boolean 숫자와 콤마(,)로 되어 있으면 true 아니면 false 
function isNumComma(input) {
	var chars = ",0123456789";
	return containsCharsOnly(input,chars);
}

// 용 도 : 입력 값이 숫자,콤마(,)로 되어있는지 확인하여 숫자와 콤마(,) 이외의 문자가 있으면 체크 " 숫자와 ',' 입력만 가능합니다."라는 메시지를 보여주고 돌려준다.
// return :  boolean  숫자와 콤마(,)로 되어 있으면 true, 아니면 false
function isNumCommaAlert(input) {
	var ret = isNumComma(input);
	if(!ret) alert("숫자와 ',' 입력만 가능합니다.");
	return ret;
}

// 용 도 : 입력 값에서 콤마를 없앤다.
// return : string, 입력값에서 콤마를 없앤 값 
function removeComma(input) {
	return input.value.replace(/,/gi,"");
}

// 용 도 : 입력 값이 사용자가 정의한 포맷 형식인지 체크한다. 자세한 format 형식은 자바스크립트의 'regular expression'을 참조
// return : boolean 올바른 포맷이면 true, 아니면 false 
function isValidFormat(input, format) {
	if(input.value.search(format) != -1) return true; //올바른 포맷 형식
	return false;
}

// 용 도 : 입력 값이 사용자가 정의한 포맷 형식인지 확인하여 올바르지 않은 형식이면 "올바른 입력형식이 아닙니다." 메시지를 보여주고 돌려준다.
// return : boolean 올바른 포맷이면 true, 아니면 false
function isValidFormatAlert(input, format) {
	var ret = isValidFormat(input, format);
	if(!ret) alert("올바른 입력형식이 아닙니다.");
	return ret;
}

//용 도 : 입력 값이 이메일 형식인지 체크
// return : boolean 이메일 형식이면 true, 아니면 false
function isValidEmail(input) {
	var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
	return isValidFormat(input, format);
}

//용 도 : 입력 값이 이메일 형식인지 확인하여 올바르지 않으면 "이메일 입력형식이 잘못되었습니다. \n 확인후 다시 입력해 주세요."라는 메시지를 보여주고 돌려준다.
// return :  boolean 이메일 형식이면 true, 아니면 false
function isValidEmailAlert(input) {
	var ret = isValidEmail(input);
	if(!ret) alert("이메일 입력형식이 잘못되었습니다. \n 확인후 다시 입력해 주세요.");
	return ret;
}

// 용 도 : 입력 값이 전화번호 형식(숫자-숫자-숫자)인지 체크
// return : boolean 전화번호 형식이면 true, 아니면 false 
function isValidPhone(input) {
    var format = /^(\d+)-(\d+)-(\d+)$/;
    return isValidFormat(input, format);
}

// 용 도 : 입력 값이 전화번호 형식(숫자-숫자-숫자)인지 확인하여 전화번호 형식이 아니면 "전화번호 입력이 잘못되었습니다. \n 확인후 다시 입력해 주세요."라는 메시지를 보여주고 돌려준다.
// return : boolean 전화번호 형식이면 true, 아니면 false
function isValidPhoneAlert(input) {
	var ret = isValidPhone(input);
	if(!ret) alert("전화번호 입력이 잘못되었습니다. \n 확인후 다시 입력해 주세요.");
	return ret;
}

// 용 도 : 선택된 라디오버튼이 있는지 체크
// return : boolean 있으면 true, 없으면 false
function hasCheckedRadio(input) {
	if(input.length > 1) {
		for(var inx = 0; inx < input.length; inx++)
			if(input[inx].checked) return true;
	} else {
		if(input.checked)
			return true;
	}
	return false;
}

// 용 도 : 선택된 라디오 버튼이 있는지 확인하여 없으면 "선택항목을 적어도 한개는 선택해주세요."라는 메시지를 보여주고 돌려준다.
// return : boolean 있으면 true, 없으면 false
function hasCheckedRadioAlert(input) {
	var ret=hasCheckedRadio(input);
	if(!ret) alert("선택항목을 적어도 한개는 선택해주세요.");
	return ret;
}

// 용 도 : 선택된 체크 박스가 있는지 체크
// return : boolean 있으면 true, 없으면 false
function hasCheckedBox(input) {
	return hasCheckedRadio(input);
}

// 용 도 : 선택된 체크박스가 있는지 확인하여 없으면 "선택항목을 적어도 한개는 선택해주세요."라는 메시지를 보여주고 돌려준다.
// return : boolean 있으면 true, 없으면 false
function hasCheckedBoxAlert(input) {
	var ret=hasCheckedRadio(input);
	if(!ret) alert("선택항목을 적어도 한개는 선택해주세요.");
	return ret;
}

// 용 도 : 입력 값의 바이트 길이를 리턴
// return : int, 입력값의 길이 
function getByteLength(input) {
	var byteLength = 0;
	for(var inx = 0; inx < input.value.length; inx++) {
		var oneChar = escape(input.value.charAt(inx));
		if(oneChar.length == 1) {
			byteLength ++;
		} else if(oneChar.indexOf("%u") != -1) {
			byteLength += 2;
		} else if(oneChar.indexOf("%") != -1) {
			byteLength += oneChar.length/3;
		}
	}
	return byteLength;
}

// 용 도 : 공백을 제거하는 함수
// return : string, 공백을 제거한 문자열 
function IsTrimStr(checkStr) {
	var str = "";
	for(var i = 0; i < checkStr.length; i++) {
		ch = checkStr.charAt(i);
		if(ch != " ") str += ch;
	}
	return str;
}

// 용 도 : 주민번호 체크 
// 형 식 : xxxxxx-yyyyyyy
// return :  boolean 
function newJumin(value) {
	this.value = value;
}

function common_Jumin_Check(jumin1, jumin2) {
	var ok = true;
	var Str1 = "" + jumin1 + jumin2;
	var Str = new newJumin(Str1);
	return jumin_Check(Str);
}

// 용 도 : 주민번호 체크
// 형 식 : xxxxxxyyyyyyy
// return :  boolean 
// 매개변수 : 주민등록번호 13자리
// 사 용 예 : jumin_Check(xxxxxxyyyyyyy); 
// 참고사항 : 주민등록번호가 잘못되었다면 주민등록번호가 잘못되었다는 메세지를 출력하고 boolean 을 return 한다.
function jumin_Check(juminnum) {
   if(!jumin_Check_Confirm(juminnum)) 
      alert("주민등록번호가 잘못 되었습니다.\n확인후 다시 입력해 주십시오");
}

// 용 도 : 주민번호 체크
// 형 식 : xxxxxxyyyyyyy
// return :  boolean 
// 매개변수 : 주민등록번호 13자리
// 사 용 예 : jumin_Check_Confirm(xxxxxxyyyyyyy); 
// 참고사항 : 주민등록번호가 잘못되어도 메세지를 출력하지 않고 boolean 만 return 한다.
function jumin_Check_Confirm(juminnum) {
	var ok = true;
	var Str = "" + juminnum.value;
	var sum = 0;
	sum = Str.charAt( 0 ) * 2 + Str.charAt( 1 ) * 3 + Str.charAt( 2 ) * 4 + Str.charAt( 3 ) * 5 +
		  Str.charAt( 4 ) * 6 + Str.charAt( 5 ) * 7 + Str.charAt( 6 ) * 8 + Str.charAt( 7 ) * 9 +
		  Str.charAt( 8 ) * 2 + Str.charAt( 9 ) * 3 + Str.charAt( 10) * 4 + Str.charAt( 11) * 5;
	if(sum == "0")
		return false;
	else {
		sum = sum % 11;
		sum = 11 - sum;
		if(sum > 9) sum = sum - 10;

		if(sum == Str.charAt(12)) {
			return true;
		} else {
			juminnum.focus();
			return false;
		}
	}
}

function JuminChk(juminnum1, juminnum2) {
	var Str = "" + juminnum1.value + juminnum2.value;
	var sum = 0;
	sum = Str.charAt( 0 ) * 2 + Str.charAt( 1 ) * 3 + Str.charAt( 2 ) * 4 + Str.charAt( 3 ) * 5 +
		  Str.charAt( 4 ) * 6 + Str.charAt( 5 ) * 7 + Str.charAt( 6 ) * 8 + Str.charAt( 7 ) * 9 +
		  Str.charAt( 8 ) * 2 + Str.charAt( 9 ) * 3 + Str.charAt( 10) * 4 + Str.charAt( 11) * 5;
	if(sum == "0")
		return false;
	else {
		sum = sum % 11;
		sum = 11 - sum;
		if(sum > 9) sum = sum - 10;

		if(sum == Str.charAt(12)) {
			return true;
		} else {
			return false;
		}
	}
}

// 용 도 : 사업자등록번호를 확인 
// 형 식 : XXXXXXXXXX
// return : boolean 맞으면 true, 아니면 false
function RegNoCheck(membNo) {
	if(membNo.length == 10) {
		a = membNo.charAt(0);
		b = membNo.charAt(1);
		c = membNo.charAt(2);
		d = membNo.charAt(3);
		e = membNo.charAt(4);
		f = membNo.charAt(5);
		g = membNo.charAt(6);
		h = membNo.charAt(7);
		i = membNo.charAt(8);
		Os = membNo.charAt(9);

		suma = a*1 + b*3 + c*7 + d*1 + e*3 + f*7 + g*1 + h*3;
		sumb = (i*5) %10;
		sumc = parseInt((i*5) / 10,10);
		sumd = sumb + sumc;	
		sume = suma + sumd;
		sumf = a + b + c + d + e + f + g + h + i
		k = sume % 10;
		Modvalue = 10 - k;
		LastVal = Modvalue % 10;

		if(sumf == 0) return false;
	} else return false;

	if(Osub == LastVal) return true;
	else return false;
}

// 용 도 : 사업자등록번호를 확인하여 비정상적이면 "사업자 등록번호가 잘못되었습니다. \n확인후 다시 입력해 주십시오"라는 메시지를 보여주고 돌려준다.
// 형 식 : XXXXXXXXXX
// return : boolean 맞으면 true, 아니면 false
function RegNO_check(membNo) {
	var bRet = RegNoCheck(membNo);
	if(!bRet) alert("사업자 등록번호가 잘못 되었습니다.\n확인후 다시 입력해 주십시오");
	return bRet;
}

// 용 도 : 사업자등록번호를 확인하여 비정상적이면 "사업자 등록번호가 잘못되었습니다. \n확인후 다시 입력해 주십시오"라는 메시지를 보여주고 돌려준다.
// 형 식 : XXX-XX-XXXXX
// return : boolean 맞으면 true, 아니면 false
function RegNO_check_formatted(membNo) {
	var str = "";
	var ar = membNo.split( "-" );
	for(var i = 0; i < ar.length; i++) str += ar[i];
	return RegNO_check(str);
}

// 용 도 : 임의의 HTML 테그 내용을 변경
// 매개변수 : obj - 구성할 HTML Tag Object html - Tag 이름
// return :	void
function makeTags(obj, html) {
	var tmp = obj.outerHTML;
	var idx = 0;
	if(IsTrimStr(obj.innerHTML).length <= 0)
		idx = tmp.indexOf( "</" + obj.tagName + ">" );
	else
		idx = tmp.indexOf(obj.innerHTML);
	tmp = tmp.substring(0, idx);
	tmp += html;
	tmp += "</" + obj.tagName + ">";
	obj.outerHTML = tmp;
}

// 용 도 : ComboCreater.getComboOption()의 결과를 기초로 
//        콤보의 항목을 변경
// 매개변수 : obj - 구성할 콤보 Object
//	         option - ComboCreater.getComboOption()의 결과
// return  : void
function makeCombo( obj, option ) {
	makeTags( obj, option );
	obj.selectedIndex = 0;
}

// 용 도 : 모달 대화상자 활성화
// param : url : 호출할 URL
//         title : dialog title 명
//         x : 대화상자 x 좌표( 0보다 작으면 Center );
//         y : 대화상자 y 좌표( 0보다 작으면 Center );
//         w : 대화상자 폭
//         h : 대화상자 높이
//return : ret : URL에서 반환활 결과 Object
function showDlg(url, title, x, y, w, h) {
	var bModal = true;
	if(showDlg.arguments.length == 7) {
		bModal = showDlg.arguments[6];
	}
	if(w <= 0 || h <= 0) {
		alert("대화상자 크기를 확인하세요");
		return null;
	}

	var ar = new Array();
	ar[0] = window;
	ar[1] = url;
	ar[2] = title;
	
	var opt = "status:no;scroll:no;help:no;";
	if(x >= 0) opt += "dialogLeft:" + x + "px;";
	if(y >= 0) opt += "dialogTop:"  + y + "px;";
	
	opt += "dialogWidth:"  + w + "px;";
	opt += "dialogHeight:" + h + "px;";

	if(bModal)
		return window.showModalDialog("/common/modalDlg.htm", ar, opt);
	else
		return window.showModelessDialog("/common/modalDlg.htm", ar, opt);
}

//팝업창 url, 팝업창 가로사이즈, 팝업창 세로 사이즈, 팝업창 화면가운데 오게할 지여부 값이 없으면 버튼 밑으로
//예) fn_OpenPop("checkId.aspx",500,300,true);
function fn_OpenPop(popURL,widthpx,heightpx,center)
{
  
    var div = eval("document.all.selectPop");
    div.innerHTML = "<iframe id='popFrame' src=\""+popURL+"\" width='"+widthpx+"' height='"+heightpx+"' frameborder='0' scrolling='yes'></iframe>"
    if (div.style.display == '')
    {
        div.style.display = "none";

    } else 
    {
        div.style.height = heightpx;
        div.style.width = widthpx;
        if(center)
        {
            var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
            
            div.style.top =  ((document.body.clientHeight - heightpx) / 2)+'px';
            div.style.left= ((document.body.clientWidth - widthpx) / 2)+'px';
            //div.style.top = scrollTop + ((document.body.clientHeight - heightpx) / 2)+'px';
            //div.style.left= scrollLeft + ((document.body.clientWidth - widthpx) / 2)+'px';
            div.style.display = "";
        }
        else
        {
            div.style.top = event.y + 30 - document.body.scrollTop;
            div.style.left = event.x;
            div.style.display = "";
        }
    }
}


//팝업창 url, 팝업창 가로사이즈, 팝업창 세로 사이즈, 팝업창 화면가운데 오게할 지여부 값이 없으면 버튼 밑으로
//예) fn_OpenPop("checkId.aspx",500,300,true);
function fn_OpenPop1(popURL,widthpx,heightpx,center)
{
  
    var div = eval("document.all.selectPop1");
    div.innerHTML = "<iframe id='popFrame' src=\""+popURL+"\" width='"+widthpx+"' height='"+heightpx+"' frameborder='0' scrolling='no'></iframe>"
    if (div.style.display == '')
    {
        div.style.display = "none";

    } else 
    {
        div.style.height = heightpx;
        div.style.width = widthpx;
        if(center)
        {
            var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
            
            div.style.top =  ((document.body.clientHeight - heightpx) / 2)+'px';
            div.style.left= ((document.body.clientWidth - widthpx) / 2)+'px';
            //div.style.top = scrollTop + ((document.body.clientHeight - heightpx) / 2)+'px';
            //div.style.left= scrollLeft + ((document.body.clientWidth - widthpx) / 2)+'px';
            div.style.display = "";
        }
        else
        {
            div.style.top = event.y + 30 - document.body.scrollTop;
            div.style.left = event.x;
            div.style.display = "";
        }
    }
}


function fn_ClosePop()
{
    parent.document.all.selectPop.style.display='none';
}

function fn_ClosePop1()
{
    parent.document.all.selectPop1.style.display='none';
}

function flashView(_url, wsize, hsize, wmode){ 
	document.write();
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width='+wsize+' height='+hsize+' VIEWASTEXT ID="Object1">');
	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="menu" value="false">');
	document.write('<embed src='+_url+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+wsize+' height='+hsize+'></embed>');
	document.write('</object>');
	document.write();
} 

function flashViewTimer(file_path, wmode, wsize, hsize, id){ 
document.write('<object id='+id+' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width='+wsize+' height='+hsize+' VIEWASTEXT>');
document.write('<param name="movie" value='+file_path+' />');
document.write('<param name="quality" value="best">');
document.write('<param name="wmode" value='+wmode+'>');
document.write('<embed src='+file_path+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+wsize+' height='+hsize+'></embed>');
document.write('</object>');
}

//trim()함수 추가
String.prototype.trim = function()
{
 return this.replace(/(^\s*)|(\s*$)/gi, "");
} 


////////////////////////////////////////////////////////////////////////////////////////////
///숫자만 입력되게
function handlerNum(obj) 
{
    e = window.event;
    if(e.keyCode == 9) return;  //탭은 허용
    //alert(e.keyCode);
    if(e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode == 8 || e.keyCode == 46) {
//        if(e.keyCode == 48 || e.keyCode == 96) {
//            if(obj.value == "" )
//                e.returnValue=false;
//            else
//                return;
//        }
//        else
            return;
    }
    else
        e.returnValue=false;
}

////////////////////////////////////////////////////////////////////////////////////////////
///돈,콤마찍어서
function checkOnlyNumber()  // 숫자만 입력했는지 검사
{
    var ob=event.srcElement;
    ob.value = filterNum(ob.value);
    ob.value = commaSplitAndNumberOnly(ob);
    return false;
}


////////////////////////////////////////////////////////////////////////////////////////////
///돈,콤마찍어서 OnKeyup 이벤트에서 바로 걸때
function checkOnlyNumber2(ob)  // 숫자만 입력했는지 검사
{
    ob.value = filterNum(ob.value);
    ob.value = commaSplitAndNumberOnly(ob);
    return false;
}

//그냥 숫자, 콤마없이
function checkNumber()  // 숫자만 입력했는지 검사
{
    var ob=event.srcElement;
    ob.value = filterNum(commaSplitAndNumberOnly(ob));
    return false;
}

function commaSplitAndNumberOnly(ob)
{

        var txtNumber = '' + ob.value;
        
        if (isNaN(txtNumber) || txtNumber.indexOf('.') != -1 )   // 소수점 사용 불가 추가
        {
                ob.value = ob.value.substring(0, ob.value.length-1 );
                ob.value = commaSplitAndNumberOnly(ob);
                ob.focus();
                return ob.value;
        }
        else
        {
                var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
                var arrNumber = txtNumber.split('.');
                
                arrNumber[0] += '.';
                do
                {
                        arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
                }
                while (rxSplit.test(arrNumber[0]));

                if (arrNumber.length > 1)
                {
                        return arrNumber.join('');
                }
                else {
                        return arrNumber[0].split('.')[0];
                }
        }
}

function filterNum(str)    // $ 와 콤마 제거 함수
{
                re = /^\$|,/g;
                // "$" and "," 입력 제거
                return str.replace(re, "");
}
////////////////////////////////////////////////////////////////////////////////////////////


/*-------------------------------------------------------------
  입력 문자열 길이 체크(SMS발송 문자 길이)
  chkMsgLength()
  최진수 2007.06.17
  사용예 : 
  var str = chkMsgLength("80", txtContent, currentMsgLen);
  <textarea name="txtContent" style="width:320px;height:70px" onkeyup="chkMsgLength(80,txtContent,currentMsgLen);"></textarea>
  <span id=currentMsgLen>0</span>바이트/80바이트
--------------------------------------------------------------*/
function chkMsgLength(intMax,objMsg,st)
{
	var length = lengthMsg(objMsg.value);
	st.innerHTML = length;
	if(length > intMax)
	{
		alert("최대 " + intMax + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.\n");
		objMsg.value = objMsg.value.replace(/\r\n$/, "");
		objMsg.value = assertMsg(intMax,objMsg.value,st );
	}
}

function assertMsg(intMax,objMsg,st )
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = objMsg.length;
	for(i=0; i<msglen; i++)
	{
		var ch = objMsg.charAt(i);
		if (escape(ch).length > 4)
		{
			inc = 2;
		}
		else if (ch == '\n')
		{
			if (objMsg.charAt(i-1) != '\r')
			{
				inc = 1;
			}
		}
		else if (ch == '<' || ch == '>')
		{
			inc = 4;
		}
		else
		{
			inc = 1;
		}
		if ((nbytes + inc) > intMax)
		{
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	st.innerHTML = nbytes;
	return msg;
}

function lengthMsg(objMsg)
{
	var nbytes = 0;
	for (i=0; i<objMsg.length; i++)
	{
		var ch = objMsg.charAt(i);
		if(escape(ch).length > 4)
		{
			nbytes += 2;
		}
		else if (ch == '\n')
		{
			if(objMsg.charAt(i-1) != '\r')
			{
				nbytes += 1;
			}
		}
		else if (ch == '<' || ch == '>')
		{
			nbytes += 4;
		}
		else
		{
			nbytes += 1;
		}
	}
	return nbytes;
}

//영수증 출력 팝업 생성
//tid:결제 정보의 TId값
function receipt(tid)
{
    var receiptUrl = "https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid=" + tid + "&noMethod=1";
    window.open(receiptUrl,"receipt","width=400,height=710, scrollbars=yes,resizable=yes");
}





/*
 퀵메뉴 관련 시작
*/
function IEZN_quick_menu_simple(input_obj,move_top){
    this.timeId     = new Array();
    this.div_obj = new Array();
    try{
        this.input_obj = input_obj;
        this.input_obj.style.display = 'none';
    }catch(e){}
    
    var IEZN_quick_menu_counter;
    
    IEZN_quick_menu_counter = (typeof(IEZN_quick_menu_counter)=='undefined')? 0:IEZN_quick_menu_counter++;
    
    this.counter = IEZN_quick_menu_counter;
    this.div_obj_top = parseInt(this.input_obj.style.top);
    
//    if(this.div_obj_top <= 83) {
//        this.div_obj_top = 83;
//    }
    
    this.div_obj_left = parseInt(this.input_obj.style.left);    
    this.div_obj_max_move_top = (move_top)? move_top:this.div_obj_top;//browser top offset 
    
    this.move();
}

IEZN_quick_menu_simple.prototype = {    
    move : function(){
        this.div_obj = document.createElement("div");
        this.div_obj.id='izqm1'+this.counter;
        this.div_obj.style.position = 'absolute';
        this.div_obj.style.top=this.div_obj_top+'px';
        this.div_obj.style.padding='0px';
        this.div_obj.style.left=this.div_obj_left+'px';
        this.div_obj.style.backgroundColor=(this.input_obj.style.backgroundColor)? this.input_obj.style.backgroundColor:'transparent';
        this.div_obj.style.overflow='hidden';
        this.div_obj.style.textOverflow='ellipsis';
        this.div_obj.style.width=this.input_obj.style.width;
        this.div_obj.style.border=this.input_obj.style.border;
        this.div_obj.style.padding=this.input_obj.style.padding;
        
        try{
            document.body.appendChild(this.div_obj);            
            this.div_obj.innerHTML = this.input_obj.innerHTML;
            this.move_menu();
        }catch(e){alert(e)}
    },
    move_menu : function (){
        var obj = this;
        this.div_obj_start = parseInt(this.div_obj.style.top,10);
        this.div_obj_end = parseInt(this.scrollTop()) + parseInt(this.div_obj_max_move_top,10);
        if (this.div_obj_end < parseInt(this.div_obj_top,10)) this.div_obj_end = parseInt(this.div_obj_top,10);
        if (this.div_obj_start != this.div_obj_end ) {
            this.div_obj_offset = Math.ceil(Math.abs( this.div_obj_end - this.div_obj_start ) / 15 );
            t = parseInt(this.div_obj.style.top, 10) + ((this.div_obj_end<this.div_obj_start)? this.div_obj_offset*-1:this.div_obj_offset);
            
            
            //var chk = t - 83;

            //if (t <= 83) {
                //t = 83;
            //}
            
            
            
            this.div_obj.style.top = t+'px';
            this.slide_time = 10;
        }
        this.timeId[this.div_obj.id] = window.setTimeout(function(){obj.move_menu()},this.slide_time);
    },
    scrollTop : function (){//xhtml doctype patch
        if (window.pageYOffset){
            scroll_top = window.pageYOffset
        }else if (document.documentElement && document.documentElement.scrollTop){
            scroll_top = document.documentElement.scrollTop
        }else if (document.body){
            scroll_top = document.body.scrollTop
        }
        return scroll_top;
    }
}


function QuickStart() {
	new IEZN_quick_menu_simple(document.getElementById('quickFS'),0);
}

/* 퀵메뉴 관련 끝 */


// 제품 간략 정보 보기 창
function QuickView(prdCode) {
    OpenWindow("http://www.fashionstory.co.kr/Common/Popup/QuickView.aspx?prdcode="+prdCode, "722", "470");
}

// 검색 페이지
function SearchPage() {
    var search = document.getElementById("KeywordCont").value;
    
    if(search != "") {
        //alert(search);
        //document.location.href="http://www.fashionstory.co.kr/Fs/SearchKeyword.aspx?search=" + encodeURI(search);
        //document.location.href="http://www.fashionstory.co.kr/Fs/SearchKeyword.aspx?search=" + encodeURI(search);
        document.location.href="/Shop/SearchKeyword.aspx?search=" + encodeURI(search);
    }
}





/*********************************************** 
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com) 
* This notice MUST stay intact for legal use 
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code 
***********************************************/ 

/* Modified to support Opera */ 
function bookmarksite(title,url){ 
if (window.sidebar) // firefox 
    window.sidebar.addPanel(title, url, ""); 
else if(window.opera && window.print){ // opera 
    var elem = document.createElement('a'); 
    elem.setAttribute('href',url); 
    elem.setAttribute('title',title); 
    elem.setAttribute('rel','sidebar'); 
    elem.click(); 
} 
else if(document.all)// ie 
    window.external.AddFavorite(url, title); 
} 




// 20081022 롤오버이미지 : 텝 레이터 변경 스크립트
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_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.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[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];}
}




/*
    div 형식은 name1 이런식으로 해야 한다.
    id : 숫자를 뺀 아이디값 : name
    num : 현재 자신의 숫자 : 1
    tnum : 전체 탭의 숫자 : 2
*/
function TabMenu(id, num, tnum) {
    if(tnum > 0) {
        for(var i = 1; i<= tnum; i++) {
            document.getElementById(id + i).style.display = "none";
        }
        document.getElementById(id + num).style.display = "block";
    }
}





function getCookie( name ){
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
        {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                                endOfCookie = document.cookie.length;
                        return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                       break;
        }
        return "";
}


// 쿠키를 만듭니다. 아래 closeWin() 함수에서 호출됩니다
function setCookie( name, value, expiredays ) 
{ 
        var todayDate = new Date(); 
        todayDate.setDate( todayDate.getDate() + expiredays ); 
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
        } 

//체크후 닫기버튼을 눌렀을때 쿠키를 만들고 창을 닫습니다
//쿠키명 부분
function settingCookie(num){
        setCookie( "popupMain_"+num, "yes" , 1);  // 오른쪽 숫자는 쿠키를 유지할 기간을 설정합니다
        document.getElementById("popDiv_" + num).style.display = "none";
}
//링크부분
function GoUrl(url){
    opener.document.location.href=url;
    //self.close(); 
}
//링크부분
function GoLayerUrl(url){
    document.location.href=url;
    //self.close(); 
}

function LayerPopupClose(num) {
    document.getElementById("popDiv_" + num).style.display = "none";
}





