﻿//include ribo.cms.js.CartUI.prototype.js						
//carello semplice

//agguingo alla inizializzazione della pagina
AddToInit(init_loginStatus);

function init_loginStatus(){
	/*SELECTOR*/
	if($get('currentCustomer_Container') != null){
		cust = new Ribo.Cms.JS.CustomerSelector("Customer");
		cust._filterFunction	= filterFunction_loginascx;
		cust._filterContainer= $get('currentCustomer_filter');;
		cust._enabled_filter =true;
		
		cust._bindToEntity	= '';
		cust._xsltFileCustom_detail = '~/Xslt/customer/customer_detail_light.xsl'
		cust._xsltFileCustom_popUp = '~/Xslt/customer/customer_ListByAccount.xsl'
		cust._current_displayContainer = $get('currentCustomer_Container');

		cust.initialize(ribo.cms.ws.icustomerws,cust);
		cust.showEntity();
	}

}

function filterFunction_loginascx(_filters,rowIndex){
	var value;	var toAdd;
	var _json = '{';
	for ( var i=0;i<_filters.length;i++ ){
		 obj = _filters[i];
		switch(obj.getAttribute('_filterName').toLowerCase()){
			case 'cd_customer' : value = obj.value + '%'; break
			case 'name' : value = '%' + obj.value + '%'; break
			default : value = obj.value
		}
		if(value != null){
		_json = _json + '"' + obj.getAttribute('_filterName') + '":"' + value + '",'
		}
	}
	_json = _json + '"MaxRowsNumber":"10",';
	_json = _json + '"StartIndexRow":"' + ((rowIndex == null) ? 0 : rowIndex) + '",';
	_json= _json.substring(0,_json.length-1) + '}';
	return _json;
}

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
