/*
Process to build a decision wizard
1.	Copy the modified version of promo_dw.jsp into the store you are working in. This 
	file is identical to the global promo .jsp except that the html wrapper and javascript
	has been removed.
2.	Copy the nessessary files needed for express shop into the store and follow
	the install specific guide for express shop for decision wizards as you continue
	this install of a decision wizard.
3. 	confirm web store service is setup in the specific environment and 
	store or a proxy is in place to aviod cross-domain calls. Test The Service
	via a web browser to confirm it returning the proper data and format. Do this
	for skus, pids, express shop, and promos
4.	copy the following files into the store folder in the following structure:
		'store'
			css
				DF_DFT_main.css //optional css library
				PG_DFT_dw2.css //required decision wizard style sheet
				PG_DFT_tip.css //required if using tool tips
			js
				DF_DFT_main.js //required adds commonly used javascript
				LIB_drag.js //required for drag and drop or sliders
				WIZ_DFT_Slider.js //required for sliders
				WIZ_DFT_tip.js //required if using tool tips
				WIZ_DFT_combo.js //required for sorting results
			images
				WIZ_DFT_dw //images specific to decision wizards
					*
			'decision wizard'
				expressShop.css //required for express shop
				expressShop.js //required for express shop
				config.js //this file
				utility.js //required for basic js extentions
				dw.js //required the heart of the filtering funtionality
				effects.js //required if you want to seperate effects from program logic
				index.jsp //required shell for the decision wizards application
				loader.js //required for loader
				views.js //required for seperation of product format
				promo_dw.jsp  //required if promotional info is used
5. 	modifiy the sku call in index.jsp
6.	edit markup, css, views, effects, and this config file to your liking
*/

dw.config= {

		//load all the service paths and default parameters used by the application
		services: {
			
			//gets the full data set for a product
			getPids:{
				href: '/svc/CatalogServices/ProductData',
				method:'get',
				pars: { 
					format:'json',
					appId:'cashmoney',
					catId:'1333120',
					stoken:'/Y7HG93K8K2cp0tafhE7DA==',
					locale:'en_US',
					storeCode:'TSA'
				}
			},
			
			//gets all products as skus
			getSkus:{
				href: '/svc/CatalogServices/SkuData',
				method:'get',
				pars: {
					format:'json',
					appId:'cashmoney',
					catId:'1333120',
					stoken:'/Y7HG93K8K2cp0tafhE7DA==',
					locale:'en_US',
					storeCode:'TSA'
				}
			},
			
			//loads variables into the express shop call
			getExpressShop: {
				href:'../include/productDetails.jsp',
				pars: {
					catId:'1333120'
				}
			},
			
			//path to a modified promo jsp file
			getPromo: {
				method:'get',
				href:'promo_dw.jsp'
			}
		},
		
		//its a shame i had to do this one but here it is. This function will take the skus
		//one by one and allow you to refactor them before the application parses them.
		//ie. you don't get what you need from the service.
		//example: taking the size attribute in the sku object and splicing it into
		//size and width attributes.
		refactorSku: function(sku){ // optional (false|function)
				//split size
				var temp = sku.size.trim().split(' ');
				sku.size = temp.shift();
				if(temp.length>0){
					sku.width = temp.join(' ');//add width
				}else{
					sku.width = 'standard';//make standard
				}
				return sku;
		},
		
		//the attributes that will be used for filtering
		filters:[
			{
				//filter specific
				filter:'size', //required ('sku attribute') 
				displayName:'Size', //required ('string')
				displayType:'checkBox', //required ('checkBox'|'rangeSlider')
				//info:'test info, //optional
				holderClass: 'swatch', //optional ('class Name')
				loadState:'open',  //required ('open'|'closed')
				
				//filter options specific
				//optionsFilter = filter 
				optionsFilterFn: function(s){return parseFloat(s)}, //optional (function) applyed to sorting only 
				optionsDisplay:'size', //required ('sku attribute')
				//optionsDisplayFn:function(s){return parseFloat(s)}, //optional (function)
				optionsSortParameter:'filter', //optional - required if optionsSortFn is set ('filter'|'optionsDisplay')
				optionsSortFn:function(a){return a.ASC('filter')} //optional function
			
			},
			
			{
				//filter specific
				filter:'width', //required ('sku attribute')
				displayName:'Width', //required ('string')
				displayType:'checkBox', //required ('checkBox'|'rangeSlider')
				//info:'test info, //optional
				//holderClass: 'swatch', //optional ('class Name')
				loadState:'closed', //required ('open'|'closed')
				
				//filter options specific
				//optionsFilter = filter 
				//optionsFilterFn: function(s){return parseFloat(s)}, //optional (function) applyed to sorting only 
				optionsDisplay:'width', //required ('sku attribute')
				//optionsDisplayFn:function(s){return s.caps()}, //optional function
				optionsSortParameter:'filter', //optional - required if optionsSortFn is set ('filter'|'optionsDisplay')
				optionsSortFn:function(a){return a.ASC('filter')} //optional function
			
			},
			
			{
				//filter specific
				filter:'brand', //required ('sku attribute')
				displayName:'Brand', //required ('string')
				displayType:'checkBox', //required ('checkBox'|'rangeSlider')
				//info:'test info, //optional
				//holderClass: 'swatch', //optional ('class Name')
				loadState:'open', //required ('open'|'closed')
				
				//filter options specific
				//optionsFilter = filter 
				//optionsFilterFn: function(s){return parseFloat(s)}, //optional (function) applyed to sorting only 
				optionsDisplay:'brandLabel', //required ('sku attribute')
				//optionsDisplayFn:function(s){return '$' + s}/*, //optional function
				optionsSortParameter:'optionsDisplay', //optional - required if optionsSortFn is set ('filter'|'optionsDisplay')
				optionsSortFn:function(a){return a.ASC('optionsDisplay')} //optional function
			
			},
			
			{
				//filter specific
				filter:'sgpRnngShoeType', //required ('sku attribute')
				displayName:'Shoe Type', //required ('string')
				displayType:'checkBox', //required ('checkBox'|'rangeSlider')
				info:'<h1>Shoe Type</h1><dl><dt>Cushioning</dt><dd><img src="../images/WIZ_DFT_dw/dw_neutral.gif" />Extra cushioning is suggested for runners who need additional support on the shoe base (midsole) and less on the inner side (medial sole). It assists runners with high or normal arches, who shift a minimum amount of weight to the inside of the foot (minimum pronation).</dd><dt>Motion Control</dt><dd><img src="../images/WIZ_DFT_dw/dw_overpronate.gif" />This feature is suggested for runners with low arches. It compensates for moderate to severe weight shift to the inside to the foot (major overpronation), offers maximum rearfoot control, and provides extra support on the medial (arch) side of the shoes. It is best fit for larger runners who need greater firmness and durability.</dd><dt>Stability</dt><dd><img src="../images/WIZ_DFT_dw/dw_underpronate.gif" />Enhanced stability is suggested for runners with low to normal arches and mild to moderate weight shift to the inside if the foot (minor overpronation). Shoes with good support and base (midsole) cushioning serve these runners best.</dd><dt>Trail</dt><dd>Shoes optimized for trail running are suggested for runners who venture off of paved surfaces. These shoes are typically extra weather- and water-resistant and are equipped with greater outsole (shoe bottom) traction. Many trail shoes are built low-to-the-ground for increased stability on rough trails.</dd></dl>',
				//holderClass: 'swatch', //optional ('class Name')
				loadState:'closed', 
				
				//filter options specific
				//optionsFilter = filter 
				//optionsFilterFn: function(s){return parseFloat(s)}, //optional (function) applyed to sorting only 
				optionsDisplay:'sgpRnngShoeType', //required ('sku attribute')
				//optionsDisplayFn:function(s){return '$' + s}/*, //optional function
				optionsSortParameter:'filter', //optional - required if optionsSortFn is set ('filter'|'optionsDisplay')
				optionsSortFn:function(a){return a.ASC('filter')} //optional function
			
			},
			
			{
				//filter specific
				filter:'price', //required ('sku attribute')
				displayName:'Price', //required ('string')
				displayType:'rangeSlider', //required ('checkBox'|'rangeSlider')
				//info:'test info, //optional
				//holderClass: 'swatch', //optional ('class Name')
				loadState:'open', //required ('open'|'closed')
				
				//filter options specific
				//optionsFilter = filter 
				optionsFilterFn: function(s){return parseFloat(s)}, //optional (function) applyed to sorting only 
				optionsDisplay:'price', //required ('sku attribute')
				optionsDisplayFn:function(s){return s.dollars()}, //optional function
				optionsSortParameter:'filter',//, //optional - required if optionsSortFn is set ('filter'|'optionsDisplay')
				optionsSortFn:function(a){return a.ASC('filter')} //optional function
			
			}
		],
		
		stickyFilters: true,
		
		//populate the dropdown list for sorting results (comment object for no sorters)
		//a = the list of skus in your result set. this set is used to build a unique list if pids.
		//first one is the load state and default view in the dropdown
		//available array sorters:
		//	a.DESC('parameter')
		//	a.ASC('parameter')
		//	a.custom callback function
		sorters: [ //optional ([{},{}])
			//sorts results by price desending
			{
				label:'<span class="fB">Price:</span> Descending',
				fn:function(a){
					a.DESC('price')
				}
			},
			
			//sorts results by price ascending
			{
				label:'<span class="fB">Price:</span> Ascending',
				fn:function(a){
					a.ASC('price')
				}
			}
		],
		
		//the way the results will be displayed
		views: [
			{
				min:0, //required (int) minimum filtered results needed to display product view 
				displayFunction:views.pidDetail, //required (function) function called to display html of view - index and data is sent as parameters
				dragReplaceFunction:views.buildDragImagePidDetail, //required (function) function called to rewrite dragable action  
				recSet: 3 //required (int) count of products to display for each page of the view
			},
			
			{
				min:10, //required (int) minimum filtered results needed to display product view
				displayFunction:views.pidThumb, //required (function) function called to display html of view - index and data is sent as parameters
				dragReplaceFunction:views.buildDragImagePidThumb, //required (function) function called to rewrite dragable action
				recSet: 6 //required (int) count of products to display for each page of the view
			},
			
			{
				min:25, //required (int) minimum filtered results needed to display product view
				displayFunction:views.pidList, //required (function) function called to display html of view - index and data is sent as parameters
				dragReplaceFunction:views.buildDragImagePidList, //required (function) function called to rewrite dragable action
				recSet: 8 //required (int) count of products to display for each page of the view
			}
		],
		
		//function to display pagination
		paginationType: "static", //required ("static"|"reload")
		paginationFn: views.buildPagination, //required (function)
		
		//function happens only the first time the application is viewed (cookie based)
		firstTimeLoad: views.firstTimeLoad, //optional (false|function)
		
		//function happens every time the application is loaded
		everyTimeLoad: false, //optional (false|function)
		
		//path to prepend product images
		absPath: '',
		
		//comp grid
		//products to scroll at a time in the comp grid
		scrollItemsBy: 1,
		
		//flag for weather or not the compare attributes should come from product flags
		useCompareFlag: true,
		
		//attributes used in the comp grid value must be a pid level attribute
		compareAttributes: [
			{filter: 'shortDescription', label: 'Description', seq:100}
		],
		
		//Express shop 
		addToCartSource: 'mens'
	}
	
