var ajax = {
	testtest: function(){
		alert('Å×½ºÆ®');
	},
	prdLoad: function(prdListUrl, target, idx, totSize){
		new Ajax(prdListUrl,
			{
				method: 'get',
				onload:	this.tabCtr(idx, totSize),					
				update: $(target),
				onComplete: function(){
					$(loading).innerHTML = "";
				}
			}
		).request();
	},
	boardData: function(boardUrl, target, strMethod){		
		new Ajax(boardUrl,
			{
				method: strMethod,
				onload: this.loading(target, ''),
				update: $(target),
				onComplete: function(){
					$(loading).innerHTML = "";
				}
			}
		).request();
	},
	tabCtr: function(idx, totSize){
		if(idx == '' || totSize == '') return;
		this.loading('loading', '');
		for(var i=0; i<totSize; i++){
			if( i == idx){
				$('tab_'+i).className = 'on';
				$('txt_'+i).className = 'on';
			} else {
				$('tab_'+i).className = '';
				$('txt_'+i).className = '';
			}
		}
	},
	loading: function(target, height){
		if(height != "") {
			$(target).style.height = height;
		}
		$(target).innerHTML = '<div class="loading"></div> ';
	}
}

var planCommon = {
	anchor: function(sectid){
		document.location.href = "#"+sectid;
	},
	otherShow: function(id,URL,w,h){
		$(id).innerHTML = '<img src="'+URL+'" width="'+w+'" height="'+h+'" alt="">';
	},
	over: function(objId){
		$(objId).style.background = "#cff7fa";
	},
	out: function(objId){
		$(objId).style.background = "url('http://image.gsshop.com/mi06/planPrd/bg_line.gif') repeat-x";
	},
	planListLink: function(planSeq){
		document.location.href = "/planPrd/planPrd.jsp?planseq="+planSeq;
	}
}

var planCoupon = {
	getCouponPop: function(couponNum, enCouponNum){
		window.open("/ecrm/coupon/publishCoupon.jsp?num="+couponNum+"&chk="+enCouponNum, "coupon", "width=300, height=300, top=200");		
	},
	getCouponAlert: function(couponNum, enCouponNum){
		Alert.initialize('planAlertDIV');
		Alert.injectUrl(this.getCouponUrl(couponNum, enCouponNum));			
	},
	getCouponUrl: function(couponNum, enCouponNum){
		return "/ecrm/coupon/publishCoupon.jsp?num="+couponNum+"&chk="+enCouponNum;
	}	
}


var opendCont;
var realBoard = {
	goSearch: function(category){
		var queryKey	= $('queryword').value;
		var queryType	= $('queryType').value;
		var sect		= "";
		if(queryKey == "" ){
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		} else {
			var queryUrl	= "/plan/templete/plan_list4RealBoardType.jsp?category=" +category+ "&sect=" + sect + "&query=" + queryType + "&queryword=" + queryKey;
			ajax.boardData(queryUrl, 'planBoardList', 'get');
		}		
	},
	resetPage: function(category){
		ajax.boardData("/plan/templete/plan_list4RealBoardType.jsp?category="+category, "planBoardList", "get");
	},
	loadCont: function(category, boardid, target){
		var contObj = $(target).style.display;	
		if(contObj == "none"){
			$(target).style.display = "inline";
		
		} else { 
			$(target).style.display = "none";
		}
		
		ajax.boardData("/plan/templete/plan_cont4RealBoardType.jsp?category="+category+"&boardid="+boardid, target, "get");
	},
	writeCont: function(category){
		window.open("/plan/templete/plan_write4RealBoardType.jsp?category="+category, "plan", "width=700, height=580");
	},
	editCont: function(category, boardid){
		window.open("/plan/templete/plan_write4RealBoardType.jsp?category="+category+"&boardid="+boardid, "plan", "width=700, height=580");
	},	
	deleteCont: function(){
		if(confirm("°Ô½Ã¹°À» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			document.commentDel.target 		= "deleteFrm";
			document.commentDel.submit();
		}
	}
}

function setCount(a, b){}
