
as = new Image();
as.src = "/public/library/assets/img/ajax-loader.gif";

var sl = {
	
	dynShow_onclick : function(pUrl) {
		var keywordlist = new Array()
		nCnt = 0
	    with ( document.searchForm ) {
			for ( var i=0; i < keyword_id.length; i++ ) {
				if ( keyword_id[i].checked ) {
					nCnt++;
					keywordlist[nCnt-1] = keyword_id[i].value
				}
			}
		}
		params = "&keywordList=" + keywordlist.toString()
		http('post',pUrl,this.dynShow_response,params)
	},
	
	dynShow_response : function(obj) {
		$('results-container').innerHTML = obj
		$('async-img').src = '';
	},
	
	dynShow_empty : function() {
		$('results-container').innerHTML = document.getElementById('divEmptyList').innerHTML;
	},
	
	title_onchange : function(pUrl, pValue) {
		if ( pValue.length > 3 ) {
			var param = "criteria=" + pValue
			http('post', pUrl, this.dynShow_response, param)
		}
	},
	search_onclick : function(pUrl) {
		if ( $('title').value.length > 0 ) {
			var param = "criteria=" + $('title').value
			param += "&orderby=product_id";
			param += "&async=true";
			
			$('async-img').src = as.src;
			
			http('post', pUrl, this.dynShow_response, param);
		}
	},
	
	pagingAction_onclick : function(pUrl) {
		//http('get', pUrl, this.pagingAction_response)
		
		new Ajax.Request(pUrl, {method:'get', onSuccess: this.pagingAction_response});
	},
	
	pagingAction_response : function(obj) {
		$('results-container').innerHTML = obj.responseText;
	},
	
	addToCart_onclick : function(pUrl) {
		var productIdList = new Array()
		var nCnt = 0;
		document.productForm.submit();
	},
	
	select_onclick : function(pForm, pIsChecked) {
		with ( pForm ) {
			for ( var i=0; i < product_id.length; i++ ) {
				product_id[i].checked = pIsChecked
			}
		}
	}

}
