
$(document).ready(function(){
	//공통 hand 모양 스타일 적용
	$('.logoout').css('cursor','hand');
	
	
	//팝업 처리
	$("#payguideview, .payguideviewclass").click(function(){
		var width = 350;
		var height = 557;
		var path='/layer/popBox.php?code=layer/lpayguide.php';
		window.open(path, 'POP1', 'width='+width+',height='+height+',top=100,left=200,scrollbars=no,resizable=yes,status=0,location=0,toolbar=no,menubar=0');				
	}).addClass("links");
	$("#idpwsearchview, #idpwsearchview2, .idpwsearchviewClass").click(function(){
		var width = 442;
		var height = 500;
		var path='/layer/popBox.php?code=layer/lidpwfind.php';
		window.open(path, 'POP2', 'width='+width+',height='+height+',top=100,left=200,scrollbars=no,resizable=yes,status=0,location=0,toolbar=no,menubar=0');		
	}).addClass("links");

	$(".layerMsg").click(function(){
 		var width = 426;
		var height = 290;
		var path='/layer/popBox.php?code=layer/messageLayer.php';
		window.open(path, 'POP3', 'width='+width+',height='+height+',top=100,left=200,scrollbars=no,resizable=yes,status=0,location=0,toolbar=no,menubar=0');		
	}).addClass('links');


	//상단 검색
	$(".selectsearch").css('border','0px');
	$("#selecttoparrow").click(function(){
		if($("#selecttopsearch").css("display") == "none"){
			$("#selecttopsearch").slideDown('slow');	
		}else{
			$("#selecttopsearch").slideUp('slow');	
		}
	});
	$(".selecttopitem").click(function(){
		$("#selecttopselect").html($(this).html());
		$("#searchtop1216").find("input[name='radiocheck']").val($(this).attr("alt"));
		$("#selecttopsearch").slideUp('slow');
	});
	$("#bsmart_search.php").submit(function(){
		var su = "";

		if($(this).find("input[name='radiocheck']").val() != ""){
			su="?radiocheck="+$(this).find("input[name='radiocheck']").val();
		}

		if($(this).find("input[name='radiocheck']").val()){
			if(su){
				su += "&";
			}else{
				su += "?";
			}

			su+="keyword="+$(this).find("input[name='keyword']").val();
		}

		location.href='/bang_db/bsmart_search.php'+su;
		return false;
	});
	

	//링크 
	$(".atagcp").mouseover(function(){
		$(this).css("color","#F60");	
	}).mouseout(function(){
		$(this).css("color","#444");			
	}).addClass("links");

 
	//키이벤트
	$(document).keypress(function(e){
//		$(document).attr("title",e.keyCode);	
		
		switch(e.keyCode){
			case 13:	//엔터
				if($("#login_popup").css("display") != "none"){
					$("#signin_form2").submit();
				}
			break;
		}

	});


	$(window).scroll(function(){ 
		$('#quickM').stop();
		$('#quickM').animate({"top": $(window).scrollTop() - 155}, 500); 
	});  

		
	if($.browser.msie){	 //공통 브라우져 문제
		if($.browser.version < 8){	//익스 8 이하 버젼
			//$('#quickM').css("left","970px");

			$(".adult19mark").attr("src","/images/comic/icon/19.gif");	//19금 마크 공통 적용
		}
	}


	//로그인
	$('#signin_form, #signin_form2').submit(function(){
		var uid = $(this).find("input[name='uid']");
		if(uid.val() == ""){
			uid.focus();
			errorAll("아이디를 입력해주세요.");
			return false;
		}
		var upw = $(this).find("input[name='upw']");
		if(upw.val() == ""){
			upw.focus();
			errorAll("비밀번호를 입력해주세요.");
			return false;
		}
		if($(this).find("input[name='saveid']:checked").val() == 1){
			setCookie("saveid",uid.val());
		}else{
			setCookie("saveid",'');
		}

	});
	
	//로그아웃
	$('.logoout').click(function(){
		location.href='/lib/process.php?type=logoout';	
	});

	//그림자 처리
//	var lshtml = "javascript:document.write('<html><head><style>body{background-color:#333333;}</style></head><body></body></html>');";
	var ds = $("#DivShim");
	ds.attr("src","/lib/temp.php");
	ds.css({'position':'absolute', 'top':'0px', 'left':'0px', 'display':'none','zIndex':'3000'});

	//뷰어 보는 것
	$('.viewbang').click(function(){
		var arr = $(this).attr('id').split("_");	
		var args = Array();
		if(arr[0] == 'viewbang'){	//만화 상세 페이지 권별 
			if(arr[1] == undefined){ return false; }
			if(arr[2] == undefined){ arr[2] = 1; }
			var $imgsize = $("#imgsize0114").find("input[name='img_size']:checked");
			var size = $imgsize.val();

			if(size == undefined){
				size='';
			}

			viewbang(arr[1],arr[2],size);
		}else{
			if(arr[1] == undefined || !arr[1]){ return false; }
			if(arr[2] == undefined || !arr[2]){ arr[2] = 1; }

			if(size == undefined){
				size='';
			}
			viewbang(arr[1],arr[2],size);
		}
		
	}).addClass('links');

	$("#mapview").click(function(){
		if($("#mapinfo").css("display") == "none"){
			$("#mapinfo").show();
			$(this).find('img').attr('src','/images/main/btn/sitemap.gif');
		}else{
			$("#mapinfo").hide();
			$(this).find('img').attr('src','/images/main/btn/sitemap_.gif');
		}
	}).addClass("links");


	$(".freelist0421Class").click(function(){

		switch($(this).attr("id")){
			case "freelist0421One":
				$("#freelist0421One").attr("src","/images/main/bg/re_01_tab01_1.gif");
				$("#freelist0421Two").attr("src","/images/main/bg/re_01_tab02.gif");

				$("#freelist0421One_").show();
				$("#freelist0421Two_").hide();
				break;
			case "freelist0421Two":
				$("#freelist0421One").attr("src","/images/main/bg/re_01_tab01.gif");
				$("#freelist0421Two").attr("src","/images/main/bg/re_01_tab02_1.gif");

				$("#freelist0421One_").hide();
				$("#freelist0421Two_").show();
				break;
		}

	}).addClass("links");
});

function logincheck(){
	if(_M_){
		return 0;
	}else{
		if(confirm('로그인을 하셔야 볼 수 있습니다.')){
			poplayer('login_popup');	
		}			
		return 1;
	}
}

function logincheck2(){
	if(confirm("로그인을 하셔야 합니다.\n로그인을 하시겠습니까?")){
		poplayer('login_popup');	
	}
}


$(window).unload(function(){
	if(shim.resizeTimer) clearTimeout(shim.resizeTimer);
	return false;
});

//이미지 테두리
function bluring(){if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();} 
//document.onfocusin=bluring; 


function doSomething(){
	var ds = $("#DivShim");
	ds.css({'width':$(window).width(),'height':$(window).height()});
}


//ie8 resize bug ㅜ,.ㅜ 로 시간으로 사용 걱정 걱정... 브라우져 무리 갈 수 있음...
var shim = {
	resizeTimer : null,
	targetid		: null
};


//뷰어 보다가 결제로 체크 할때
function poplayer2(targetId,cd_idx,all){
	jajax({type:'payvol1213s',temp1:cd_idx,temp2:all});
	poplayer(targetId);
}

function poplayer(targetId){
	//뒷배경 오픈 뷰어
	if($('#DivShim').css('display') != "block"){
		$('#DivShim').css({'display':'block','opacity':'0'}).animate({
			opacity: 0.5
		},300,function(){ poplayerview(targetId); });
	}else{
		$("#"+shim.targetid).css('display','none');
	}
	if(shim.resizeTimer) clearTimeout(shim.resizeTimer);	
	shim.targetid = targetId;
	resizeTimerF();
}
var i=0;
function resizeTimerF(){
	//뒷배경 및 시간타임 
	var ds = $("#DivShim");

	if(shim.resizeTimer) clearTimeout(shim.resizeTimer);

	ds.css({'top':$(window).scrollTop(),'left':$(window).scrollLeft()});
	ds.css({'width':function(){ return $(window).width(); },'height':function(){ return $(window).height(); }});
/*
	$(".divShim").filter(function(index){
		return $(this).css("display") == "block";
	}).attr('id');
*/
	if(shim.targetid){
		poplayerview(shim.targetid);
	}

	$("#testbug").val(i);

	i++;
	shim.resizeTimer = setTimeout(resizeTimerF, 100);
}
function poplayerview(targetId){
	//팝레이어 위치 조정
	var tg = $("#"+targetId);
	tg.css({'display':'block','top':function(){
		return $(window).scrollTop() + 10;	
	},'left':function(){
		return ($(window).width() / 2) - ($(this).width() / 2);	
	}});

}
function poplayerview2(targetId){
	//팝레이어 위치 조정
	var tg = $("#"+targetId);
	tg.css({'display':'block','top':function(){
		return ($(window).height() / 2) - ($(this).height() / 2) ;	
	},'left':function(){
		return ($(window).width() / 2) - ($(this).width() / 2);	
	}});

}

function poplayclose(targetId){
	//팝레이어 닫기
	if(shim.resizeTimer) clearTimeout(shim.resizeTimer);
	shim.targetid ="";
	$("#"+targetId).css('display','none');
	
	$('#DivShim').animate({
		opacity: 0
	},300,function(){ $(this).css({'display':'none'}); });
	
	return 1;
}



/*************  공통 함수 ****************/

//입력 글제한
function fc_chk_byte(memo,ari_max,text_count){  

	var ls_str = memo.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; 
		}else{ 	// 그밗의 경우는 1을 더한다. 
			li_byte++; 
		} 

		// 전체 크기가 li_max를 넘지않으면 
		if(li_byte <= li_max){ 
			li_len = i + 1; 
		} 
	} 

	if(text_count)text_count.html(li_byte);

	// 전체길이를 초과하면 
	if(li_byte > li_max){ 
		alert( li_max + " 글자를 초과 입력할수 없습니다. \n 초과된 내용은 자동으로 삭제 됩니다. "); 
		ls_str2 = ls_str.substr(0, li_len); 
		memo.value = ls_str2; 
	} 
		memo.focus(); 
} 


//png 문제 
function setPng24(obj) {
	if($.browser.msie){
		if($.browser.version == "6.0"){
			obj.width=obj.height=1;
			obj.className=obj.className.replace(/\bpng24\b/i,'');
			obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
			obj.src='';
			return '';
		}
	}


}


//숫자만 입력받기
function numbersonly(e, decimal) { 
    var key; 
    var keychar; 

    if (window.event) { 
       // IE에서 이벤트를 확인하기 위한 설정 
        key = window.event.keyCode; 
    } else if (e) { 
      // FireFox에서 이벤트를 확인하기 위한 설정 
        key = e.which; 
    } else { 
        return true; 
    } 

    keychar = String.fromCharCode(key); 

    if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27) ) { 
        return true; 
    } else if ( key >= 95 && key <=105 ) { //익스,모질라
        return true; 
    } else if ((("0123456789").indexOf(keychar) > -1)) { 
        return true; 
    } else if (decimal && (keychar == ".")) { 
        return true; 
    } else {
        return false; 
	}
}

//공통 에러 메시지 차후에 레이어로 변경시 편의를 위해서
function errorAll(msg){
	alert(msg);
}

function lib_process(val){
	$('#ifmsubmit').attr("src","/lib/process.php?type="+val);
}

// 3자릿수마다 컴마를 찍어주는데 계산할때는 컴마를 지워주고 형변환해서 계산한뒤 다시 컴마를 붙여서 출력
// 컴마추가 : Format_comma, 컴마제거 : Format_NoComma

// 숫자에 3자리마다 콤마찍기(현금표시)
function Format_comma(val1){
	var newValue = val1+""; //숫자를 문자열로 변환
	var len = newValue.length;  
	var ch="";
	var j=1;
	var formatValue="";

	// 콤마제거  
	newValue = newValue.replace(/\,/gi, ' ');

	// comma제거된 문자열 길이
	len = newValue.length;

	for(i=len ; i>0 ; i--){
		ch = newValue.substring(i-1,i);
		formatValue = ch + formatValue;
		if ((j%3) == 0 && i>1 ){
			formatValue=","+formatValue;
		}
		j++
	}
	return formatValue;
}
 
 // 콤마제거
 function Format_NoComma(val1){
  return (val1+"").replace(/\,/gi, '');
 }

// 만화 뷰어용 스크립트 
function viewbang(code,vol,size,page) {
	width=$(window).width();
	height=$(window).height();

	page = (page)?page:1;

	if(!size){
		if(screen.width <= 1024){
			size = "S";
		}
	}

	if(logincheck()){ return false; }

	var ssn = "";
	if(_SSN_){
		ssn = "&ssn="+_SSN_;
	}

	if(padCheck){
		var path='/comic/viewerSingle.php?code='+code+'&vol='+vol+'&size='+size+'&p='+page+ssn;
	}else{
		var path='/comic/viewer.php?code='+code+'&vol='+vol+'&size='+size+'&p='+page+ssn;
	}


	window.open(path, 'CViewer', 'width='+width+',height='+height+',top=0,left=0,scrollbars=no,resizable=yes,status=0,location=0,toolbar=no,menubar=0');
}


// 만화 뷰어용 스크립트 
function viewbang0210(code,vol,sizea,page) {
	var size = 'A';
	width=$(window).width();
	height=$(window).height();

	page = (page)?page:1;

	var sa = sizea.split("_");
	

//	if($.browser.msie){ }

	if($.inArray("B", sa) && screen.width > 1024){
		size = "B"
	}else if($.inArray("S", sa)){
		size = "S"
	}

	if(logincheck()){ return false; }
 
	if(padCheck){
		var path='/comic/viewerSingle.php?code='+code+'&vol='+vol+'&size='+size+'&p='+page;
	}else{
		var path='/comic/viewer.php?code='+code+'&vol='+vol+'&size='+size+'&p='+page;
	}


	window.open(path, 'CViewer', 'width='+width+',height='+height+',top=0,left=0,scrollbars=no,resizable=yes,status=0,location=0,toolbar=no,menubar=0');
}


function openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

//쿠기관련
var expireDate = new Date();
var cookieName = ""; 

if (document.cookie != "") { 
        cookieName = document.cookie.split("=")[1]; 
} 

function setCookie(cookieName,value,day){ 
		day = (day)?day:0;
		
		if(day){
			expireDate.setMonth(expireDate.getMonth()+day);
		}

		 //쿠키유효기간 설정
		// expireDate.setDate( expireDate.getDate() * day );

		 //쿠키 expire 날짜 세팅
		 var expireDates = new Date(expireDate.getFullYear(), expireDate.getMonth(), expireDate.getDate());

        document.cookie = cookieName+"="+value+";expires=" + expireDates.toGMTString()+ "; path=/;";
} 
 


function setCookie2(cookieName,value){ 
//		expireDate.setMonth(expireDate.getMonth()+day);
		document.cookie = cookieName + "=" +value+ "; path=/;";
} 


// 쿠키 버리기 함수 
function deletecookie(val){ 
	if (document.cookie != "") {
			var temp = "";
			var thisCookie = document.cookie.split("; ");
			expireDate = new Date();
			expireDate.setDate(expireDate.getDate()-1);
			for (i=0; i<thisCookie.length; i++) {
					temp = thisCookie[i].split("=");
					if(temp[0] == val){
						document.cookie = thisCookie[i] + ";expires=" + expireDate.toGMTString();
					}
			} 
	} 
} 
//쿠기 끝

/*************************************************************************************/
//http://cafe.naver.com/javamaker.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=279%26clubid=16593684
function jajax(args){
	if(!args.type) return false;
	if(!args.temp1) args.temp1 = "";if(!args.temp2) args.temp2 = "";if(!args.temp3) args.temp3 = "";if(!args.temp4) args.temp4 = "";
	$.ajax({
		url: '/lib/ajaxProcess.php',
		type: 'POST',
		data: 'type='+args.type+'&temp1='+args.temp1+'&temp2='+args.temp2+'&temp3='+args.temp3+'&temp4='+args.temp4,
		dataType: 'json',
		global: 'true',
		contentType: 'application/x-www-form-urlencoded',
//		timeout: 1000,
		error: function(){
			//alert('Error');
		},
		success: function(xml){

			if(!xml['TYPE']) return false;
			switch(xml['TYPE']){
				case "firstlogin":
					//24시간 회원
					var m = xml.RESULT_LIST[0].RESULT.RST_DATA1;
					var b = xml.RESULT_LIST[0].RESULT.RST_DATA2;
					var s = xml.RESULT_LIST[0].RESULT.RST_DATA3;
 
					$("#viewtimes").text(m+":"+b+":"+s);
 
					if(m == "00" && b == "00" && s == "00"){
						end_firstlogin = 0;
						$("#firstlogin_layer").hide();
					}

					break;
				case "paycoupon_enddate":
					//프리미엄 구매 시 완료일
					var msg = xml.RESULT_LIST[0].RESULT.RST_DATA1;
					$("#pay_date").html(msg+" 까지");
					break;
				case "payvol1213s":	 //뷰어에서 결제 레이어로 볼 때
					var num = xml.RESULT_LIST.length;
					var checkbox = '';
					var allpays0317s = 0;

					$("#payment_layer_middle1_titles1213").html(xml.REQUEST.REQ_DATA1);
					money = xml.REQUEST.REQ_DATA2;
					no_sale = xml.REQUEST.REQ_DATA6;

					if(no_sale == "Y"){
						$("#saleinfo").hide();
					}

					$("#lcashform3").find("input[name='cd_idx']").val(xml.REQUEST.REQ_DATA3);

					checkbox += "<table><tr>";
					for(i=0;i < num;i++){	
						if((i)%7 == 0){checkbox += "</tr><tr>";}
						checkbox += '<td><input type="checkbox" name="ck[]" class="allselect0311" onclick="checkNum()"  value="'+xml.RESULT_LIST[i]["RESULT"]["RST_DATA1"]+'" '+xml.RESULT_LIST[i]["RESULT"]["RST_DATA2"]+'/></td> <td style="color:'+xml.RESULT_LIST[i]["RESULT"]["RST_DATA3"]+'">'+xml.RESULT_LIST[i]["RESULT"]["RST_DATA4"]+xml.REQUEST.REQ_DATA5+'</td>';
						if(xml.RESULT_LIST[i]["RESULT"]["RST_DATA2"] != "disabled"){
							allpays0317s++;
						}
					}
					checkbox += "</tr></table>";
					$("#payment_layer_middle1_checkboxlist").html(checkbox);

					$("#allpays0317").val(allpays0317s);
					if(xml.REQUEST.REQ_DATA4){
						allchecked();
					}


					break;
				case "wish_comic2":	//찜목록 셀 체크
					var msg = xml.RESULT_LIST[0].RESULT.RST_DATA1;
					$.each(msg.split("|||"),function(index, value){
						if(value){
							var arr = value.split("_");
							$("#total_"+arr[0]).html(Format_comma(arr[1]));
						}
					});
					break;
				case "wish_comic":	//찜목록 셀 체크
					var total = xml.RESULT_LIST[0].RESULT.RST_DATA1;					
					var sale  = xml.RESULT_LIST[0].RESULT.RST_DATA2;	
					var whysale = xml.RESULT_LIST[0].RESULT.RST_DATA3.split("|||");
					if(parseInt(whysale[1])){
						$("#whysalediv").html(whysale[0]+"권 이상 "+whysale[1]+"% 할인 적용").show();
					}else{
						$("#whysalediv").hide();
					}

					ajaxloading = 0;
					inmoneys(total,sale);
					break;
 				case "mainmenuindex":	//
					var types = xml.REQUEST.REQ_DATA1;
					var cgd = xml.REQUEST.REQ_DATA2;
					
					var num = xml.RESULT_LIST.length;
					var html = pp = vol = finals = linkss = gg = money = gr = paytype = img = cd_age = color = title = writer = writerx ="";
					var idx=vote1=vote2=temp=0;

					var colortemp = "";
					for(var i=0;i<num;i++){
						temp = i%5;

						idx		= xml.RESULT_LIST[i].RESULT.cd_idx;
						img		= xml.RESULT_LIST[i].RESULT.img;
						cd_age	= xml.RESULT_LIST[i].RESULT.cd_age;
						color		= xml.RESULT_LIST[i].RESULT.color;
						title		= xml.RESULT_LIST[i].RESULT.title;
						writer	= xml.RESULT_LIST[i].RESULT.writer;
						writerx	= xml.RESULT_LIST[i].RESULT.writerx;
						vol		= xml.RESULT_LIST[i].RESULT.vol;
						finals		= xml.RESULT_LIST[i].RESULT.finals;
						money	= xml.RESULT_LIST[i].RESULT.money;
						paytype	= xml.RESULT_LIST[i].RESULT.paytype;
						gr			= xml.RESULT_LIST[i].RESULT.gr;
						vote1			= xml.RESULT_LIST[i].RESULT.vote1;
						vote2			= xml.RESULT_LIST[i].RESULT.vote2;
						linkss			= xml.RESULT_LIST[i].RESULT.linkss;

						pp +='<div style="position:absolute;top:0px;; width:150px; height:130px; margin-top:0px;display:none;z-index:100;" id="comics'+types+cgd+'_'+idx+'_">';

						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_tl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;width:120px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_tr"></div>';
						pp +='	</div>';


						pp +='	<div style="clear:both;">';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_m_c.gif);background-repeat:repeat-y;width:13px;height:96px;position:relative;"></div>';
						pp +='		<div style="float:left;width:130px;height:96px;background:#ffffff;overflow:hidden;">';
						pp +='			<div class="font_bold font_height02" style="padding-top:5px;"> ['+gr+'] '+title+'</div>';
						pp +='			<div class="font_height01" >'+writer+'<br />'+vol+'화 '+'';
						if(finals == "Y"){ pp +='			<img alt="완결" src="/images/comic/icon/complete_icon_2.gif" />'; }
						pp +='				 | '+money+" 캐시<br />"+paytype+'</div>';
						pp +='			<div class="font_height02 text_align03" style=" padding-bottom:5px;">';
						pp +='				<div style="float:left;width:77px;height:15px;background:#ffffff url(/images/comic/genre_main/list_star_.gif);">';
						pp +='					<div style="height:15px;overflow:hidden;width:'+vote1+'%"><img src="/images/comic/genre_main/list_star.gif" /></div>';
						pp +='				</div>';
						pp +='			</div>';	
						pp +='			<div class=" font_bold font_color01" style="float:left;">&nbsp;'+vote2+'점</div>';
						pp +='		</div>';								
						pp +='		<div style="float:left;background:url(/images/newalt/tooltip_m_c.gif);background-position:0px 0px;background-repeat:repeat-y;width:6px;height:96px;overflow:hidden;position:relative;top:0px;"></div>';
						pp +='	</div>';

 
						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_bl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;background-position:0px 10px;width:120px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_br"></div>';
						pp +='	</div>';
						pp +='</div>';





						if(i == 0){
							html += '<div style="margin: 12px 0pt 0pt 30px; display: inline;" class="float_l">';
							html += '	<div onclick="location.href=\''+linkss+'\'" onmouseout="comicsSelectmouseout(this)" onmousemove="comicsSelectmousemove(this,event);" class="comicsSelect links" id="comics'+types+cgd+'_'+idx+'" style="position: relative; top: 0px; left: 0px;">';
							html += '		<img class="board_all" src="/lib/img.php?n='+img+'">';
							if(cd_age == "P"){
								html += '	<img src="/images/comic/icon/19.png" class="adult19mark" style="position:absolute;top:6px;left:176px;" />';
							}
							html += '	</div>';
							html += pp;

							html += '	<div class="text_align01" style="margin-top:4px;">';
							colortemp = (color == "Y")?"c":"b";
							html += '		<img src="/images/comic/icon/book_icon_'+colortemp+'.gif" class="links" id="orderviewtopmenu'+cgd+'_'+idx+'"/>';
							html += '		<span class="font_bold"><a href="/comic/comicdetail.php?cd='+idx+'">'+title+'</a></span>';
							html += '	</div>';

							html += '	<div class="text_align01"><A HREF="/comic/comicWriterDetail.php?cw='+writerx+'">'+writer+'</A></div>';
							html += '</div>';
						}else{
							if(i==1){ html += '<div class="float_l" style=" margin:12px 0 0 30px; display:inline;">';}
							
							html += '<div class="float_l" style=" margin-right:5px;" >';
								
							html += '	<div style="width:113px; height:128px;position:relative;" onclick="location.href=\''+linkss+'\'"  onmousemove="comicsSelectmousemove(this,event);" onmouseout="comicsSelectmouseout(this);"  id="comics'+types+cgd+'_'+idx+'" class=" links" >'; 
							gg = (i>5)?"02":"";
							html += '		<img src="/images/mypage/bg/book_bg'+gg+'.gif" style="position:absolute;z-index:1;top:1px;left:0px;width:113px; height:127px;"/>';
							html += '		<img src="/lib/img.php?n='+img+'" style="position:relative;z-index:1;" />';
							if(cd_age == "P"){
								html += '	<img src="/images/comic/icon/19.png" class="adult19mark" style="position:absolute;top:6px;left:65px;z-index:3;" />	';
							}								
							html += '	</div>';							
							html += pp;

							html += '</div>';


							

							if(!temp){
								gg = (i>5)?"_":"";
								html += '</div> <div class="float_r" style=" margin-right:15px; display:inline;" id="dae1212B2_bar"><img src="../images/main/script/bar'+gg+'.gif" alt="책장" /></div><div class="float_l" style=" margin:6px 0 0 30px; display:inline;" >';		
							}

						}

					}

					if(temp){
						html += '</div> <div class="float_r" style=" margin-right:15px; display:inline;" ><img src="../images/main/script/bar_.gif" alt="책장" />';
					}

					if(i){ html += '</div>'; }

					$("#dae1212_"+types+"_"+cgd).html(html);

					break;
				case "somenuindex": //찜목록 셀 체크

					var types = xml.REQUEST.REQ_DATA1;
					var cgd = xml.REQUEST.REQ_DATA2;

					var num = xml.RESULT_LIST.length;
					var html = pp = vol = finals = linkss = gg = money = gr = paytype = img = cd_age = color = title = writer = writerx ="";
					var idx=vote1=vote2=temp=0;

					var colortemp = "";
					for(var i=0;i<num;i++){

						idx		= xml.RESULT_LIST[i].RESULT.cd_idx;
						img		= xml.RESULT_LIST[i].RESULT.img;
						cd_age	= xml.RESULT_LIST[i].RESULT.cd_age;
						color		= xml.RESULT_LIST[i].RESULT.color;
						title		= xml.RESULT_LIST[i].RESULT.title;
						writer	= xml.RESULT_LIST[i].RESULT.writer;
						writerx	= xml.RESULT_LIST[i].RESULT.writerx;
						vol		= xml.RESULT_LIST[i].RESULT.vol;
						finals		= xml.RESULT_LIST[i].RESULT.finals;
						money	= xml.RESULT_LIST[i].RESULT.money;
						paytype	= xml.RESULT_LIST[i].RESULT.paytype;
						gr			= xml.RESULT_LIST[i].RESULT.gr;
						vote1			= xml.RESULT_LIST[i].RESULT.vote1;
						vote2			= xml.RESULT_LIST[i].RESULT.vote2;
						linkss			= xml.RESULT_LIST[i].RESULT.linkss;



						pp +='<div style="position:absolute;top:0px;; width:175px; height:120px; margin-top:0px;display:none;z-index:5;" id="comics'+cgd+'_'+idx+'_">';
						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_tl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;width:145px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_tr"></div>';
						pp +='	</div>';
						pp +='	<div style="clear:both;">';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_m_c.gif);background-repeat:repeat-y;width:13px;height:86px;position:relative;"></div>';
						pp +='		<div style="float:left;width:155px;height:86px;background:#ffffff;overflow:hidden;">';

						pp +='			<div style="padding:0px 0px 0px 0px;">';
						pp +='				<div class="font_bold font_height02" style="padding-top:0px; padding-bottom:0px;">'+title+'</div>';
						pp +='				<div class="font_height01" >'+writer+'<br />'+vol+'화';
						if(finals == 'Y'){
						pp +='				<img alt="완결" src="/images/comic/icon/complete_icon_2.gif" /> | ';
						}
						pp +='				<img alt="가격" src="../images/comic/icon/won_icon.gif" />'+money+' 캐시<br /> '+paytype+' 컨텐츠 입니다.';
						pp +='				</div>';
						pp +='				<div class="font_height02 text_align03" style=" padding-bottom:5px;">';
						pp +='					<div style="float:left;width:77px;height:15px;background:url(/images/comic/genre_main/list_star_.gif);">';
						pp +='						<div style="height:15px;overflow:hidden;width:'+vote1+'%"><img src="/images/comic/genre_main/list_star.gif" /></div>';
						pp +='					</div>';
						pp +='					<div class=" font_bold font_color01" style="float:left;">&nbsp;'+vote2+'점</div>';
						pp +='				</div>';
						pp +='			</div>';							
										
						pp +='		</div>';
						pp +='		<div style="float:left;background:url(/images/newalt/tooltip_m_c.gif);background-position:0px 0px;background-repeat:repeat-y;width:6px;height:86px;overflow:hidden;position:relative;top:0px;"></div>';
						pp +='	</div>';
						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_bl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;background-position:0px 10px;width:145px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_br"></div>';
						pp +='	</div>';
						pp +='</div>';



						left = (!i)?"12":"0";

						html += '<div class="float_l" style="margin-left:'+left+'px;">';
						html += '	   <div style="width:113px; height:130px;position:relative;" class="text_align03 comicsSelect"  id="comics'+cgd+'_'+idx+'" onmouseout="comicsSomouseout(this)" onmousemove="comicsSomousemove(this,event);"> ';
						html += '		<img src="/images/mypage/bg/book_bg.gif" style="position:absolute;top:1px;left:0px;z-index:1;"/>';
						html += '		<a href="'+linkss+'"><img src="/lib/img.php?n='+img+'"  style="border:2px solid #666666;border-top:1px;border-left:1px;border-bottom:0px;z-index:2;position:absolute;top:0px;left:0px" /></a> ';
						if(cd_age == "P"){
						html += '			<img src="/images/comic/icon/19.png" class="png24" style="position:absolute;top:6px;left:65px;z-index:3;" />';	
						}
						html += '	   </div>';
						html += '	 </div>';

						html += pp;
					}
					
					$("#"+types+"_item_"+cgd).html(html);
					break;
				case "somenuindex2": //새로운 찜목록 셀 체크

					var types = xml.REQUEST.REQ_DATA1;
					var cgd = xml.REQUEST.REQ_DATA2;

					var num = xml.RESULT_LIST.length;
					var html = pp = vol = finals = linkss = gg = money = gr = paytype = img = cd_age = color = title = writer = writerx ="";
					var idx=vote1=vote2=temp=0;

					var colortemp = "";
					for(var i=0;i<num;i++){

						idx		= xml.RESULT_LIST[i].RESULT.cd_idx;
						img		= xml.RESULT_LIST[i].RESULT.img;
						cd_age	= xml.RESULT_LIST[i].RESULT.cd_age;
						color		= xml.RESULT_LIST[i].RESULT.color;
						title		= xml.RESULT_LIST[i].RESULT.title;
						writer	= xml.RESULT_LIST[i].RESULT.writer;
						writerx	= xml.RESULT_LIST[i].RESULT.writerx;
						vol		= xml.RESULT_LIST[i].RESULT.vol;
						finals		= xml.RESULT_LIST[i].RESULT.finals;
						money	= xml.RESULT_LIST[i].RESULT.money;
						paytype	= xml.RESULT_LIST[i].RESULT.paytype;
						gr			= xml.RESULT_LIST[i].RESULT.gr;
						vote1			= xml.RESULT_LIST[i].RESULT.vote1;
						vote2			= xml.RESULT_LIST[i].RESULT.vote2;
						linkss			= xml.RESULT_LIST[i].RESULT.linkss;



						pp +='<div style="position:absolute;top:0px;; width:175px; height:120px; margin-top:0px;display:none;z-index:5;" id="comics'+cgd+'_'+idx+'_">';
						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_tl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;width:145px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_tr"></div>';
						pp +='	</div>';
						pp +='	<div style="clear:both;">';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_m_c.gif);background-repeat:repeat-y;width:13px;height:86px;position:relative;"></div>';
						pp +='		<div style="float:left;width:155px;height:86px;background:#ffffff;overflow:hidden;">';

						pp +='			<div style="padding:0px 0px 0px 0px;">';
						pp +='				<div class="font_bold font_height02" style="padding-top:0px; padding-bottom:0px;">'+title+'</div>';
						pp +='				<div class="font_height01" >'+writer+'<br />'+vol+'화';
						if(finals == 'Y'){
						pp +='				<img alt="완결" src="/images/comic/icon/complete_icon_2.gif" /> | ';
						}
						pp +='				<img alt="가격" src="../images/comic/icon/won_icon.gif" />'+money+' 캐시<br /> '+paytype+' 컨텐츠 입니다.';
						pp +='				</div>';
						pp +='				<div class="font_height02 text_align03" style=" padding-bottom:5px;">';
						pp +='					<div style="float:left;width:77px;height:15px;background:url(/images/comic/genre_main/list_star_.gif);">';
						pp +='						<div style="height:15px;overflow:hidden;width:'+vote1+'%"><img src="/images/comic/genre_main/list_star.gif" /></div>';
						pp +='					</div>';
						pp +='					<div class=" font_bold font_color01" style="float:left;">&nbsp;'+vote2+'점</div>';
						pp +='				</div>';
						pp +='			</div>';							
										
						pp +='		</div>';
						pp +='		<div style="float:left;background:url(/images/newalt/tooltip_m_c.gif);background-position:0px 0px;background-repeat:repeat-y;width:6px;height:86px;overflow:hidden;position:relative;top:0px;"></div>';
						pp +='	</div>';
						pp +='	<div style="clear:both;">';
						pp +='		<div class="altbox_bl"></div>';
						pp +='		<div style="float:left;background:#ffffff url(/images/newalt/tooltip_t_c.gif);background-repeat:repeat-x;background-position:0px 10px;width:145px;height:13px;overflow:hidden;"></div>';
						pp +='		<div class="altbox_br"></div>';
						pp +='	</div>';
						pp +='</div>';



						left = (!i)?"10":"11";


						html += '<div class="float_l" style="margin-left:'+left+'px;">';
						html += '	   <div style="width:100px; height:130px;position:relative;" class="text_align03 comicsSelect"  id="comics'+cgd+'_'+idx+'" onmouseout="comicsSomouseout(this)" onmousemove="comicsSomousemove(this,event);"> ';
						html += '		<img src="/images/mypage/bg/book_bg.gif" style="position:absolute;top:1px;left:0px;z-index:1;"/>';
						html += '		<a href="'+linkss+'"><img src="/lib/img.php?n='+img+'"  style="border:2px solid #666666;border-top:1px;border-left:1px;border-bottom:0px;z-index:2;position:absolute;top:0px;left:0px" alt="'+i+'"/></a> ';
						if(cd_age == "P"){
						html += '			<img src="/images/comic/icon/19.png" class="png24" style="position:absolute;top:6px;left:65px;z-index:3;" />';	
						}
						html += '	   </div>';
						html += '	 </div>';

						html += pp;
					}
					
					$("#"+types+"_item_"+cgd).html(html);
					break;
				case "msgCheck":	//찜목록 셀 체크
					if(xml.RESULT_LIST[0].RESULT.RST_DATA2 == "1"){
						$("#msgbox_have1").show();
						$("#msgbox_have2").hide();
						$("#msgbox_have3").hide();
					}else if(xml.RESULT_LIST[0].RESULT.RST_DATA2 == "0"){
						$("#msgbox_have1").hide();
						$("#msgbox_have2").show();
						$("#msgbox_have3").hide();
					}else{
						$("#msgbox_have1").hide();
						$("#msgbox_have2").hide();
						$("#msgbox_have3").show();
					}

				break;
			}
		},
		complete: function(XMLHttpRequest, textStatus){
//			success 실행후에 
//			alert(XMLHttpRequest);
		}
	});
}
