﻿/*
* // properties
* depth
* quickViews	// array of quickViewContainers
* flashName
* 
* // methods
* initialize
* openQuickView
* getEmptyQuickView
* getQuickViewByAssortId
* initQuickViews
* existsQuickView
* closeQuickView
* minimizeQuickView
* maximizeQuickView
* 
* expandWiseCart
* foldWiseCart
* onShowCheckOutSystem
* 
* showSignIn
* notifySignIn
* getSignInState
* 
* getFlashMovie
* setStyles
* attachEvent
* setAttributes
* setHighestZIndex
* 
* showGlobalStorageSettingHelp
* showLocalStorageSettingHelp
* 
* gotoMyAccountWishList
* 
* resize
* 
* toString
* 
* lockContentFrame
*/

var WiseCart=function()
{
	this.initialize();
}

WiseCart.prototype={
	// 와이즈카트 플래시무비
	wisecart : null,
	// 최상위 zIndex
	depth : 1000,
	// 퀵뷰s
	quickViews : null,
	// 와이즈카트 플래시무비 id
	flashName : "wisecart",
	// 퀵뷰플래시무비 URL
	quickViewMovie : "http://img.wizwid.com/Wizwid/2009/common/flash/wisecart/quickview2.swf",
	// 퀵뷰 갯수
	quickViewNum : 4,
	// 퀵뷰 width
	quickViewWidth : "610",
	// 퀵뷰 height
	quickViewHeight : "400",
	// 퀼뷰 초기 뜨는 위치
	quickViewStartPositions : null,
	// 메인컨켄츠프레임의 id
	contentFrameName : "contentframe",

	cframe : null,
	// 와이즈카트 무비 height
	flashHeight : 34,
	// 결제완료알림을 위한 DIV
	notificationDiv : null,
	// 위즈위드페이지를 벗어날 경우 위시리스트를 저장할 필요조건의 가부
	syncRequired : false,
	// orderframe
	orderframe : null,
	// orderframename
	orderFrameName : "orderframe",
	// tween
	t : null,
	
	/**
	* 본 클래스의 문자열을 반환한다.
	*/
	toString : function()
	{
		return "WiseCart";
	},
	
	/**
	* 초기화한다.
	*/
	initialize : function()
	{
		this.wisecart=this.getFlashMovie(this.flashName);
		this.initQuickViews();
		this.resize();
		this.setScriptNodes();
		this.createNotificationDiv();
		this.setQuickViewStartPositions();
		
		this.cframe=document.getElementById(this.contentFrameName);
		
		if (navigator.appName.indexOf("Microsoft") == -1) 
		{
			var frames=document.getElementsByTagName("script");
			if(frames != undefined)
			{
				for(var i=0; i<frames.length; i++)
				{
					if(frames[i].name == this.orderFrameName)
					{
						trace("orderframe");
						this.orderframe=frames[i];
					}
				}
			}
		}
		else
		{
			this.orderframe=document.frames[this.orderFrameName];	
		}		
	},
	
	/**
	* mainview-mainview 가 겹쳐서 와이즈카트가 두개 있는지 확인하고 mainview로 redirect 시킨다.
	*/
	checkWiseCartDuplication : function()
	{
		if(window.parent != undefined)
		{
			// 겹쳤다.!!!
			// 맨 상위 페이지만 reload 
			var contentFrameSrc=document.frames[this.contentFrameName].body.location.href;
			setCookie("contentFrameSrc", contentFrameSrc);
			window.parent.document.URL="http://www.wizwid.com/CSW/handler/wizwid/kr/MainView-MainView";
		}
	},
	
	
	setQuickViewStartPositions : function()
	{
		this.quickViewStartPositions=new Array();
		
		var centerX=screen.availWidth/2;
		var centerY=screen.availHeight/2;
		
		var x=centerX - 480;
		var y=centerY - 320;
		this.quickViewStartPositions.push({left:x, top:y});
		x += 365;
		this.quickViewStartPositions.push({left:x, top:y});
		x -= 335;
		y += 110;
		this.quickViewStartPositions.push({left:x, top:y});
		x += 365;
		this.quickViewStartPositions.push({left:x, top:y});
	},
	
	/**
	* 나중에 innerHTML로 포함되어 실행될 스크립트노드들과 구별하기 위해서
	* 기존 로딩된 스크립트노드들의 실행되었음을 설정한다.
	*/
	setScriptNodes : function()
	{
	//	var scripts=document.scripts;
		var scripts=document.getElementsByTagName("script");
		var len=scripts.length;
		for(var i=0; i<len; i++)
		{
			scripts[i].setAttribute("executed", true);
		}
	},
	
	/**
	* 주문완료를 알리는 도큐먼트를 적을 DIV를 만든다.
	*/
	createNotificationDiv : function()
	{
		var __div=document.createElement("DIV");
		document.body.appendChild(__div);
		this.notificationDiv=__div;
	},
	
	/**
	* 윈도우 resize 이벤트 핸들러. 
	*/
	resize : function()
	{
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.notifyClientHeight != undefined)
			{
				f.notifyClientHeight(document.body.clientHeight);
			}
		}
		
		// TODO : 와이즈카트의 펼침상태가 그대로 유지되면서 보여져야한다.
		var tpos=Math.max(document.body.clientHeight-this.flashHeight, 0);
		var w="100%";
		this.setStyles(document.getElementById("wisecart_div"), {top:tpos, width:w});
	},
	
	/**
	* body.clientHeight를 반환한다.
	*/
	getClientHeight : function()
	{
		return document.body.clientHeight;
	},
	
	///////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////// 퀵뷰 운영 시작  ///////////////////////////////////
	///////////////////////////////////////////////////////////////////////////////////////	
	/**
	* 퀵뷰들을 초기화한다.
	*/
	initQuickViews : function()
	{
		this.quickViews=new Array();
		
		for(var i=0; i<this.quickViewNum; i++)
		{
			var quickView=document.getElementById("quickViewContainer"+i);
			this.setAttributes(quickView, {minimized:"false", idx:i});
			quickView.style.display="none";
			this.quickViews.push(quickView);
			
			var dd=new YAHOO.util.DD(quickView.id);
			dd.setHandleElId("quickview_handle_"+i);
			dd.scroll=false;
			dd.maintainOffset=true;
			dd.setXConstraint(300, document.body.clientWidth-300);
			dd.setYConstraint(0, document.body.clientHeight-150);
			
			
			if (navigator.appName.indexOf("Microsoft") == -1) 
			{
				quickView.addEventListener("activate", Delegate.create(this, this.quickView_onActivate), false);
			}
			else
			{
				quickView.attachEvent("onactivate", Delegate.create(this, this.quickView_onActivate));
			}
		}
	},
	
	/**
	* 해당 퀵뷰를 디스플레이한다.
	* @param	item	{assort_id, ...}
	*/
	openQuickView : function(item)
	{
		// item - {assort_id, itemId1, itemId2, setAssortId1, setAssortId2}
		// itemId1은..단일 상품의 경우 해당 상품의 item_id, 셋트 상품의 경우 구성상품1의 item_id
		// itemId2은..셋트 상품의 경우 구성상품2의 item_id, 단일 상품의 경우 null
		
		if(item == undefined)
			return;
			
		if(item.assort_id == undefined || item.assort_id == "")
			return;
			
		var assort_id=item.assort_id.toString();
		
		trace("WiseCart.openQuickView : " + item.assort_id);
		
		if(this.existsQuickView(assort_id) == true)
		{
			var quickView=this.getQuickViewByAssortId(assort_id);
			if(quickView != undefined)
			{
				this.setHighestZIndex(quickView);
				if(quickView.minimized == "true")
				{
					this.maximizeQuickView(assort_id);
				}
				else
				{
					// do nothing
				}
			}

			return;
		}
		
		var quickView=this.getEmptyQuickView();
		
		if(quickView == undefined)
		{
			// 퀵뷰가 여분이 없으면 메세지를 띄우준다.
			alert("퀵뷰는 4개 이상 띄우실 수 없습니다\n열려있는 퀵뷰를 닫으시고 다시 시도해주십시오.");
			return;
		}
		
		// keep orders
		quickView.setAttribute("assort_id", assort_id);
		this.setHighestZIndex(quickView);
		
		/*
		var left=((document.body.clientWidth-Number(this.quickViewWidth))/2).toString();
		var top=((document.body.clientHeight-Number(this.quickViewHeight))/2).toString();
		*/
		
		var pos=this.quickViewStartPositions[quickView.getAttribute("idx")];
		var left=pos.left;
		var top=pos.top;
		this.setStyles(quickView, {left:left, top:top});
		
		var so = new SWFObject(this.quickViewMovie, "quickView_"+assort_id, "610", "400", "8", "#ffffff");
		so.addParam("allowScriptAccess", "always");
		so.addParam("wmode", "transparent");
	//	so.addParam("flashVars", "assort_id="+assort_id+"&owner=quickView_div_"+assort_id+"&targetMovie=quickView_"+assort_id);
	
		so.addVariable("configUrl", "http://img.wizwid.com/Wizwid/2009/common/flash/wisecart/quickviewconfiguration.xml");
		so.addVariable("assort_id", assort_id);
		so.addVariable("targetMovie", "quickView_" + assort_id);
		so.addVariable("fileRootPath", "http://www.wizwid.com");
		so.addVariable("imageRootPath", "http://img.wizwid.com");
		
		if(item.itemId1 != undefined)
		{
			so.addVariable("itemId1", item.itemId1);
		}
		if(item.itemId2 != undefined)
		{
			so.addVariable("itemId2", item.itemId2);
		}
		if(item.setAssortId1 != undefined)
		{
			so.addVariable("setAssortId1", item.setAssortId1);
		}
		if(item.setAssortId2 != undefined)
		{
			so.addVariable("setAssortId2", item.setAssortId2);
		}
		
		so.write(quickView.firstChild.id);

		//ACEF_Tracking('quickView','FLASH','','',3,'wisecart quickview click test');
		//document.getElementById('contentframe').contentWindow.ACEF_Tracking('javascript:;','FLASH','','',3,'wisecart_quickview_click_test');

		if(typeof item.category_id != 'undefined')
		{
			this.notifyData('var CL_pd = "'+item.assort_nm+'";var CL_ct = "'+item.category_id+'";var CL_amt = "'+item.new_price+'"; if( typeof CU_rl == \'undefined\' ){var CU_rl = \'http://\'+\'wizwid.loginside.co.kr:8080\'; var PCHKIMG = new Image(); var CL_bn=navigator.appName; if( document.URL.substring(0,8) == \'https://\' ){ CU_rl = \'https://wizwid.loginside.co.kr/sslc1\';}else{if( CL_bn.indexOf("Netscape") > -1 || CL_bn=="Mozilla"){ setTimeout("PCHKIMG.src = CU_rl+\'/?cookie\';",1); } else{ PCHKIMG.src = CU_rl+\'/?cookie\'; };}; document.write(\'<\'+\'script src="http://img.wizwid.com/wizwid/loginside/loginside_mainscript.js" defer="true"><\'+\'/script>\');};');
		}

		quickView.style.display="block";
	},
		
	/**
	* 빈 퀵뷰(quickViewContainer)를 반환한다.
	*/
	getEmptyQuickView : function()
	{
		for(var i=0; i<this.quickViews.length; i++)
		{
			if(this.quickViews[i].assort_id == undefined)
			{
				return this.quickViews[i];
			}
		}
		
		return;
	},
	
	
	/**
	* 퀵뷰가 확성화될 경우 발생하는 이벤트 onactivate를 핸들링한다.
	*/
	quickView_onActivate : function()
	{
		this.depth += 2;
		event.srcElement.parentNode.style.zIndex=this.depth.toString();
	},
	
	/**
	* 해당 퀵뷰 드래그를 시작한다.
	*/
	startQuickViewDrag : function(assort_id)
	{
		// TODO
		// 해당 assort_id의 퀵뷰 드래그를 시작해야합니다.
	},
	
	/**
	* 해당 퀵뷰 드래그를 멈춘다.
	*/
	endQuickViewDrag : function(assort_id)
	{
		// TODO
		// 해당 assort_id의 퀵뷰 드래그를 마쳐야합니다.
	},
	
	/**
	* 해당 ID의 퀵뷰를 닫는다.
	* @param	assort_id
	*/
	closeQuickView : function(assort_id)
	{
		trace("WiseCart.closeQuickView : " + assort_id);
		var quickView=this.getQuickViewByAssortId(assort_id);
		trace(quickView.id);
		if(quickView != undefined)
		{
			trace(quickView.children(0).children(0).id);
			quickView.children(0).removeChild(quickView.children(0).children(0));
			// 퀵뷰를 빈 퀵뷰로 설정한다.
			quickView.setAttribute("assort_id", null);
			quickView.style.display="none";
		}
	}, 
	
	/**
	* 모든 퀵뷰를 닫는다.
	*/
	closeQuickViewAll : function()
	{
		for(var i=0; i<this.quickViews.length; i++)
		{
			if(this.quickViews[i].assort_id != undefined)
			{
				this.closeQuickView(this.quickViews[i].assort_id);
			}
		}
	},
	
	/**
	* 해당 ID의 퀵뷰를 최소화한다.
	* @param	assort_id
	*/
	minimizeQuickView : function(assort_id)
	{
		trace("WiseCart.minimizeQuickView : " + assort_id);
		if(assort_id == undefined)
		{
			return;
		}
		
		var quickView=this.getQuickViewByAssortId(assort_id);
		if(quickView != undefined)
		{
			/*
			var attributes={left:{to:"500"}, top:{to:"1000"}};
			var anim=new YAHOO.util.Anim(quickView.id, attributes, .5, Tween.strongEaseOut);
			anim.animate();
			*/
			quickView.style.display="none";
			quickView.setAttribute("minimized", "true");
		}
	},
	
	/**
	* 모든 퀵뷰를 최소화한다.
	*/
	minimizeQuickViewAll : function()
	{
		for(var i=0; i<this.quickViews.length; i++)
		{
			if(this.quickViews[i].assort_id != undefined)
			{
				this.minimizeQuickView(this.quickViews[i].assort_id);
			}
		}
	},
	
	/**
	* 해당 ID의 퀵뷰를 최대화한다.
	* @param	assort_id
	*/
	maximizeQuickView : function(assort_id)
	{
		trace("WiseCart.maximizeQuickView : " + assort_id);
		if(assort_id == undefined)
		{
			return;
		}
		
		var quickView=this.getQuickViewByAssortId(assort_id);
		if(quickView != undefined)
		{
			/*
			var attributes={left:{to:"100"}, top:{to:"50"}};
			var anim=new YAHOO.util.Anim(quickView.id, attributes, .5, Tween.strongEaseOut);
			anim.animate();
			*/
			quickView.style.display="block";
			quickView.setAttribute("minimized", "false");
			
			var quickViewFlash=this.getFlashMovie("quickView_"+assort_id);
			if(quickViewFlash != undefined)
			{
				quickViewFlash.onMaximize();
			}
		}	
	},
	
	/**
	* 해당 ID의 퀵뷰가 이미 존재하는지의 여부를 반환한다.
	* @param	assort_id
	*/
	existsQuickView : function(assort_id)
	{
		for(var i=0; i<this.quickViews.length; i++)
		{
			if(assort_id == this.quickViews[i].assort_id)
				return true;
		}
		return false;
	},
	
	/**
	* 해당 ID의 퀵뷰(quickViewContainer)를 반환한다. 
	* @param	assort_id
	*/
	getQuickViewByAssortId : function(assort_id)
	{
		if(assort_id == undefined)
		{
			return;
		}
		
		for(var i=0; i<this.quickViews.length; i++)
		{
			if(assort_id == this.quickViews[i].assort_id)
			{
				return this.quickViews[i];
			}
		}
		return;
	},
	
	/**
	* 해당 element를 최상위 z-index에 놓는다.
	* @param	el
	*/
	setHighestZIndex : function(el)
	{
		if(el != undefined)
		{
			if(el.style != undefined)
			{
				++this.depth;
				el.style.zIndex=this.depth;
			}
		}
	},
	///////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////// 퀵뷰 운영 끝 ///////////////////////////////////
	///////////////////////////////////////////////////////////////////////////////////////
	
	
	///////////////////////////////////////////////////////////////////////////////////////
	///////////////////////////////// 와이즈카트 트위닝 시작 //////////////////////////////
	///////////////////////////////////////////////////////////////////////////////////////
	/**
	* 와이즈카트를 이동시킨다.
	* @param	val	플래시무비 높이
	*/
	moveApp : function(val)
	{
		////////////////////////////// YAHOO.util.Anim starts //////////////////////////////////////
		// YAHOO.util.Anim
		// http://developer.yahoo.com/yui/
	
		/*
		var tpos=val+30+10;	// 위 아래 png 이미지 height
		var attributes={top:{to:(document.body.clientHeight-tpos).toString()}};
		var easingFunction;
		if(h >= this.flashHeight)
		{
			easingFunction=Tween.strongEaseOut;
		}
		else
		{
			easingFunction=Tween.strongEaseIn;
		}
		
		if(this.anim != undefined)
		{
			this.anim.stop();
		}
		this.anim=new YAHOO.util.Anim(wisecart_div.id, attributes, 0.6, easingFunction);
		var f=this.getFlashMovie(this.flashName);
		var h=Math.max(val, 223);	// 223 == 플래시무비 최소 높이
		if(f != undefined)
		{
			if(h >= this.flashHeight)
			{
				f.setAttribute("height", h.toString());
			}
			else
			{
				anim.onComplete.subscribe(Delegate.create(this, this.moveApp_onComplete));
			}
		}
		anim.animate();	
		this.flashHeight=h;
		*/
		////////////////////////////// YAHOO.util.Anim ends //////////////////////////////////////
		
		
		
		////////////////////////////// jsTween start //////////////////////////////////////
		/*
		Javascript Motion Tween
		http://jsTween.blogspot.com/
		
		jsTween : new Tween(object,property,easing,start,end,duration,suffixe);
		
		object:
		type:Object
		The object you want to modify. It can be any object, a visual object that you want to animate ( document.body.style ) or an anymous object ( new Object() ).
		property:
		type:String
		The property that is updated on the target object, it can be empty ('')
		easing:
		type:Function
		The easing that will be applied to motion. ( I have listed the functions below and created a sample to allow you to try them )
		start:
		type:Number
		Start value
		end:
		type:Number
		End value
		duration:
		type:Number
		Animation duration in seconds
		suffixe:
		type:String
		A string to append to the updated property ('%','pt','em' ...). 
		*/
		
	//	var h=Math.max(val, 223);	// 223 == 플래시무비 최소 높이
	
		var h=val;
		
		var tpos=val;	// 위 png 이미지 height
		var start=this.getNumericValue(document.getElementById("wisecart_div").style.top);
		var end=document.body.clientHeight-tpos;
		
		if(this.t == undefined)
		{
			var easingFunction;
			var easingDuration;
			if(h > this.flashHeight)
			{
				easingFunction=Tween.strongEaseOut;
				easingDuration=1;
			}
			else
			{
				easingFunction=Tween.strongEaseIn;
				easingDuration=1;
			}
			this.t=new Tween(document.getElementById("wisecart_div").style, "top", easingFunction, start, end, easingDuration, "px");
			this.t.begin=start;
			this.t.change=end-start;
		}
		else
		{
			this.t.stop();		
			this.t.begin=start;
			this.t.change=end-start;
			
			if(h > this.flashHeight)
			{
				this.t.func=Tween.strongEaseOut;
			}
			else
			{
				this.t.func=Tween.strongEaseOut;
				this.t._duration=1;
			//	this.t.func=Tween.strongEaseIn;
			}
		}

		var f=this.getFlashMovie(this.flashName);
		
		// 플래시무비 height를 조정한다.
		
		
		
		// static
		if(h > this.flashHeight)
		{
			this.t.start();	
			this.flashHeight=h;
		}
		else
		{
			document.getElementById("wisecart_div").style.top=end;
			
			this.flashHeight=h;
		}
		f.setAttribute("height", h.toString());
	
		
		/*
		// tweening
		if(f != undefined)
		{
			if(h >= this.flashHeight)
			{
				f.setAttribute("height", h.toString());
			}
			else
			{
				if(this.t.onMotionFinished != undefined)
				{
					this.t.onMotionFinished=null;
					delete this.t.onMotionFinished;
				}
				this.t.onMotionFinished=Delegate.create(this, this.moveApp_onComplete);
			}
		}
		this.t.start();	
		this.flashHeight=h;
	
		*/
		////////////////////////////// jsTween ends //////////////////////////////////////
	},
	
	moveApp_onComplete : function()
	{
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.setAttribute("height", this.flashHeight.toString());
		}
	},
	
	///////////////////////////////////////////////////////////////////////////////////////
	///////////////////////////////// 와이즈카트 트위닝 끝 //////////////////////////////
	///////////////////////////////////////////////////////////////////////////////////////
	
	
	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////// calls from quickview starts /////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	quickView_addWishListItem : function(item)
	{
		
		trace("quickView_addWishListItem : " + item.assort_id);
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_addWishListItem(item);
		}
	},
	
	quickView_addCartItem : function(item)
	{
		trace("quickView_addCartItem : " + item.assort_id);
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_addCartItem(item);
		}
	},
	
	quickView_buyNowItem : function(item)
	{
		trace("quickView_buyNowItem : " + item.assort_id);
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_buyNowItem(item);
		}
	},
	
	quickView_openProductDetailPage : function(item)
	{
		trace("quickView_openProductDetailPage : " + item.assort_id);
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_openProductDetailPage(item);
		}
	},
	
	quickView_minimizeQuickView : function(item)
	{
		trace("quickView_minimizeQuickView : " + item.assort_id);
		trace(document.getElementById("wisecart").quickView_minimizeQuickView);
		document.getElementById("wisecart").quickView_minimizeQuickView(item);
		/*
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_minimizeQuickView(item);
		}
		*/
	},
	
	quickView_closeQuickView : function(item)
	{
		trace("quickView_closeQuickView : " + item.assort_id);
		var f=document.getElementById("wisecart");
		f.quickView_closeQuickView(item);
	},
	
	quickView_showSizeSheet : function(sizeSheetSource)
	{
		var url="http://img.wizwid.com/Wizwid/2006/sizeview/"+sizeSheetSource;
		trace("quickView_quickView_showSizeSheet : " + url);
   
		var winOpts="width=800,height=635,scrollbars=1,left=250,top=30";
		window.open(url, "Pr_Code", winOpts);
	},
	
	/**
	* 재입고 알림을 와이즈카트에 위임한다.
	* quickview, optionboardstandalone 둘 다에서 호출될 수 있고. quickview에서 호출될 경우는
	* fromQuickView가 true이다.
	*/
	quickView_requestWarehousingNotification : function(item, fromQuickView)
	{
		trace("quickView_requestWarehousingNotification : " + item.assort_id);
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			f.quickView_requestWarehousingNotification(item, fromQuickView);
		}
	},

	/////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////// calls from quickview ends /////////////////////
	/////////////////////////////////////////////////////////////////////////////////
	
	
	/**
	* 해당 element에 스타일을 적용한다.
	* @param	el
	* @param	styleObj
	*/
	setStyles : function(el, styleObj)
	{
		if(el != undefined && styleObj != undefined)
		{
			if(el.style != undefined)
			{
				for(var i in styleObj)
				{
					el.style[i]=styleObj[i];
				}
			}	
		}
	},  
	
	/**
	* 해당 element에 속성을 설정한다.
	* @param	el
	* @param	attributes
	*/
	setAttributes : function(el, attributes)
	{
		if(el != undefined && attributes != undefined)
		{
			if(el.setAttribute != undefined)
			{
				for(var i in attributes)
				{
					el.setAttribute(i, attributes[i]);
				}
			}	
		}	
	},
	
	/**
	* 문자열을 숫자로반환한다.
	* @param	s	(String)
	*/
	getNumericValue : function(s)
	{
		if(s == undefined)
			return 0;
		
		var arr=s.split("");
		var valString="";
		for(var i=0; i<arr.length; i++)
		{
			if(isNaN(Number(arr[i])) == false)
			{
				valString += arr[i];
			}
			else
			{
				break;
			}
		}
	
		return Number(valString);
	},
	
	/**
	* 메인컨텐츠를 잠근다/잠금을 푼다.
	* @param	locking	(Boolean)
	*/
	lockContentFrame : function(locking)
	{
		// 막는일 없다.
		return;
		
		var contentFrame=document.getElementById(this.contentFrameName);
		
		if(locking == true)
		{
			var curtain=document.getElementById("curtain_div");
			this.setStyles(curtain, {display:"block", width:screen.availWidth, height:screen.availHeight});
		}
		else
		{
			var curtain=document.getElementById("curtain_div");
			this.setStyles(curtain, {display:"none", width:"0", height:"0"});
		}
	},
	
	/**
	* 해당 id의 플래시를 반환한다.
	* @param	movieName
	*/
	getFlashMovie : function(movieName)
	{
		if (navigator.appName.indexOf("Microsoft") != -1) 
		{
			return window[movieName]
		}
		else
		{
			return document[movieName]
		}
	},
	
	/**
	* 메인컨텐츠페이지를 아이디/비밀번호 찾기 페이지로 이동한다.
	*/
	openIdPasswordSearchPage : function()
	{
		var contentFrame=document.frames[this.contentFrameName];
		contentFrame.document.URL="http://www.wizwid.com/CSW/handler/wizwid/kr/CustomerIDPassSearch-Pass";
	},

	/**
	* 메인컨텐츠페이지를 회원가입 페이지로 이동한다.
	*/
	openMembershipJoinPage : function()
	{
		var contentFrame=document.frames[this.contentFrameName];
		contentFrame.document.URL="http://www.wizwid.com/CSW/handler/wizwid/kr/CustomerRealCheck-Start";
	},
	
	/**
	* 메인켄텐츠를 제품상세페이지로 이동한다.
	* @param	item
	*/
	openProductDetailPage : function(item)
	{
		trace("WiseCart.openProductDetailPage");
		if(item != undefined)
		{
			if(item.assort_id != undefined && item.vendor_id != undefined)
			{
				var detailUrl;
				
				// 수정 2007.6.28
				// vendorid추가로 추가된 것에 대해 shop/mall 구분해야한다.
				// 002501 : shop-hauolin
				// 002701 : shop-sports25
				
				var isShop=false;
				
				if(item.vendor_id == "002201" || item.vendor_id == "002501" || item.vendor_id == "002701")
					isShop=true;
				
				if(isShop == true)	// shop
					detailUrl="http://www.wizwid.com/CSW/handler/wizwid/kr/ShopProduct-Start?CategoryID=" + item.category_id + "&AssortID=" + item.assort_id;
				else
					detailUrl="http://www.wizwid.com/CSW/handler/wizwid/kr/MallProduct-Start?CategoryID=" + item.category_id + "&AssortID=" + item.assort_id;
					
				trace("detailUrl : " + detailUrl);
				var contentFrame=document.getElementById(this.contentFrameName);
				if(contentFrame != undefined)
				{
					this.lockContentFrame(false);
					contentFrame.src=detailUrl;
				}
			}
		}	
	},
	
	/**
	* 메인컨텐츠를 즐겨찾기 페이지로 이동한다.
	*/
	openLinkPage : function(url)
	{
		trace("WiseCart.openLinkPage : " + url);
		
		if(url == undefined || url == null || url == "" || url.indexOf("http") == -1)
		{
			return;
		}
		
		var contentFrame=document.getElementById(this.contentFrameName);
		if(contentFrame != undefined)
		{
			this.lockContentFrame(false);
			contentFrame.src=url;
		}
	},
	
	
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////
	
	/**
	* 사용자가 위즈위드페이지를 벗어나려고 할때 위시리스트를 서버에 저장할 조건인지를 반환한다.
	*/
	checkSyncRequired : function()
	{
		if(this.getSignInState() == true)
		{
			// 로그인 상태라면 위시리스트가 변경될 때마다 서버 요청을 하여 sync가 이루어진 
			// 상황리기 때문에 또 저장할 필요가 없다.
			return false;
		}
		
		return this.syncRequired;
	},
	
	/**
	* 사용자가 위즈위드페이지를 벗어나려고 할때 위시리스트를 서버에 저장할 조건인지를 설정한다.
	*/
	isSyncRequired : function(b)
	{
		this.syncRequired=b;
	},
	
	/**
	* 플래시 글로벌 저장공간 설정 도움말 페이지를 레이어 팝업으로 보여준다.
	*/
	showGlobalStorageSettingHelp : function()
	{
		// 플래시 글로벌 저장공간 설정 도움말 페이지를 레이어 팝업으로 보여준다.
	},
	
	/**
	* 플래시 로컬 저장공간 설정 도움말 페이지를 레이어 팝업으로 보여준다.
	*/
	showLocalStorageSettingHelp : function()
	{
		// 플래시 로컬 저장공간 설정 도움말 페이지를 레이어 팝업으로 보여준다.
	},
	
	/**
	* 로그인페이지를 디스플레이한다.
	* @param	operationId
	* @param	targetMovieId
	*/
	showSignIn : function(operationId, targetMovieId)
	{
		// 레이어팝업으로 하지 않고, 기존 로그인 플로우를 따른다.
				
		// 어떻게 처리하시는지는 모르겠지만, 로그인 처리 후 
		// 가장 상위 window.wc.notifySignIn(signIn, operationId, targetMovieId) 를 호출하셔야합니다.
		
		// temp
		return;
	},
	
	/**
	* 회원/비회원 구매 페이지를 디스플레이한다.
	* @param	operationId
	* @param	targetMovieId
	*/
	showOrderSignIn : function(operationId, targetMovieId)
	{
		
		// temp
		return;
	},
	
	/**
	* 사용자의 로그인상태가 변경된 경우 각 플래시무비에 알려준다.
	* @param	operationId
	* @param	targeMoiveId
	*/
	notifySignIn : function(operationId, targetMovieId)
	{
		trace("notifySignIn");
		if(this.wisecart != undefined)
		{		
			this.wisecart.notifySignIn(operationId);
		}
		
		if(targetMovieId.indexOf("quickview") != -1)
		{
			var quickview=this.getFlashMovie(targetMovieId);
			if(quickview != undefined)
			{
				quickview.notifySignIn(operationId);
			}
		}
	},
	
	/**
	* 로그인 시 사용할 아이디를 LoginID에 설정한다.
	*/
	setLoginID : function(loginID)
	{
		trace("WiseCart.setLoginID : " + loginID);
		var d=new Date();
		d.setFullYear(d.getFullYear()+50, 12, 31);
		setCookie("LoginID", loginID, d);
		trace("LoginID : " + this.getCookie("LoginID"));
	},
	
	/**
	* LoginID 쿠키를 읽어 반환한다.
	*/
	getLoginID : function()
	{
		var loginID=this.getCookie("LoginID");
		if(loginID == undefined || loginID == null || loginID == "undefined" || loginID == "null")
		{
			loginID="";
		}
		return loginID;
	},
	
	/**
	* 사용자의 로그인 상태를 반환한다.
	*/
	getSignInState : function()
	{
	//	trace("WiseCart.getSignInState");
		// TODO : document.cookie에 있는 로그인 정보를 읽어서 반환한다. (true/false)
		// CustomerID, IsLogin 둘다 체크해서 결정
		var IsLogin=this.getCookie("IsLogin");
		var CustomerID=this.getCookie("CustomerID");
		var CustGB=this.getCookie("CustGB");
		var SessionID=this.getCookie("JSESSIONID");
		
		if(IsLogin != "" && CustGB != "")
		{
		//	trace("WiseCart.getSignInState : " + IsLogin + ", " + CustGB);
			var signInObj=new Object();
			// 수정 2007.6.28
			if(IsLogin.indexOf("true") != -1)
				signInObj.IsLogin=true;
			else
				signInObj.IsLogin=false;
			
			// signInObj.IsLogin=Boolean(IsLogin);
			signInObj.CustGB=CustGB;
			signInObj.SessionID=SessionID;
			return signInObj;
		}
		else
		{
			return;
		}
	},
	
	/**
	* 메인컨텐츠프레임을 Refresh한다.
	* 로그인상태에서 로그아웃상태로 서버세션정보 바뀌었을 때 호출된다.
	* 메인컨텐츠프레임이 Refresh되면 와이즈카트도 자동적으로 바뀐 로그아웃상태를 읽어 업데이트된다.
	*/
	refreshContentFramePage : function()
	{
		var contentFrame=document.getElementById(this.contentFrameName);
		if(contentFrame != undefined)
		{
			var url=contentFrame.src;
			contentFrame.src=url;
		}
		
		/*
		var contentFrame=document.frames[this.contentFrameName];
		if(contentFrame != undefined)
		{
			contentFrame.document.URL=contentFrame.document.URL;
		}
		*/
	},
	
	/**
	* MyWiz의 위시리스트페이지로 contentframe을 이동시킨다.
	*/
	gotoMyAccountWishList : function()
	{
		// TODO
		// ??
		
		document.getElementById(this.contentFrameName).src="http://www.wizwid.com/CSW/handler/wizwid/kr/CustomerWishList-Start?dp1Mnu=2&dp2Mnu=2";
	},
	
	/**
	* 주문쿠키를 반환한다.
	*/
	readCheckOutSystemCookie : function()
	{
	//	trace("WiseCart.readCheckOutSystemCookie");
		
		var state=this.getCookie("WiseCartCheckOutSystemState");
		var basket_gb=this.getCookie("WiseCartCheckOutSystemBasketGB");
		var basket_id=this.getCookie("WiseCartCheckOutSystemBasketID");
		
	//	trace("cookie.state =" + state + "?");
	//	trace("cookie.basket_gb =" + basket_gb + "?");
	//	trace("cookie.basket_id =" + basket_id + "?");
		
		var checkOutSystemCookie=new Object();
		checkOutSystemCookie.state=state;
		checkOutSystemCookie.basket_gb=basket_gb;
		checkOutSystemCookie.basket_id=basket_id;
		
		// 오브젝트에 "" 요소값이 있을 때에는..플래시로 전달될 때 "null" 문자열로 전달된다.
		return checkOutSystemCookie;
	},
	
	/**
	* 주문쿠키를 쓴다.
	*/
	writeCheckOutSystemCookie : function(state, basket_gb, basket_id)
	{
	//	trace("WiseCart.writeCheckOutSystemCookie");
		
		setCookie("WiseCartCheckOutSystemState", state);
	//	trace("cookie.state =" + this.getCookie("WiseCartCheckOutSystemState"));
		setCookie("WiseCartCheckOutSystemBasketGB", basket_gb);
	//	trace("cookie.basket_gb =" + this.getCookie("WiseCartCheckOutSystemBasketGB"));
		setCookie("WiseCartCheckOutSystemBasketID", basket_id);
	//	trace("cookie.basket_id =" + this.getCookie("WiseCartCheckOutSystemBasketID"));
	},
	
	getCookie : function(cookieName)
	{
		var search=cookieName + "=";
		if(document.cookie.length > 0) // 쿠키가 설정되어 있다면
		{
			offset = document.cookie.indexOf(search);
			if(offset != -1) // 쿠키가 존재하면
			{
				offset += search.length;
				// set index of beginning of value
				end=document.cookie.indexOf(";", offset);
				// 쿠키 값의 마지막 위치 인덱스 번호 설정
				if(end == -1)
				{
					end=document.cookie.length;
				}
					
				return unescape(document.cookie.substring(offset, end));
			}
		}
		return "";
	},
	
	///////////////////////////////////////////////////////////////////////
	//////////////////////////////// 결제 /////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	
	startHTMLOrder : function(basket_gb, basket_id)
	{	
		// http://www.wizwid.com/CSW/handler/wizwid/kr/Order-Step1?BasketGB=01&OrderBasketID=00452432
		
		/*
		var contentFrame=document.getElementById(this.contentFrameName);
		if(contentFrame != undefined)
		{
			contentFrame.src="http://www.wizwid.com/CSW/handler/wizwid/kr/Order-Step1?BasketGB="+basket_gb+"&OrderBasketID="+basket_id;
		}
		*/
		
		var contentFrame=document.frames["contents"];
		contentFrame.document.location.replace("http://www.wizwid.com/CSW/handler/wizwid/kr/Order-Step1?BasketGB="+basket_gb+"&OrderBasketID="+basket_id);
	},
	
	
	
	/**
	* orderframe 에 결제 폼 페이지를 로드한다/없앤다.
	*/
	loadOrderFormPage : function(b)
	{
		if(b == true)
		{
			document.getElementById(this.orderFrameName).src="http://www.wizwid.com/CSW/OrderForm_WC.html";
		}
		else
		{
			document.getElementById(this.orderFrameName).src="http://www.wizwid.com/CSW/empty.html";
			var affiliateFrame=document.frames["affiliateframe"];
			if(affiliateFrame != undefined)
			{
				affiliateFrame.document.URL="http://www.wizwid.com/CSW/empty.html";
			}
		}
	},
	
	/**
	* notifyData(Log Tracking 등에서 사용)
	* @param	str	(String)	- Javascript 내용
	*/
	notifyData : function(str)
	{
		trace("notifyData");
		trace(str);

		//window.execScript(str);

		if(document.all)
		{
			var iframe = document.createElement('<iframe name="notifyData" />');
		}
		else
		{
			var iframe = document.createElement('iframe');
			iframe.setAttribute('name', 'notifyData');
			iframe.style.visibility='hidden';
		}

		document.body.appendChild(iframe);

		var notifyData = window.open('', 'notifyData');
		notifyData.document.write('<script>'+str+'<\/script>');
		notifyData.document.close();
	},
	
	/**
	* 결제완료를 Alliances들에게 알린다.
	* @param	str	(String)	- Javascript를 포함한 html 문자열
	*/
	notifyOrderCompletionToAffiliates : function(str)
	{
		trace("notifyOrderCompletionToAffiliates");
		trace(str);
		
		/*
		if(str == undefined || str == "")
		{
			// do nothing
			return;
		}
		
		var affiliateFrame=document.frames["affiliateframe"];
		if(affiliateFrame != undefined)
		{
			affiliateFrame.document.URL="?"+str;
		}
		*/
		
		
		this.notificationDiv.innerHTML=str;
		var scripts=document.scripts;
		var len=scripts.length;
		for(var i=0; i<len; i++)
		{
			// 실행된 스크립트 노드는 통과..
			if(scripts[i].getAttribute("executed") == true)
			{
				continue;
			}
		
			if(scripts[i].src != undefined && scripts[i].src != "")
			{
				// 확장자가 js 파일인지 확인한다.
				var srcString=scripts[i].src;
				if(srcString.substr(srcString.length-3, srcString.length) != ".js")
				{
					continue;
				}
						
				// 외부 js파일을 불러오는 형식의 script 노드인 경우
				var head=document.getElementsByTagName("head")[0];
				var x=document.createElement("SCRIPT");
				x.src=scripts[i].src;
				x.type="text/javascript";
				var appendedX=head.appendChild(x);
				appendedX.setAttribute("executed", true);
			}
			else
			{
				// script 노드에 code가 포함되어있는 경우
				window.execScript(scripts[i].text);
			}
			
			// 실행된 스크립트 노드가 실행되었음을 설정한다.
			scripts[i].setAttribute("executed", true);
		}
		
	},
	
	/**
	* 로그분석
	* @param	str	(String)	- Javascript를 포함한 html 문자열
	*/
	notifyLogTracking : function(str)
	{
		trace("notifyLogTracking 시작");
		//trace(str);	
	},
	
	/**
	* ISP안전결제를 시작한다.
	* @param	ISP2	- {pdtnm, interest, ISPMoney}
	*/
	orderISP : function(ISP2)
	{	
		trace("WiseCart.orderISP");
		this.orderframe.OrderISP(ISP2);
	},
	
	/**
	* 안심클릭 결제를 시작한다.	(삼성, 롯데카드 분기 결제는 orderframe에서 알아서 처리한다.
	* Visa3d(Object):
	* pan,
	* expiry,
	* purchase_amount,
	* amount,
	* description,
	* currency,
	* recur_frequency,
	* recur_expiry,
	* installments,
	* device_category,
	* name,
	* url,
	* returnUrl,
	* country,
	* dummy,
	* cardcode
	* @param	Visa3d
	*/
	submitV3d : function(Visa3d)
	{
		trace("WiseCart.submitV3d");
		if(this.orderframe == undefined)
		{
			trace("orderframe is undefined.");
		}
		else
		{
			this.orderframe.submitV3d(Visa3d);
		}
	},
	
	/**
	* 실시간계좌이체를 시작한다.
	* DacomForm(Object) : 
	* chkSubmit,
	* ret_url,
	* mid,
	* oid,
	* buyer,
	* productinfo,
	* pid,
	* amount,
	* formflag,
	* hashdata,
	* dacomMoney,
	* BasketGB,
	* CreateOrderID
	* @param	DacomForm	
	*/
	submitDacom : function(Dacom)
	{
		trace("WiseCart.submitDacom");
		if(this.orderframe == undefined)
		{
			trace("orderframe is undefined.");
		}
		else
		{
			this.orderframe.submit_auth1(Dacom);
		}
	},
	
	
	/**
	* 에스크로 신청을 실행한다.
	* 2006.12.13 추가
	* @param	Escrow
	*/
	doEscrow : function(Escrow)
	{
		trace("WiseCart.doEscrow");
		if(this.orderframe == undefined)
		{
			trace("orderframe is undefined.");
		}
		else
		{
			this.orderframe.EscrowAuth(Escrow);
		}
	}, 
	
	
	////////////////////////////////////////////////////////////////
	//////////////////////////// 결제 승인 후 //////////////////////
	
	setCertResult : function(xid, eci, cavv, cardno, CCNo)
	{
		trace("WiseCart.setCertResult");
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.paramSet != undefined)
			{
				// CCNo 추가되었다.
				f.setCertResult(xid, eci, cavv, cardno, CCNo);
			}
		}
	},
	
	notifyVisa3DError : function(msg)
	{
		trace("WiseCart.notifyVisa3DError");
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.setErrorResult != undefined)
			{
				f.notifyVisa3DError(msg);
			}
		}
	},

	paramSetISP : function(KVP_NOINT, KVP_QUOTA, KVP_CARDCODE, KVP_SESSIONKEY, KVP_ENCDATA)
	{
		trace("WiseCart.paramSetISP");
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.paramSetISP != undefined)
			{
				f.paramSetISP(KVP_NOINT, KVP_QUOTA, KVP_CARDCODE, KVP_SESSIONKEY, KVP_ENCDATA);
			}
		}
	},
	
	paramSet : function(xid, eci, cavv, cardno, CCNo)
	{
		trace("WiseCart.paramSet");
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.paramSet != undefined)
			{
				// CCNo 추가되었다.
				f.paramSet(xid, eci, cavv, cardno, CCNo);
			}
		}
	},
	
	proceed : function()
	{
		trace("WiseCart.proceed");
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.proceed != undefined)
			{
				f.proceed();
			}
		}
	},
	
	/**
	* @param	authyn	승인구분
	* @param	oid		주문번호
	* @param	amount	금액
	* @param	bankcode	은행코드
	* @param	BasketGB	장바구니구분
	* @param	return_page	호출할URL
	*/
	notifyDacomCertification : function(amount, respcode, respmsg, transaction, bankcode, accountNum, DacomOrderID)
	{
		// respcode "0000"/"C000" -> 승인성공
			// 이외의 값이면...승인실패이며 respmsg 가 에러메세지이다.
		trace("WiseCart.notifyDacomCertification : " + respcode + ", " + respmsg);
		
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.notifyDacomCertification != undefined)
			{
				f.notifyDacomCertification(amount, respcode, respmsg, transaction, bankcode, accountNum, DacomOrderID);
			}
		}
	},
	
	
	/**
	* 에스크로 신청 완료 후 정보를 셋팅한다.
	* @param	escrowNo
	*/
	notifyEscrowCertification : function(respcode, respmsg, transaction, EscrowOrderID)
	{
		trace("WiseCart.notifyEscrowCertification");
		
		var f=this.getFlashMovie(this.flashName);
		if(f != undefined)
		{
			if(f.notifyEscrowCertification != undefined)
			{
				f.notifyEscrowCertification(respcode, respmsg, transaction, EscrowOrderID);
			}
		}
	},
	
	
	//////////////////////////// 결제 승인 후 //////////////////////
	////////////////////////////////////////////////////////////////
	
	/**
	* 결제확인페이지의 세금계산서, 현금영수증발급페이지로 컨넨츠페이지 이동..
	*/
	viewReceipt : function()
	{
		// http://www.wizwid.com/CSW/handler/wizwid/kr/TaxReceipt-List?dp1Mnu=1&dp2Mnu=6
		var contentFrame=document.getElementById(this.contentFrameName);
		if(contentFrame != undefined)
		{
			contentFrame.src="http://www.wizwid.com/CSW/handler/wizwid/kr/TaxReceipt-List?dp1Mnu=1&dp2Mnu=6";
		}
	},
	
	
	/**
	* OKCashbag ActiveX Control을 쓰고 설치가 되어있는지 여부를 반환한다.
	*/
	writeOKCashbagControl : function()
	{
		var okcashbagDiv=document.getElementById("ok_div");
		if(okcashbagDiv != undefined)
		{
			okcashbagDiv.innerHTML="<object id='xus' classid='clsid:AD435D31-ED5C-4148-9DD8-92211F9DAC34' codebase='http://pointsok.okcashbag.com/skmpp/SKMPPClient2.cab#version=1,2,0,0' width='0' height='0'></object>";
			if(xus != undefined)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	},
	
	/**
	* 객체에 들어있는 데이터를 암호화해서 반환한다.
	* @param	data	(Object) - 데이터는 문자열로 구성되어있어야..
	*/
	encryptOKCashbag : function(data)
	{
		if(data == undefined)
		{
			return;
		}
		
		var xus=document.all.xus;
		for(var prop in data)
		{
			data[prop]=xus.encrypt(data[prop], this.getOKCashbagPubKey());
		}
		
		return data;
	}, 
	
	/**
	* 암호화를 위한 키를 반환한다.
	*/
	getOKCashbagPubKey : function()
	{
		var pubkey_b64="ziUt9sQyZJqzAEQP31AQ35QmYcvtTs6NfDekZkp8kR8aGn3TrUyNAXccb2SevKAGR4Icq0qzJDh7" +
		"fq9ePM8I08rD+tZh0txmBr08U4W/RAQjv7AHIXgUgN7qyTYIGm5xIPTE3FwwjGGgvlN6YlZQshtc" +
		"zcPLYi8T1vxY+UHtRdmGKaYzRdHKV3q7Ni5kXl3likG63wC4q+ceq5AY8y43ZgW2J4NEOpU3mMqk" +
		"Px6GMZN09hQE6ywFqjXUt4qT5CbB59T6mc8YDBc+BNsphnrLNmSmcxelfD8RdXnRicrEhFWrHToT" +
		"x2NoWJc6kiF0VebLl+D2PwCqjMga8d6VR+Uhzw==" 
		return pubkey_b64;
	},
	
	alertFromWiseCart : function(message)
	{
	//	alert("alertFromWiseCart : "+ message);
	}
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////
	
	
}

function trace(s)
{
	//window.status=s;
	//alert(s);
}

function setCookie(name, value)
{
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); 
}

function PopupCardUseInfo01(){
	var url = 'http://www.wizwid.com/CSW/handler/wizwid/kr/PageView-Start?PageName=gene_bott/cardusePop01.icm';
	popupWin=window.open(url, 'CardUseInfo','resizable=yes,scrollbars=yes,width=670,height=522');
	popupWin.focus();
}

function PopupCardUseInfo02(){
	var url = 'http://www.wizwid.com/CSW/handler/wizwid/kr/PageView-Start?PageName=gene_bott/cardusePop02.icm';
	popupWin=window.open(url, 'CardUseInfo','resizable=yes,scrollbars=yes,width=670,height=522');
	popupWin.focus();
}

function PopupCardUseInfo03(){
	var url = 'http://www.wizwid.com/CSW/handler/wizwid/kr/PageView-Start?PageName=gene_bott/cardusePop03.icm';
	popupWin=window.open(url, 'CardUseInfo','resizable=yes,scrollbars=yes,width=670,height=522');
	popupWin.focus();
}

function OpenEscrowInfo() {
	var URL = "http://www.wizwid.com/CSW/handler/wizwid/kr/PageView-Start?PageName=order/EscrowInfo.icm";
	popupWin=window.open(URL,"EscrowInfo",'resizable=no,scrollbars=no,statusbars=no,width=580,height=770');
	popupWin.focus();
}


/**
 * loginside 관련 script
 */
var CL_CODE='1';
var CU_URL='http://'+'wizwid.loginside.co.kr:8888/';
if(document.URL.substring(0,8) == 'https://'){CU_URL = 'https://wizwid.loginside.co.kr/logecgather';}

/**
 * wisecart 장바구니 Logging : 한개만 작업
 *
 * @param	mode	i(장바구니 추가), o(장바구니 삭제), b(구매완료??)
 * @param	cate	상품 카테고리 ID
 * @param	name	상품명
 * @param	amt		상품 가격
 * @param	num		상품 수량
 */
function AEC_F_D2(mode,cate,name,amt,num){
	var str = escape(AEC_STR(cate,name,amt,num));

	AEC_S_F2(str, mode);
}

/**
 * wisecart 장바구니 Logging : 전부 삭제
 *
 * @param	item	item[i] = {'cate':상품 카테고리 ID, 'name':상품명, 'amt':상품 가격, 'num':상품 수량}
 */
function AEC_D_A2(item){
	var str = '';

	for(i = 0; i < item.length; i++){
		str += AEC_STR(item[i].cate,item[i].name,item[i].amt,item[i].num);

		if(escape(str).length > 800){
			str = escape(str)+'&cmd=on';
			AEC_S_F2(str, 'o');
			str = '' ;
		}
	}

	if(str.length > 0){
		AEC_S_F2(escape(str), 'o');
	}
}

/**
 * wisecart 장바구니 Logging : URL 호출
 */
function AEC_S_F2(str,mode){
	mode = mode.toLowerCase();
	switch(mode) {
		case 'b':
		case 'i':
		case 'o':
			_AEC_argcart = CU_URL+'?cuid='+CL_CODE+'&md='+mode+'&ll='+str+'&';
		
			var AEC_iob = new Image();
			AEC_iob.src = _AEC_argcart;

			window.setTimeout('',2000);	// 뭥미??
			break;
	}
}


function AEC_REPL(s,m){if(typeof s=='string'){if(m==1){return s.replace(/[#&^@,]/g,'');}else{return s.replace(/[#&^@]/g,'');}}else{return s;} };

function AEC_STR(cate,name,amt,num){return AEC_REPL(cate)+'@'+AEC_REPL(name)+'@'+AEC_REPL(amt,1)+'@'+AEC_REPL(num,1)+'^';}


/*
function addWishListItemHtml(assortID) {
	alert(assortID);
	var IsLogin=this.getCookie("IsLogin");

	if (IsLogin == null || IsLogin == "" || IsLogin == "false") {
		addWishListItemToWiseCart(assortID);
	} else {
		var contentFrame=document.wisecart_form;
		alert(contentFrame);
		contentFrame.target = "wisecart_hidden_frame";
		contentFrame.action ="http://www.wizwid.com/CSW/handler/wizwid/kr/CustomerWishList-WCInsert?basketgb=02&AssortID="+assortID;
		contentFrame.submit() ;
		addWishListItem
	}
}
*/

/**
* 위시리스트아이템추가를 와이즈카트에 요청한다. 
* @param	assort_id
*/
function addWishListItemToWiseCart(assort_id, setassortid1, setassortid2)
{
	if(window.parent != undefined)
	{
		if(window.parent.wc != undefined)
		{
			var wisecart=window.parent.wc.getFlashMovie("wisecart");
			wisecart.addWishListItem(assort_id, setassortid1, setassortid2);
		}
	}
}