﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />

$(document).ready(function() {
	// design.js 를 사용하지 않는 곳의 에러 방지를 위해서 try catch 함.
	try {
		$('ul.prod-hrzn').pngFix();
	}
	catch (e) { }
});

// 개발시 사용. 모든 Attribute 정보 보기
function showInfo(idName) {
	var strPrint = '';

	var oAttribs = document.getElementById(idName).attributes;
	for (var i = 0; i < oAttribs.length; i++) {
		var oAttrib = oAttribs[i];

		if (oAttrib.specified) {
			strPrint += oAttrib.nodeName + '=' + oAttrib.nodeValue + "\n\n";
		}
	}

	alert(strPrint);
}


// Repeater 안의 컨트롤에 대해서 이벤트를 연결 한다.
$.fn.bindListControlEvent = function() {
	//	// 시간 테스트...
	//var vStart = new Date();
	var selector = $(this);
	var Items = $('[id$=CurrentItemAttributeContainer]', selector); 	// 140

	if (Items.length == 0) {

		var noneMessage = "";
		noneMessage += "<table summary='제품 목록' class='prod-list'>";
		noneMessage += "	<colgroup>";
		noneMessage += "		<col width='30'  />";
		noneMessage += "		<col width='120'  />";
		noneMessage += "		<col  />";
		noneMessage += "		<col width='63' />";
		noneMessage += "		<col width='160'  />";
		noneMessage += "	</colgroup>";
		noneMessage += "	<tr class='lastLine'>";
		noneMessage += "		<td colspan='5'>";
		noneMessage += "			<p class='list-none'>";
		noneMessage += "				<span>검색결과</span>가 없습니다.";
		noneMessage += "			</p>";
		noneMessage += "		</td>";
		noneMessage += "	</tr>";
		noneMessage += "</table>";

		//$(this).append(noneMessage);
	}

	Items.each(function() {
		var $item = $(this); 		// 140
		var $IsCatalog = $item.attr("IsCatalog"); 	// 156

		// 무료배송, 무이자, 쿠폰, 이벤트 등의 아이콘을 담고 있는 레이어에 이벤트 연결
		//var ico_list = $('div.special div.ico-list', $item);    // 3735 <--- 여기서 시간이 오래 걸림
		//		var ico_list = $('div.ico-list', $item);    // 203  윗줄에 비해서 훨씬 시간이 줄어듬. (왠지 자세히 찾아주면 시간이 줄어들것 같았는데, 그게 아니었다)

		//		ico_list.each(function() {
		//			if ($IsCatalog != "True") {			// 카탈로그 상품이 아니면 보여준다(일반상품 + 중고상품)
		//				var $ico_list = $(this);
		//				var layer = $('div.specialList', $ico_list);

		//				$ico_list.bind('mouseenter', function() {
		//					layer.css('z-index', '1000');
		//					layer.css('z-index', '1000').show();
		//				});

		//				$ico_list.bind('mouseleave', function() {
		//					layer.css('z-index', '');
		//					layer.css('z-index', '').hide();
		//				});
		//			}
		//		});  // 234

		// 가격에 마우스를 올릴때 기준일자 보이도록 이벤트 연결
		//var date_list = $('.price div.price-date', $item);		// 4407
		//var date_list = $('div.price-date', $item); 	// 442 윗줄에 비해서 훨씬 시간이 줄어듬. 
		var date_list = $item.find("div.price-date");

		date_list.each(function() {
			var $list = $(this);
			var layer = $list.find('div.date');
			var parentT = $list.parents("table.prod-listn");

			$list.bind('mouseenter', function() {
				parentT.css('z-index', '5');
				layer.css('z-index', '1000');
				//layer.show();
				layer.attr("ismouseenter", "y"); 	// 즉시 보여주지 않고 시간차를 주기 위함
				showLayerBySetTimeout(layer);   // 즉시 보여주지 않고 시간차를 주기 위함
			});

			$list.bind('mouseleave', function() {
				parentT.css('z-index', '');
				layer.css('z-index', '');
				layer.attr("ismouseenter", "n");
				layer.hide();
			});
		}); 		// 442

		// 제목, 가격비교버튼, 상품평 등을 클릭했을때 이벤트를 걸어준다.
		//var job_list = $('[ListControlJobId]', $item);			// 594
		var job_list = $item.find('[ListControlJobId]');

		job_list.each(function() {
			var $list = $(this);

			$list.bind('click', function() {
				var jobId = $(this).attr("ListControlJobId");

				doClickJobListControl($item, jobId, this);
			});

			$list.css('cursor', 'pointer');
		});
	});  // 1109

	//var vEnd = new Date();
	//alert("시작시간 : "+vStart+", 종료시간 : "+vEnd+", 소요시간 : " + (vEnd.getTime() - vStart.getTime()));
}

function showLowestLayer(sender) {
	var $this = $(sender);
	var layer = $this.find('div.date');

	layer.css('z-index', '1000');
	//layer.show();
	layer.attr("ismouseenter", "y"); 	// 즉시 보여주지 않고 시간차를 주기 위함
	showLayerBySetTimeout(layer);   // 즉시 보여주지 않고 시간차를 주기 위함
}

function hideLowestLayer(sender) {
	var $this = $(sender);
	var layer = $this.find('div.date');

	layer.css('z-index', '');
	//layer.show();
	layer.attr("ismouseenter", "n"); 	// 즉시 보여주지 않고 시간차를 주기 위함
	layer.hide();
}

// 즉시 보여주지 않고 시간차를 주기 위함
function showLayer(obj) {
	if ($(obj).attr("ismouseenter") == "y") {
		$(obj).show();
		$(obj).css("z-index", "1000");
	}
}

// 즉시 보여주지 않고 시간차를 주기 위함
function showLayerBySetTimeout(obj) {
	setTimeout(function() {
		showLayer(obj);
	}, 500);
}


// 묶어보기 Repeater 안의 컨트롤에 대해서 이벤트를 연결 한다.
$.fn.bindListControlEventSub = function() {
	var selector = $(this);
	//var Items = $('[id$=CurrentItemAttributeContainerSub]', selector);
	var Items = selector.find('[id$=CurrentItemAttributeContainerSub]');
	var mores = selector.find("[id$=divMoreCatalog] a");

	Items.each(function() {
		var $item = $(this);

		//var job_list = $('[ListControlJobIdSub]', $item);
		var job_list = $item.find('[ListControlJobIdSub]');

		job_list.each(function() {
			var $list = $(this);

			$list.bind('click', function() {

				var jobId = $(this).attr("ListControlJobIdSub");
				doClickJobListControl($item, jobId, this);
			});

			$list.css('cursor', 'pointer');
		});
	});

	//	// 묶음보기 Repeater에 대한 더보기 이벤트를 처리한다.	
	//	mores.bind("click", function(e)
	//	{
	//		e.preventDefault();
	//		
	//		var $this = $(this), display = $this.attr("IsDisplay");

	//		doMoreCatalog($this, 4, display);

	//		if (display == "true") {
	//			$this.attr("IsDisplay", "false");
	//		}
	//		else {
	//			$this.attr("IsDisplay", "true");
	//		}
	//	});
}

// Hybrid 로 넘겼다가 다시 사용할 목적으로 parameter 들을 생성 합니다.
// 이미 사용하는 파라미터 들은 제거 합니다.
function makeHybridCallbackData() {

	var serialized = [];
	for (var key in gPageState) {
		var value = gPageState[key];
		if (key.indexOf('=') !== -1) throw "argument state";

		// hybrid 에서 이미 정의된 파라미터값은 gPageState 값을 사용하지 않는다.
		// 제거를 하지 않으면, 받는쪽에서 request 를 할때 배열 형태값을 받게 된다.
		if (ContainHybridparameter(key) == false) {
			//serialized[serialized.length] = key + '=' + escape(value);
			serialized[serialized.length] = key + '=' + value;   //2010.11.23 수정 by 이동열(한글처리 변경으로 인한 escape 제거)
		}
	}

	return serialized.join('&');
}

// Hybrid 에서 사용하는 정의된 파라미터가 있는지 검사한다.
function ContainHybridparameter(key) {
	var retValue = false;

	var UsedParameter = Array();
	UsedParameter.push('isCatalog');
	UsedParameter.push('catalogIDs');
	UsedParameter.push('cpcType');
	UsedParameter.push('viewCode');
	UsedParameter.push('viewDisplayCategories');
	UsedParameter.push('viewItemIndex');
	UsedParameter.push('viewTabIndex');
	UsedParameter.push('mallId');
	UsedParameter.push('itemId');

	for (var i = 0; i < UsedParameter.length; i++) {
		if (key.toLowerCase() == UsedParameter[i].toLowerCase()) {
			retValue = true;
			break;
		}
	}

	return retValue;
}

// inbridge로 넘길 paramater를 만든다. (gPageState에서 추출한 정보들)
function inbridgeParameters() {

	var serialized = new Array();
	var parameters = new Array()

	parameters.push("DisplayCategories");
	parameters.push("Keyword");
	parameters.push("PageIndex");
	parameters.push("PageSize");
	parameters.push("FindingType");
	parameters.push("ListingType");
	parameters.push("SortType");

	for (var i = 0; i < parameters.length; i++) {
		serialized.push(parameters[i] + '=' + escape(gPageState[parameters[i]]));
	}

	return serialized.join('&');
}


function showStyleSearchIconWide(sender) {
	//$(sender).parent().find("[id$=_iconStyleSearchWide]").show();
	$(sender).closest("[id$=_CurrentItemAttributeContainer]").find("[id$=_iconStyleSearchWide]").show();
	$(sender).closest("[id$=_CurrentItemAttributeContainerConnectedService]").find("[id$=_iconStyleSearchWide]").show();  // 옥션/지마켓 iframe 
	
}

function hideStyleSearchIconWide(sender) {
	//$(sender).parent().find("[id$=_iconStyleSearchWide]").hide();
	$(sender).closest("[id$=_CurrentItemAttributeContainer]").find("[id$=_iconStyleSearchWide]").hide();
	$(sender).closest("[id$=_CurrentItemAttributeContainerConnectedService]").find("[id$=_iconStyleSearchWide]").hide();  // 옥션/지마켓 iframe 
}

function doClickJobListControl(SelectedItem, jobId, sender) {

	var $SelectedItem = $('[id=' + SelectedItem.attr('id') + ']');

	// 공통 ListControl 이 두개 이상 있는 경우 처리 (QuickBuy)
	if ($SelectedItem.length > 1) {
		$this = $(sender);

		// 가장 가까운 곳에 있는 객체로 filtering
		$SelectedItem = $this.closest('[id=' + SelectedItem.attr('id') + ']');
	}

	var DisplayCategories = gPageState.DisplayCategories;
	var CatalogID = $SelectedItem.attr("CatalogID");
	var ViewCode = $SelectedItem.attr("ViewCode");
	var ViewDisplayCategories = $SelectedItem.attr("ViewDisplayCategories");
	var ViewItemIndex = $SelectedItem.attr("ViewItemIndex");
	var ViewTabIndex = $SelectedItem.attr("ViewTabIndex");
	var VItemType = $SelectedItem.attr("VItemType");
	var IsCatalog = ($SelectedItem.attr("IsCatalog") == 'True');
	var ItemID = $SelectedItem.attr("MItemID");
	var ItemIndex = $SelectedItem.attr("ItemIndex");
	var MallID = $SelectedItem.attr("MallID");
	var VItemID = $SelectedItem.attr("VItemID");
	//var cpcType = IsCatalog ? 1 : 0										// 카탈로그일 경우 1 , 일반상품일 경우 0
	var cpcType = $SelectedItem.attr("CpcType"); 			// 명시적으로 지정하도록 수정
	var type = IsCatalog ? "catalog" : "product"
	var ID = IsCatalog ? CatalogID : ItemID
	var IsPCP = ($SelectedItem.attr("IsPCP") == 'True'); 	// PCP 에서 클릭한것인지 여부
	var claimType = IsCatalog ? 1 : 0; 									// 신고하기 (카탈로그일 경우 1, 일반상품 0)
	var BridgeType = $SelectedItem.attr("bridgetype");
	var ChannelID = $SelectedItem.attr("channelid");
	var RepresentDisplayCategory = $SelectedItem.attr("RepresentDisplayCategory"); 	// 대표전시 카테고리
	var IsInBridge = false;
	var inBridgeType = 1; 	// 1:inbridge.aspx?dispaly... params형식
	// 2:inbridge.aspx?channalid=xxx&targetUrl=...형식
	var targetUrl = ""; 		// 이동하거나 window.open할 url
	var options = ""; 			// window.open시 windows창의 option
	var title = ""; 				// window.open시 title
	var IsOpen = true; 		// window.open인지의 여부
	var IsFlowerGardenLink = $SelectedItem.attr("FlowerGardenLink") == "true";

	// IsRequiredAdultAuth 로직
	// 성인상품인 경우 :  로그인을 안했을 경우 1
	//													 로그인을 했고 성인인 경우 0
	//													 로그인을 했고 성인이 아닌경우 1
	// 성인상품이 아닌경우 : 항상 0 값이 들어있음
	var IsRequiredAdultAuth = $SelectedItem.attr("IsRequiredAdultAuth")

	// IsUnderAge 로직
	// 로그인을 안한 경우 : 0
	// 로그인을 한 경우 : 성인 - 0
	//                           미성년자 - 1
	var IsUnderAge = $SelectedItem.attr("IsUnderAge")

	if (ViewCode == null || ViewCode == "undefined") {
		ViewCode = "";
	}

	if (ViewDisplayCategories == null || ViewDisplayCategories == "undefined") {
		ViewDisplayCategories = "";
	}

	if (ViewItemIndex == null || ViewItemIndex == "undefined") {
		ViewItemIndex = "";
	}

	if (ViewTabIndex == null || ViewTabIndex == "undefined") {
		ViewTabIndex = "";
	}

	if (IsRequiredAdultAuth == null || IsRequiredAdultAuth == "undefined") {
		IsRequiredAdultAuth = "0";
	}

	if (IsUnderAge == null || IsUnderAge == "undefined") {
		IsUnderAge = "0";
	}

	if (ItemIndex == null || ItemIndex == "undefined") {
		ItemIndex = "0";
	}

	if (cpcType == null || cpcType == "undefined") {
		cpcType = IsCatalog ? 1 : 0												// 카탈로그일 경우 1 , 일반상품일 경우 0
	}

	if (BridgeType == null || BridgeType == "undefined") {
		BridgeType = "OutBridge";
	}

	if (ChannelID == null || ChannelID == "undefined") {
		ChannelID = "";
	}

	if (RepresentDisplayCategory == null || RepresentDisplayCategory == "undefined") {
		RepresentDisplayCategory = "";
	}

	IsInBridge = BridgeType.toLowerCase() == "inbridge";


	// StyleSearch BC 에서 추가
	var Keyword = gPageState.Keyword;
	if (Keyword == null || Keyword == "undefined") {
		Keyword = '';
	}

	var KeywordsInclude = gPageState.KeywordsInclude;
	if (KeywordsInclude == null || KeywordsInclude == "undefined") {
		KeywordsInclude = '';
	}

	var KeywordsExclude = gPageState.KeywordsExclude;
	if (KeywordsExclude == null || KeywordsExclude == "undefined") {
		KeywordsExclude = '';
	}

	var MinVItemPrice = gPageState.MinVItemPrice;
	if (MinVItemPrice == null || MinVItemPrice == "undefined") {
		MinVItemPrice = '';
	}

	var MaxVItemPrice = gPageState.MaxVItemPrice;
	if (MaxVItemPrice == null || MaxVItemPrice == "undefined") {
		MaxVItemPrice = '';
	}

	var UseRepresentDisplayCategory = gPageState.UseRepresentDisplayCategory;
	if (UseRepresentDisplayCategory == null || UseRepresentDisplayCategory == "undefined") {
		UseRepresentDisplayCategory = '';
	}

	var ImageSignatureStatusType = $SelectedItem.attr("ImageSignatureStatusType");
	var ForeColor = $SelectedItem.attr("ForeColor");
	var Edge = $SelectedItem.attr("Edge");
	var Texture = $SelectedItem.attr("Texture");

	// JobID 별로 할일을 적는다.
	switch (jobId) {
		case "ImageClick":
		case "MainDescriptionClick":
		case "ItemNameClick":
		case "SetAttrElementClick": 	// 묶음보기의 속성제목
		case "MatchingItemCountClick": // 묶음보기의 판매샵 갯수
		case "GoComparePriceClick":
		case "MallLogoClick": //몰 로고 클릭
		case "GoBuyClick": //구매하기 클릭
			if (IsCatalog) {		// 카탈로그일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;

					if (IsFlowerGardenLink == true && cpcType == "3") {
						// 꽃밭이면서 cpctype이 3인 경우 outbridge를 이용할 때 targeturl를 넣어줌
						targetUrl = "targetUrl=" + encodeURI($SelectedItem.attr("MItemUrl"));
					}

					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&' + makeHybridCallbackData() + "&" + targetUrl);
				}
				else {
					if (IsFlowerGardenLink == true && cpcType == "3") {
						// 꽃밭이면서 cpctype이 3인 경우 outbridge를 이용
						targetUrl = "targetUrl=" + encodeURI($SelectedItem.attr("MItemUrl"));
					}

					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&' + makeHybridCallbackData() + "&" + targetUrl;
				}
			}
			else {								// 일반상품일경우 - 성인용품이라 하더라도 해당 사이트 구매페이지로 이동시킨다.
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;

					if (IsFlowerGardenLink == true && cpcType == "3") {
						targetUrl = "targetUrl=" + encodeURI($SelectedItem.attr("MItemUrl"));
					}

					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=0&ItemIndex=' + ItemIndex + '&mallId=' + MallID + '&itemId=' + ItemID + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&' + makeHybridCallbackData() + "&" + targetUrl);
				}
				else {
					if (IsFlowerGardenLink == true && cpcType == "3") {
						targetUrl = "targetUrl=" + encodeURI($SelectedItem.attr("MItemUrl"));
					}

					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=0&mallId=' + MallID + '&itemId=' + ItemID + '&cpcType=' + cpcType + '&ItemIndex=' + ItemIndex + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&' + makeHybridCallbackData() + "&" + targetUrl;
				}
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "ZoomClick": // 확대보기
			if (IsRequiredAdultAuth == "1") {
				if (CheckUnderAge(IsUnderAge)) return;
				if (IsCatalog) {
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__findingUrl + '/Catalog/PopupCatalogImageView.aspx?catalogIDs=' + CatalogID + '&itemIDs=' + ItemID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex);
					options = "width=614, height=668";
				}
				else {
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__findingUrl + '/Category/PopupItemImageView.aspx?catalogIDs=' + CatalogID + '&itemIDs=' + ItemID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex);
					options = "width=352, height=410";
				}
			}
			else {
				if (IsCatalog) {
					targetUrl = __findingUrl + '/Catalog/PopupCatalogImageView.aspx?catalogIDs=' + CatalogID + '&itemIDs=' + ItemID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
					options = "width=614, height=668";
				}
				else {
					targetUrl = __findingUrl + '/Category/PopupItemImageView.aspx?catalogIDs=' + CatalogID + '&itemIDs=' + ItemID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
					options = "width=480, height=490";
				}
			}
			// inbridgeurl 유형을 지정
			inBridgeType = 2;
			break;
	  case "WarningClick": // 신고하기
	    targetUrl = __memberUrl + '/Complain/ProductComplain_simple.aspx?type=' + claimType + '&id=' + ID + '&mallID=' + MallID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
	    title = "warnning";
	    options = "location=0,status=0,scrollbars=0,width=590,height=280";

	    // inbridgeurl 유형을 지정
	    inBridgeType = 2;
	  break;
		case "ReviewCountClick":
			if (IsRequiredAdultAuth == "1") {
				if (CheckUnderAge(IsUnderAge)) return;
				targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__pcpUrl + '/ProductInfo.aspx?DisplayCategories=' + DisplayCategories + '&CatalogIDs=' + CatalogID + '&Tab=tab5' + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory);
			}
			else {
				targetUrl = __pcpUrl + '/ProductInfo.aspx?DisplayCategories=' + DisplayCategories + '&CatalogIDs=' + CatalogID + '&Tab=tab5' + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory;
			}
			break;
		case "ExpertReviewCountClick":
			if (IsRequiredAdultAuth == "1") {
				if (CheckUnderAge(IsUnderAge)) return;
				targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__pcpUrl + '/ProductInfo.aspx?DisplayCategories=' + DisplayCategories + '&CatalogIDs=' + CatalogID + '&Tab=tab4' + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory);
			}
			else {
				targetUrl = __pcpUrl + '/ProductInfo.aspx?DisplayCategories=' + DisplayCategories + '&CatalogIDs=' + CatalogID + '&Tab=tab4' + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory;
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "ShopZzimClick":
			targetUrl = __memberUrl + '/MyBuy/PickProduct/PickShopPop.aspx?&mid=' + MallID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
			title = "shopZzim";
			options = "left=100,top=100, width=350, height=260, resizable=no, scrollbars=no, status=no";

			// inbridgeurl 유형을 지정
			inBridgeType = 2;
			break;
		case "ZzimProductClick":
			if (IsCatalog) {	// 카탈로그일경우
				targetUrl = __memberUrl + '/MyBuy/PickProduct/PickItemPop.aspx?catalogid=' + ID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
				title = "productZzim";
				options = "left=100,top=100,width=345, height=250, resizable=no, scrollbars=no, status=no";
			}
			else {
				targetUrl = __memberUrl + '/MyBuy/PickProduct/PickItemPop.aspx?itemid=' + ID + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex;
				title = "productZzim";
				options = "left=100,top=100,width=345, height=250, resizable=no, scrollbars=no, status=no";
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 2;

			break;
		case "CatalogClick":
			if (IsRequiredAdultAuth == "1") {
				if (CheckUnderAge(IsUnderAge)) return;
				parent.window.location.href = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + "/hybridmain.aspx?isCatalog=1&catalogIDs=" + CatalogID + "&displayCategories=" + DisplayCategories + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory);
				IsOpen = false;
			}
			else {
				parent.window.location.href = __homeUrl + "/hybridmain.aspx?isCatalog=1&catalogIDs=" + CatalogID + '&ItemIndex=' + ItemIndex + "&displayCategories=" + DisplayCategories + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory;
				IsOpen = false;
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "GoComparePriceClick_FromPCP": 	// pcp 의 유사상품비교가격비교클릭에서는 Ajax 데이터를 모두 가져갈 경우 파라미터 값이 중복으로 넘어가는 문제가 있다
		case "ImageClick_FromPCP": 								// pcp 의 유사상품비교이미지클릭에서는 Ajax 데이터를 모두 가져갈 경우 파라미터 값이 중복으로 넘어가는 문제가 있다
			if (IsCatalog) {		// 카탈로그일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory);
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&cpcType=' + cpcType + '&ItemIndex=' + ItemIndex + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory;
				}
			}
			else {								// 일반상품일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=0&mallId=' + MallID + '&ItemIndex=' + ItemIndex + '&itemId=' + ItemID + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory);
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=0&mallId=' + MallID + '&itemId=' + ItemID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory;
				}
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "WingItemNameClick":
			if (IsCatalog) {
				parent.parent.CallHybrid(1, ID, MallID, '', cpcType, ViewCode);
				IsOpen = false;
			}
			else {
				parent.parent.CallHybrid(0, '', MallID, ID, cpcType, ViewCode);
				IsOpen = false;
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "WriteReviewClick": // 상품명 쓰기
			if (IsCatalog) {		// 카탈로그일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab5&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData());
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab5&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData();
				}
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "GoItemCompareClick": // 일반상품 - 가격비교하기
			if (!IsCatalog) {		// 일반상품인 경우에만 띄운다.(pcp로 이동)
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData());
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&catalogIDs=' + CatalogID + '&cpcType=' + cpcType + '&ItemIndex=' + ItemIndex + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData();
				}
			}

			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "StyleSearchClick": // 스타일검색
			// 참고) 실질적으로 VItemID 만 있으면 보이져에서 조회를 해 올수 있지만, VItemID 으로만 보이져 검색을 하는 것이 상당히 느리기 때문에, 부수적인 정보도 같이 넘겨서 조회 조건을 추가해준다.

			targetUrl = __findingUrl + '/Corner/StyleSearch/Search.aspx?Keyword=' + Keyword
				+ '&KeywordsInclude=' + KeywordsInclude
				+ '&KeywordsExclude=' + KeywordsExclude
				+ '&DisplayCategories=' + DisplayCategories
				+ '&MinVItemPrice=' + MinVItemPrice
				+ '&MaxVItemPrice=' + MaxVItemPrice
				+ '&ForeColor=' + ForeColor
				+ '&Edge=' + Edge
				+ '&Texture=' + Texture
				+ '&SelectedKeyword=' + Keyword				// 스타일검색 페이지에서 선택한스타일을 보여주기 위한 파라미터(명시적으로 넘긴다)
				+ '&SelectedCatalogID=' + CatalogID		// 스타일검색 페이지에서 선택한스타일을 보여주기 위한 파라미터(명시적으로 넘긴다)
				+ '&SelectedDisplayCategories=' + DisplayCategories		// 스타일검색 페이지에서 선택한스타일을 보여주기 위한 파라미터(명시적으로 넘긴다)
				+ '&SelectedItemID=' + ItemID				// 스타일검색 페이지에서 선택한스타일을 보여주기 위한 파라미터(명시적으로 넘긴다)
				+ '&RepresentDisplayCategory=' + RepresentDisplayCategory // 대표전시카테고리
				+ '&UseRepresentDisplayCategory=' + UseRepresentDisplayCategory // 대표전시카테고리사용여부(스타일검색, 스타일업로드 에서는 대표전시카테고리를 사용하지 않기 때문에 N 이 설정됨)
				;

			top.document.location.href = targetUrl; // 임시주석
			return;
			break;
		case "GoProductInfoClick": // 상품정보
			if (IsCatalog) {		// 카탈로그일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData());
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab1&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData();
				}
			}
			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		case "GoSimilarCompareClick": //유사상품비교
			if (IsCatalog) {		// 카탈로그일경우
				if (IsRequiredAdultAuth == "1") {
					if (CheckUnderAge(IsUnderAge)) return;
					targetUrl = __memberSSLUrl + '/login/AdultLogin.aspx?next_url=' + encodeURIComponent(__homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab3&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData());
				}
				else {
					targetUrl = __homeUrl + '/hybridmain.aspx?isCatalog=1&tab=tab3&catalogIDs=' + CatalogID + '&ItemIndex=' + ItemIndex + '&cpcType=' + cpcType + '&viewCode=' + ViewCode + '&viewDisplayCategories=' + ViewDisplayCategories + '&viewItemIndex=' + ViewItemIndex + '&viewTabIndex=' + ViewTabIndex + '&RepresentDisplayCategory=' + RepresentDisplayCategory + '&' + makeHybridCallbackData();
				}
			}
			// inbridgeurl 유형을 지정
			inBridgeType = 1;
			break;
		default:
			return;
			break;
	}

	// inbridgeType에 따라서 url을 만든다.
	if (IsInBridge == true) {
		if (inBridgeType == 1) {
			var uniqueUrl = "";
			// 카탈로그인 경우
			if (IsCatalog == true) {
				uniqueUrl = "CatalogID=" + CatalogID;
			}
			else {
				uniqueUrl = "MallID=" + MallID + "&ItemID=" + ItemID;
			}

			targetUrl = __homeUrl + "/InBridge.aspx?ChannelID=" + ChannelID + "&ItemIndex=" + ItemIndex + "&" + uniqueUrl + "&" + inbridgeParameters();
		}
		else {
			targetUrl = __homeUrl + "/InBridge.aspx?ChannelID=" + ChannelID + "&targetUrl=" + encodeURIComponent(targetUrl);
		}
	}

	// window.open인 경우 새창을 띄운다.
	if (IsOpen == true) {
	  if (options != "") {
			window.open(targetUrl, title, options);
		}
		else {
			window.open(targetUrl);
		}
	}

	// 개발이 끝나면 주석처리..
	//showInfo($SelectedItem.attr("id"));
}


function doMoreCatalog(sender, listId, visible) {
	var $this = $(sender), display = $this.attr("IsDisplay"), $subList = $("#" + listId), $trs = $subList.find("tr:gt(" + visible + ")");
	var $slidingBar = $this.parents("div.slidingBar"), strong = $this.children()[0]; // 이렇게 찾아도 될려나? 흠
	var displayValue = "", countHtml = "";

	// firefox에서 outerHTML이 먹지 않아..
	if (strong.outerHTML) {
		countHtml = strong.outerHTML;
	} else {
		countHtml = (new XMLSerializer).serializeToString(strong);
	}

	if (display == "true") {
		// 숨겨진 로우 보이기
		$trs.show();
		// 최저가의 div가 ie에서 숨겨지지 않아..
		$trs.find("div").show();
		$this.attr("IsDisplay", "false");
		// className 변경
		$slidingBar.removeClass("open").addClass("close");
		$this.html("닫기" + countHtml);
	}
	else {
		// 로우 숨기기
		// 최저가의 div가 ie에서 숨겨지지 않아..
		$trs.find("div").hide();
		$trs.hide();
		$this.attr("IsDisplay", "true");
		// className 변경
		$slidingBar.removeClass("close").addClass("open");
		$this.html("더보기" + countHtml);
	}

	return false;
}

// 미성년자 여부 검사
function CheckUnderAge(IsUnderAge) {
	if (IsUnderAge == "1") {
		alert('19세미만 청소년은 이용할 수 없습니다.');
		return true;
	}

	return false;
}



////////////////////////////////////////////////////////////////////////////////////////
// List 관련 UserControl 을 사용하는 부모 페이지에서 호출 할 수 있도록 함수 구현
////////////////////////////////////////////////////////////////////////////////////////
(function($) {

	OS2.Application.ListControl = function() {

	}

	// 선택된 카탈로그의 ID Array로 변환한다.
	// <params value="id">컨트롤 아이디</params>
	getCheckedCatalogArray = function(id) {
		var $checkbox = null;

		var arrCatalogID = new Array();
		var splCatalogID = null;

		// ListControlCompareCheckbox 이름을 가진것 중에서 checked 된것들
		if (typeof (id) == 'undefined') {  			// ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox'][IsCatalog='true']:checked");
		}
		else { // ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox'][IsCatalog='true']:checked", $(id));
		}

		$CheckedCompareCheckBox.each(function(i) {
			$checkbox = $(this);

			splCatalogID = $checkbox.val().split(",");

			if (typeof splCatalogID.length == "undefined") {
				pushItemByArray(arrCatalogID, splCatalogID);
			}
			else {
				for (var i = 0; i < splCatalogID.length; i++) {
					pushItemByArray(arrCatalogID, splCatalogID[i]);
				}
			}
		});

		return arrCatalogID;
	}


	// 선택된 상품의 ID Array로 변환한다.
	// <params value="id">컨트롤 아이디</params>
	getCheckedItemArray = function(id) {
		var $checkbox = null;

		var arrItemID = new Array();
		var splItemID = null;

		// ListControlCompareCheckbox 이름을 가진것 중에서 checked 된것들
		if (typeof (id) == 'undefined') {  			// ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox'][IsCatalog='false']:checked");
		}
		else { // ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox'][IsCatalog='false']:checked", $(id));
		}

		$CheckedCompareCheckBox.each(function(i) {
			$checkbox = $(this);

			splItemID = $checkbox.val().split(",");

			if (typeof splItemID.length == "undefined") {
				pushItemByArray(arrItemID, splItemID);
			}
			else {
				for (var i = 0; i < splItemID.length; i++) {
					pushItemByArray(arrItemID, splItemID[i]);
				}
			}
		});

		return arrItemID;
	}

	// Array에 value를 추가한다.
	pushItemByArray = function(target, value) {
		if (typeof target == "undefined") {
			target = new Array();
		}

		target.push(value);
	}

	// 상품선택박스의 체크를 해제시킨다.
	// <params value="id">컨트롤 아이디</params>
	// <params value="isItem">상품여부(true : 상품만, false : 상품 + 카탈로그)</params>
	uncheckedItemCheckbox = function(id, isItem) {
		var itemAttr = isItem ? "[IsCatalog='false']" : "";

		if (typeof (id) == 'undefined') { 			// ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox']" + itemAttr + ":checked");
		}
		else {  			// ListControlCompareCheckbox 로 끝나는것.
			var $CheckedCompareCheckBox = $("input[id$='ListControlCompareCheckbox']" + itemAttr + ":checked", $(id));
		}

		$CheckedCompareCheckBox.attr("checked", "");
	}

	// 선택된 카탈로그 비교하기
	OS2.Application.ListControl.compareCheckedCatalog = function(id) {
		var capacity = 10;

		// 선택된 카탈로그ID를 가져온다.
		var arrCatalogID = getCheckedCatalogArray(id);
		// 선택된 상품ID를 가져온다.
		var arrItemID = getCheckedItemArray(id);

		var bridgeType = "OutBridge";
		var ChannelID = "";
		var IsInBridge = false;
		var targetUrl = "";
		var inbridgeUrl = "";

		if (arrItemID.length > 0) {
			if (arrCatalogID.length > 1) {
				if (confirm("일반상품은 비교할 수 없습니다.\r\n계속 하시겠습니까?")) {
					// 상품이 선택된 경우 체크를 모두 없앤다.
					uncheckedItemCheckbox(id, true);
				}
				else {
					uncheckedItemCheckbox(id, false);
					return false;
				}
			}
			else {
				alert("일반상품은 비교할 수 없으며, 가격비교 상품을 2개 이상 선택해주세요.");
				uncheckedItemCheckbox(id, true);
				return false;
			}
		}

		if (arrCatalogID.length < 2) {
			alert("가격비교 상품을 2개 이상 선택해주세요.");
			return;
		}
		else if (arrCatalogID.length > capacity) {
			alert("최대 " + String(capacity) + "개까지만 비교할 수 있습니다.\r\n다시 선택해주세요.");
			return false;
		}

		// bridge유형및 채널아이디를 checkbox에서 조회함.
		if (typeof (id) == 'undefined') { 			// ListControlCompareCheckbox 로 끝나는것.
			bridgeType = $("input[id$='ListControlCompareCheckbox']").attr("bridgetype");
			ChannelID = $("input[id$='ListControlCompareCheckbox']").attr("channelid");
		}
		else {  			// ListControlCompareCheckbox 로 끝나는것.
			bridgeType = $("input[id$='ListControlCompareCheckbox']", $(id)).attr("bridgetype");
			ChannelID = $("input[id$='ListControlCompareCheckbox']", $(id)).attr("channelid");
		}

		IsInBridge = bridgeType.toLowerCase() == "inbridge";

		// 비교상품 구현
		//alert(arrCatalogID.join(","));
		targetUrl = __findingUrl + "/Catalog/PopupSimilarityProduct.aspx?catalogIDs=" + arrCatalogID.join(",");

		if (IsInBridge == true) {
			window.open(__homeUrl + "/InBridge.aspx?ChannelID=" + ChannelID + "&targetUrl=" + encodeURIComponent(targetUrl), "GoComparePriceClick", "width=940,height=630,scrollbars=no");
		}
		else {
			window.open(targetUrl, "GoComparePriceClick", "width=1020,height=730,scrollbars=yes");
		}
	}

	// 선택된 카탈로그 찜하기
	OS2.Application.ListControl.zzimCheckedCatalog = function() {
		var capacity = 100;
		var arrCatalogID = getCheckedCatalogArray();
		var arrItemID = getCheckedItemArray();
		var bridgeType = "OutBridge";
		var ChannelID = "";
		var IsInBridge = false;
		var targetUrl = "";
		var inbridgeUrl = "";

		if (arrCatalogID.length == 0 && arrItemID.length == 0) {
			alert("찜하실 상품을 1개 이상 선택해주세요.");
			return false;
		}
		else if ((arrCatalogID.length + arrItemID.length) > capacity) {
			alert(String(capacity) + "개 이하만 찜할 수 있습니다.\r\n다시 선택해주세요.");
			return false;
		}

		// 찜하기 구현
		//alert(arrCatalogID.join(","));
		//window.open("http://member.about.co.kr/MyBuy/PickProduct/PickItemPop.aspx?type=catalog&id=" + arrCatalogID.join(","));

		// bridge유형및 채널아이디를 checkbox에서 조회함.
		if (typeof (id) == 'undefined') { 			// ListControlCompareCheckbox 로 끝나는것.
			bridgeType = $("input[id$='ListControlCompareCheckbox']").attr("bridgetype");
			ChannelID = $("input[id$='ListControlCompareCheckbox']").attr("channelid");
		}
		else {  			// ListControlCompareCheckbox 로 끝나는것.
			bridgeType = $("input[id$='ListControlCompareCheckbox']", $(id)).attr("bridgetype");
			ChannelID = $("input[id$='ListControlCompareCheckbox']", $(id)).attr("channelid");
		}

		IsInBridge = bridgeType.toLowerCase() == "inbridge";

		// 비교상품 구현
		//alert(arrCatalogID.join(","));
		targetUrl = __memberUrl + '/MyBuy/PickProduct/PickItemPop.aspx?catalogid=' + arrCatalogID.join(",") + '&itemid=' + arrItemID.join(",");

		if (IsInBridge == true) {
			window.open(__homeUrl + "/InBridge.aspx?ChannelID=" + ChannelID + "&targetUrl=" + encodeURIComponent(targetUrl), "productZzim", "left=100,top=100,width=335, height=290, resizable=no, scrollbar=no, status=no");
		}
		else {
			window.open(targetUrl, "productZzim", "left=100,top=100,width=335, height=290, resizable=no, scrollbar=no, status=no");
		}
	}

	OS2.Application.ListControl.InitListControl = function(displayID) {
		OS2.Application.ListControl.InitListControlObject(jQuery("#" + displayID));
	}

	OS2.Application.ListControl.InitListControlObject = function($control) {
		$control.bindListControlEvent();
		$control.bindListControlEventSub();
	}

})(jQuery);


(function($) {
	$.fn.Header = function(columns) {
		return this.each(function() {
			var table = this;
			var $tr = $(table).find("ul");

			init();

			function init() {
				if ($tr.length == 0) {
					return;
				}

				// 헤더의 칼럼을 지운다.
				$tr.find("li:not(.t01)").remove();

				// 추가할 헤더가 없는 경우 헤더만 초기화
				if (typeof columns == "undefined" || columns == null) {
					return;
				}

				for (var i = 0; i < columns.length; i++) {
					add(columns[i].className, columns[i].text);
				}
			};

			function add(className, text) {
				var td = createHeaderElement("li", className, text);

				$tr.append(td);
			};

			function createHeaderElement(tagName, className, text) {
				var element = document.createElement(tagName);

				element.className = className;
				element.innerHTML = text;

				return element;
			};
		});
	};
})(jQuery);
