/**
	vip 페이지 가격 정보 
**/

// 브라우저 체크	
var isie=(navigator.userAgent.toLowerCase().indexOf('msie')!=-1)? true : false;
var isie6=(navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1)? true : false;
//var isie7=(navigator.userAgent.toLowerCase().indexOf('msie 7')!=-1)? true : false;	
if(navigator.userAgent.toLowerCase().indexOf('msie 7')!=-1){
 isie6=false;
 var isie7=true;
}
if(navigator.userAgent.toLowerCase().indexOf('msie 8')!=-1){
 isie6=false;
 var isie8=true;
}
var isfirefox=(navigator.userAgent.toLowerCase().indexOf('firefox')!=-1)? true : false;
var isopera=(navigator.userAgent.toLowerCase().indexOf('opera')!=-1)? true : false;

function printSWF(id, flashUri, vWidth, vHeight, winMode, bgColor, flashVars) {
	var _obj_ = "";
	if(isie){
		_obj_ += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + vWidth + '" height="' + vHeight + '" id="' + id + '" name="' + id + '" align="middle">';
		_obj_ += '<param name="allowScriptAccess" value="always" />';
		_obj_ += '<param name="allowFullScreen" value="true" />';
		_obj_ += '<param name="movie" value="' + flashUri + '" />';
		_obj_ += '<param name="quality" value="high" />';
		_obj_ += '<param name="wmode" value="' + winMode + '" />';
		_obj_ += '<param name="bgcolor" value="' + bgColor + '" />';
		_obj_ += '<param name="flashvars" value="' + flashVars + '"/>';
		_obj_ += '</object>';
	}else{
		_obj_ += '<embed src="' + flashUri + '" quality="high" wmode="' + winMode + '" bgcolor="' + bgColor + '" width="' + vWidth +'" height="' + vHeight + '" id="' + id + '" name="' + id + '" flashvars="' + flashVars + '" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>    ';
	}
	document.writeln( _obj_ );
	eval("window." + id + " = document.getElementById('" + id + "');");
}



// 플래시를 찾는 함수
function thisMovie(movieName) {
  if (navigator.appName.indexOf("Microsoft") != -1) {
      return window[movieName];
      } else {
       return document[movieName];
   }
}
// 가격 세팅
function setPrice(flash_id, price) {
	thisMovie(flash_id).addFLData(price, 0);
}
function resizePriceWidth(wrapper_id, price) {
	var wrapper = document.getElementById(wrapper_id);
	wrapper.style.width = calcPriceWidth(price) + 'px';
}

/////////////////////////////////




var rankIndex = 1;
var itemCount;

function regFavoriteGood( itemID  ) {
	alert( "관심물품 등록" + itemID );

	window.open('/comic/ajaxRegAddFavoriteItem.htm?itemID=' + itemID);
	
}
function rankset(cnt){
	itemCount = cnt;
	for(i = 4 ; i <= itemCount ; i++){
		document.getElementById('Item'+i).style.display = "none";
	}	
}
function rankdown(){
	if(rankIndex+3 <= itemCount){
		document.getElementById('Item' + (rankIndex)).style.display = "none";
		document.getElementById('Item' + (rankIndex+3)).style.display = "";
		rankIndex = rankIndex + 1;
	}			
}
function rankUp(){
	if (rankIndex-1 > 0){	
		document.getElementById('Item' + (rankIndex-1)).style.display = "";
		document.getElementById('Item' + (rankIndex+2)).style.display = "none";
		rankIndex = rankIndex - 1;
	}		
}
function displayVeiw(flag){
	listType = flag;
	if(flag=='image'){ 
		document.getElementById('listview').style.display = "none";
		document.getElementById('imageview').style.display = "";
		document.getElementById('imgTypeImg').src ='/images/page/listviewtypy_image_on.gif';
		document.getElementById('listTypeImg').src = '/images/page/listviewtypy_list.gif';
	}
	else if(flag=='list'){
		document.getElementById('listview').style.display = "";
		document.getElementById('imageview').style.display = "none";
		document.getElementById('imgTypeImg').src ='/images/page/listviewtypy_image.gif';
		document.getElementById('listTypeImg').src = '/images/page/listviewtypy_list_on.gif';
	}
}
//라이브 상품의 경우 구매 가능 기간 체크 
function checkLivePeriod(id){

// 월 : 128112 || 수 : 128121 || 금 : 128122
   if(id== 128112 || id== 128121 || id== 128122){
		new Ajax.Request('/adult/ajaxLivePermittedPeriodCheck.htm',{
			method:'post',
			parameters:{id: id},
			onSuccess : function(re){
				var ret = eval( "(" + re.responseText + ")" );
				if(ret.result == true){
					goods_buy(id);
				}else{
					alert(" 구매 가능 시간이 아닙니다. 방송 당일 00시 부터 22시까지 \n 당일 \"라이브 방송 생중계 채널 이용권\" 구매가 가능합니다.");
				}
			},
			onFailure : function(){
			
			}
		});
	}else{
		goods_buy(id);
	}
}
function goods_buy( id ) {
	//430 X 287
	window.open('/viewCommon/popupGoodBuy.htm?goodsId='+id,'goods_buy','width=450,height=357,toolbar=no,status=no,location=no,scrollbars=no,menubar=no');
}

function contents_view( id, width, height, unit ){

	window.open('/viewCommon/popupView.htm?goodsId='+id,'runContent','width='+width+unit+',height='+height+unit+',location=no, scrollbars=1');

}

// for manhwa, manhwa_19
function contents_view2( parentId, id, width, height, unit ){	

	window.open('/viewCommon/popupView.htm?isOpen=Y&parentGoodsId='+parentId+'&goodsId='+id,'runContent2','width='+width+unit+',height='+height+unit+',location=no');

}

function writer_view(url){
	window.open(url,'viewPop_up','width=790 height=600');
}
function goVIP(id){
	if( id > 0 ) {
		location.href="./view.htm?id="+id;
	}
}
function goVIP_ComicAdult(id){
	if( id > 0 ) {
		location.href="./comic_view.htm?id="+id;
	}
}
function goVIP_VodAdult(id){
	if( id > 0 ) {
		location.href="./vod_view.htm?id="+id;
	}
}
function sameTab(n){
	if(n == 1){
		document.getElementById("TR_sameWriter").style.display = "";
		document.getElementById("TR_sameCompany").style.display = "none";
	}else{
		document.getElementById("TR_sameWriter").style.display = "none";
		document.getElementById("TR_sameCompany").style.display = "";
	}
	
}

function goods_contents(id , max){
	
	for(var i=0;i<max;i++){
		if(i != id){
			document.getElementById("1_qna_"+i).style.display="none";
			document.getElementById("2_qna_"+i).style.display="none";
			document.getElementById("3_qna_"+i).style.display="none";
			document.getElementById("4_qna_"+i).style.display="none";
		}
	}
	
	document.getElementById("1_qna_"+id).style.display=='none' ? document.getElementById("1_qna_"+id).style.display = "" : document.getElementById("1_qna_"+id).style.display = "none";
	document.getElementById("2_qna_"+id).style.display=='none' ? document.getElementById("2_qna_"+id).style.display = "" : document.getElementById("2_qna_"+id).style.display = "none";
	document.getElementById("3_qna_"+id).style.display=='none' ? document.getElementById("3_qna_"+id).style.display = "" : document.getElementById("3_qna_"+id).style.display = "none";
	document.getElementById("4_qna_"+id).style.display=='none' ? document.getElementById("4_qna_"+id).style.display = "" : document.getElementById("4_qna_"+id).style.display = "none";

}

function goods_detail(url){
	//alert(url);
	window.open(url,'goods_detail');
}

function openCoupon( itemId, category, price ) {
	window.open( 'http://reward.auction.co.kr/Coupon/CouponDownload.aspx?itemno=' + itemId + '&category=' + category + '&method=4470&buyPrice='+price,
			'coupon',
			'width=50,height=100,location=no' );
}

/*********************
옥션 vip 페이지에 있는 스크립트 
**********************/
//신고 하기 팝업
function mail119Open(itemno, option){
 window.open('http://member.auction.co.kr/help/Mailcheck.aspx?itemno='+itemno+'&mail119=1&option=' + option , '119','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=713,height=524, left=120,top=160').focus();
}
//직거래유도| 판매방식부적합| 권리침해(이미테이션)| 기타불법물 및 음란표현물| 식품/ 화장품/ 의료용구 관련법 위반  팝업
function newHelpPop(param){
	window.open('http://member.auction.co.kr/help/InLineHelp.aspx?newhelpcode=1&code=' + param,'help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=713,height=524, left=120,top=160').focus();
}
//부정확한 판매자 정보 신고 팝업
function CorporateMemberInfo() {}
CorporateMemberInfo.ReportInvalidInfo = function(ItemNo) {
 mail119Open(ItemNo, "C1");
}
function firstHelpPop(ItemNo, type ,  code){
	if(type == 'H'){
		window.open('http://member.auction.co.kr/help/inlinehelp.aspx?cu=http://itempage3.auction.co.kr/DetailViewContents.aspx?ItemNo='+ItemNo+'&frm=hphotitem4&bodypage=helpbody_content.asp?HCode='+code,'help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=713,height=524, left=120,top=160').focus();
	}else if(type == 'K'){
		window.open('http://www.auction.co.kr/securitycenter/popup/pop_security.asp?code='+code,'help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=713,height=524, left=120,top=160').focus();
	}
	
}
					
