piperSlider = {

	initialize:function(siteLocation, topLayer, bottomLayer, width, height) {


	this.wcdContentItemCIID = "null";
	this.arrowState = 'pointingRight';
	this.sliderContainmentDiv = $('SliderContainmentDiv');
	this.primarySliderDiv = $('primarySlider');
	this.primaryStaticDiv = $('primaryStatic');
	this.staticContentOnly = $('contentStatic');
	this.sliderContentOnly = $('contentSlide');
	this.bannerArrrow = $('bannerArrow');
	this.contentStaticImage = $('contentStaticImage');
	this.contentSlideImage = $('contentSlideImage');
	
	this.width = width;
	this.height = height;
	
	this.slideLayer = topLayer;
	this.staticLayer = bottomLayer;
	this.contentLocation = siteLocation;
	
	this.targetCMSContainer = this.whereDoesContentLive(this.contentLocation);
	
	this.domAssist();
		
	
	}, // END initialize
	
	
	
	whereDoesContentLive:function(passedLocation) {
	
		if (passedLocation == 'homepage') {
			this.locationEvaluated = 'c02a_hp_standard_full';
		}
		
		
		if (passedLocation == 'division') {
			this.locationEvaluated = 'c02a_dp_standard_full';
		}
		
		return this.locationEvaluated;
	
	}, // END whereDoesContentLive
	
	
	
	domAssist:function() {

		if( (navigator.appVersion.indexOf('MSIE 6.0') !=-1) || (navigator.appVersion.indexOf('MSIE 7.0')!=-1) ) {
				
			this.wcdContentItemCIID = $(this.targetCMSContainer).down('div').getAttribute('className');
			
			} else {
			
			this.wcdContentItemCIID = $(this.targetCMSContainer).down('div').getAttribute('class');	
			
		}
		
		this.wcdContentItemCIIDRoot = this.wcdContentItemCIID.slice(0,1);
		this.wcdContentItemCIIDPrefix = this.wcdContentItemCIID.slice(1,4);
		this.wcdContentItemCIIDSuffix = this.wcdContentItemCIID.slice(4,7);

		this.wcdContentItemFriendlyPath = '/Asset_Archive/PLWeb/content/000' +this.wcdContentItemCIIDRoot + '/' + this.wcdContentItemCIIDPrefix + '/' + this.wcdContentItemCIIDSuffix + '/assets/';
		
		this.bannerArrrow.setAttribute('src',this.wcdContentItemFriendlyPath+'arrow_right.gif');
		this.contentStaticImage.setAttribute('width',(this.width-30));
		this.contentStaticImage.setAttribute('height',this.height);
		
		this.contentSlideImage.setAttribute('width',(this.width-60));
		this.contentSlideImage.setAttribute('height',this.height);
		
		
		this.sliderContainmentDiv.setStyle({
		width:this.width+'px',
		height:this.height+'px'
		});
		
		this.primaryStaticDiv.setStyle({backgroundImage:'url('+this.wcdContentItemFriendlyPath + this.staticLayer+')',
		backgroundRepeat:'no-repeat',
		width:this.width+'px',
		height:this.height
		});
	
		this.primarySliderDiv.setStyle({backgroundImage:'url('+this.wcdContentItemFriendlyPath + this.slideLayer+')',
		backgroundRepeat:'no-repeat',
		width:(this.width-26)+'px',
		height:this.height
		});
		
		this.staticContentOnly.setStyle({
		width:(this.width-30)+'px',
		height:this.height,
		'float':'left'
		});
			
		this.sliderContentOnly.setStyle({
		width:(this.width-57)+'px',
		height:this.height,
		'float':'left'
		});
		
		
	}, // END domAssist
	
	
	
	arrowSwap:function() {

		if(this.arrowState == "pointingRight") {
			Effect.Fade('bannerArrow',{duration:1, afterFinish: ( function() {
				$('bannerArrow').setAttribute('src', this.wcdContentItemFriendlyPath+'arrow_left.gif');
					Effect.Appear('bannerArrow',{duration:1});
					this.arrowState = 'pointingLeft';
					} ).bind(this)
			});

		} else {
		
			Effect.Fade('bannerArrow',{duration:1, afterFinish: ( function() {
				$('bannerArrow').setAttribute('src', this.wcdContentItemFriendlyPath+'arrow_right.gif');
					Effect.Appear('bannerArrow',{duration:1});
					this.arrowState = 'pointingRight';
					} ).bind(this)
			});
		} 
	}, // END arrowSwap


	
	moveTheTopPrimaryOut:function () {
		new Effect.MoveBy('primarySlider', 0,670, {
		duration:2,
		mode:'relative',
			afterFinish: piperSlider.arrowSwap.bind(piperSlider)
		});
	
		$('arrowLink').onclick = function () {
		piperSlider.moveTheTopPrimaryIn();
		}
	
		$('staticBannerLink').setStyle({display:'block'});

	},


	moveTheTopPrimaryIn:function () {
		new Effect.MoveBy('primarySlider', 0,-670, {
		duration:2,
		mode:'relative',
			afterFinish: piperSlider.arrowSwap.bind(piperSlider)
		});
	
		$('arrowLink').onclick = function () {
		piperSlider.moveTheTopPrimaryOut();
		}
	
		$('staticBannerLink').setStyle({display:'none'});
	
	}
	
};






Event.observe(window,'load',function() {


$('SliderContainmentDiv').setStyle({position:'relative'});  // RESOLVES CONFLICT WITH HAITI BANNER

piperSlider.initialize('homepage','Spring_1.2_hp_new_prep_primary_replacement.gif', 'Spring_12_hp_bottom_tab.gif', 745, 451);
		
		$('staticBannerLink').onclick = function () {
		piperSlider.moveTheTopPrimaryIn();
		}

	var WCDCookieVal = 'sldr'+piperSlider.wcdContentItemCIID;
	
	hasThePageBeenViewed = gidLib.getCookieVar ('mktUniversalSession',WCDCookieVal);
	
	if (hasThePageBeenViewed == "") {
	
		twinTimer = setTimeout (function() {
		piperSlider.moveTheTopPrimaryOut();
		},3000);

		gidLib.setCookieVar('mktUniversalSession',WCDCookieVal,'yes');

	} else {
	
		$('arrowLink').onclick = function () {
		piperSlider.moveTheTopPrimaryOut();
		}
		
		$('staticBannerLink').onclick = function () {
		piperSlider.moveTheTopPrimaryIn();
		}
	
	$('staticBannerLink').setStyle({display:'none'});
	
	}

		
	
	
});
