dw.effects = {
		//loading a pid for the first time
		loadingPid: function(ele){
                                Element.setStyle(ele,{opacity:0})
                                $(ele).animate({opacity:1});
			
		},

		//display and hide filters
		toggleFilterDisplay: function(obj,key,opp){
			var timer = 'filterTimer_'+key
			if(parseInt(obj.offsetHeight)>42 && opp != 'all'){
				obj.getElementsByTagName('h3')[0].className = ''
				$(obj).animate({height:39})
				dw.config.filters[key].loadState = 'closed'
			}else if(opp != 'none'){
				$(obj).animate({height:function(){return this.scrollHeight}.bind(obj)})
				obj.getElementsByTagName('h3')[0].className = 'open'
				dw.config.filters[key].loadState = 'open'
			}
		},

		//animating count
		incrementNumber: function(){
			var start = parseInt($('pidCount').innerHTML)
			var delta = start - dw.vars.pidList.length
			var skip = Math.ceil(Math.abs(delta)/10)
			var suff = '<span> Results</span>'
			if(dw.vars.pidList.length ==1)suff = '<span> RESULT</span>'
			if(delta < 0){
				var numberTimer = setInterval(incUp,40)
			}else if(delta > 0){
				var numberTimer = setInterval(incDown,40)
			}

			function incUp(){
				if(start < dw.vars.pidList.length){
					$('pidCount').innerHTML = start + suff
					start = start + skip
				}else{
					$('pidCount').innerHTML = dw.vars.pidList.length + suff
					clearInterval(numberTimer)
				}
			}

			function incDown(){
				if(start > dw.vars.pidList.length){
					$('pidCount').innerHTML = start + suff
					start = start - skip
				}else{
					$('pidCount').innerHTML = dw.vars.pidList.length + suff
					clearInterval(numberTimer)
				}
			}
		},

		//hiding the comparision grid
		hideCompGrid: function(obj){
			$(obj).animate({opacity: 0.001, onComplete: function(){
				this.style.display = 'none'
			}.bind(obj)});
		},

		//showing the comparision grid
		showCompGrid: function(obj){
			$(obj).animate({opacity: 0.9999})
		},

		//move comp grid to see products to the right
		moveCompGridRight: function(moveto){
			dw.effects.turnOffAll()

			$('cgTR').animate({left: moveto});
			$('cgBR').animate({left: moveto, onComplete: function(){
				var left = parseInt($('cgBR').style.left)
				var next = $('compGridNextButton')
				var prev = $('compGridPreviousButton')
				if(left<= -1*(dw.compChart.width-(dw.compChart.recWidth*3))){
					next.className = 'rightArrowOff';
					next.onclick = null;
					prev.className = 'leftArrowOn';
					prev.onclick = dw.previousButtonOnclick;

				}else{
					prev.className = 'leftArrowOn';
					prev.onclick = dw.previousButtonOnclick;
					next.className = 'rightArrowOn';
					next.onclick = dw.nextButtonOnclick;
				}
			}});
		},

		//move comp grid to see products to the left
		moveCompGridLeft: function(moveto){
			dw.effects.turnOffAll()

			$('cgTR').animate({left: moveto});
			$('cgBR').animate({left: moveto, onComplete: function(){
				var left = parseInt($('cgBR').style.left)
				var next = $('compGridNextButton')
				var prev = $('compGridPreviousButton')
				if(left==0){
					prev.className = 'leftArrowOff'
					prev.onclick = null
					next.className = 'rightArrowOn'
					next.onclick = dw.nextButtonOnclick;
				}else{
					next.className = 'rightArrowOn'
					next.onclick = dw.nextButtonOnclick;
					prev.className = 'leftArrowOn';
					prev.onclick = dw.previousButtonOnclick;
				}
			}});
		},

		turnOffAll: function(){
			var next = $('compGridNextButton')
			next.onclick = null
			next.className = 'rightArrowOff'
			var prev = $('compGridPreviousButton')
			prev.onclick = null
			prev.className = 'leftArrowOff'
		},

		//close promo
		closePromo: function(){
			var promo = $('promo')
			promo.animate({opacity: 0.001, onComplete:function(){
				this.style.display = 'none'
			}.bind(promo)});

			if ($('drpCustomTagProductSize_0'))
			{
				$('drpCustomTagProductSize_0').style.visibility = 'visible';
			}

			if ($('drpCustomTagProductColor_0'))
			{
				$('drpCustomTagProductColor_0').style.visibility = 'visible';
			}

		},

		openPromo: function(){
			$('promoTitle').innerHTML = ''
			$('promoContent').innerHTML = ''

			if ($('drpCustomTagProductSize_0'))
			{
				$('drpCustomTagProductSize_0').style.visibility = 'hidden';
			}

			if ($('drpCustomTagProductColor_0'))
			{
				$('drpCustomTagProductColor_0').style.visibility = 'hidden';
			}

			$('promo').style.display = 'block'
			$('promo').animate({opacity:.9999})
		}
	}