/**
 * The DC object is the single global object used by the DC Library.  It
 * can be setup to contain utility functions for initialization, setting up 
 * namespaces & inheritance.
 * 
 * @module dc_util.js
 * @title  DC
 */

// test if DC namespace exists
if(window["DC"] == null) {
	DC = {};
}

var errorMsg=new String();	
var anyErrors=0;

//holds current background image
var bgImage;
var sendFriendConfig = {
	overlayHeight: '305px',
	overlayWidth: '628px',
	sendAnother: true,
	submission: {
		id: 'hdm.696',
		url:'http://hdonline.rsys1.net/servlet/campaignrespondent'
	},
	callback: function(media) {
		stafMedia = media;
	},
	getParams: function(params, media) {
		var nav = DarkCustom.getNavigation();
		params.community = comSiteName;
		params.view = comPageUrl;
		params.media = (media && media.mediaId) || '0';
		params.param1 = media && media.mediaId ? 'detail' : 'gallery';
		params.param2 = media && media.contentType ? media.contentType : 'all';
		params.param3 = '#' + HD.util.Common.timestamp() + Math.floor(Math.random()*10000);
		return params;
	}
};

/**
 * DC.util is the namespace used for all Dark Custom utility functions
 * @class DC.util
 * @type Object
 * @static
 */
DC.util = {
	
	/**
	 * init function preloads images and other assets, fires the initial call to set the background, and assigns click events to initial page elements to change backgrounds, 
	 * @type Object
	 * @static
	 */
	init : function(){
		//set video player skin params
		HD.util.Player.View.prototype.setStyle('&frontcolor=999999&lightcolor=ffffff');
	
		//Preload all background images
		DC.util.changeBackground();
		
		// Attach widget observers.
		this.setObservers();
		
		// Attach DOM event listeners.
		this.setListeners();
		
	},
	
	// Attach observer methods to widgets.
	setObservers: function() {
		var self = this;
		
	},
	
	// Attach DOM event listeners.
	setListeners: function() {
		
		//Behavior for the Find a dealer search in the header
		HD.getByClass('zipField', 'input', 'darkCustom', function(el) {
			var fieldValue = 'Enter Zip Code';
			el.onfocus = function() {
				HD.removeClass('zipField','error');
				if (el.value == fieldValue) {
					el.value = '';
				}
			};			
			el.onblur = function() {
				if (el.value == '') {
					el.value = fieldValue;
				}
			};						
		});
		HD.getByClass('dealerSubmitBtn', 'input', 'darkCustom', function(el) {
			el.onclick = function() {
				var zipField = HD.get('zipField'); 
				var fieldValue = 'Enter Zip Code';
				if (zipField.value == fieldValue || zipField.value == '') {
					HD.addClass('zipField','error');
				} else {
					HD.removeClass('zipField','error');
					var url = HD.util.Common.getServerUrl() + '/en_US/Content/Pages/dealer-locator/dealer-locator.html#/locator?query=' + zipField.value;
					DC.util.launchDealerLocatorPopup(url);
				}
			};			
		});
	},
	
	launchDealerLocatorPopup : function (inUrl){
		//Defaul URL
		var url = HD.util.Common.getServerUrl() + '/en_US/Content/Pages/dealer-locator/dealer-locator.html?popup=true';
		
		//Override if a URL was passed in.
		if(inUrl != null && inUrl.length > 0){
			url = inUrl;
		}
		
		window.open(url, '', 'width=1025,height=700,location=no,menubar=no,status=no,toolbar=no');
	},
	
	showSelectBoxes : function(){
		var selectElements = YAHOO.util.Dom.getElementsBy(function(){return true;}, 'select');		
		for(var x=0; x<selectElements.length; x++){			
			YAHOO.util.Dom.setStyle(selectElements[x], 'visibility', 'visible');			
		}				
	},
	
	hideSelectBoxes : function() {
		var selectElements = YAHOO.util.Dom.getElementsBy(function(){return true;}, 'select');
		var overlaySel = YAHOO.util.Dom.getElementsBy(function(){return true;}, 'select','submissionContent');
		for(var x=0; x<selectElements.length; x++){			
			if(selectElements[x] != overlaySel[0]){
				YAHOO.util.Dom.setStyle(selectElements[x], 'visibility', 'hidden');
			}				
		}			
	},
	

	/**
	 * changeBackground changes the background image based on math.random in the range of the array of available images.
	 * @type Object
	 * @static
	 */
	changeBackground : function (){
	
		//set base image path
		var imgPath = "/en_US/Media/images/Content/Pictorial/dark_custom_v3/";
		
		//create imgPaths array
		var imgPaths = new Array();
		var tilePaths = new Array();
		var tiles = new Array();
		
		// load paths into array
		imgPaths[0] = "";
		imgPaths[1] = imgPath + "img_bg_DC_2011_1.jpg";
		imgPaths[2] = imgPath + "img_bg_DC_2011_2.jpg";
		
		tilePaths[0] = "";
		tilePaths[1] = imgPath + "deadmechanicTile.jpg";
		tilePaths[2] = imgPath + "drippageTile.jpg";
		
		tiles[0] = "";
		tiles[1] = '#1f1b1a' ;
		tiles[2] = '#000000';
	
		
		//create random number and use it to select an image path
		var rand = Math.floor(Math.random()*2+1);
		var randImage = imgPaths[rand];
		var randTile = tiles[rand];
		var htmlEl = YAHOO.util.Dom.getElementsBy(function(){return true},'html');
		var tbodyEl = YAHOO.util.Dom.get('pageBody');
		var tableIntEl = YAHOO.util.Dom.get('pageContent');
		
		YAHOO.util.Dom.setStyle('bgtile','background','transparent');
		YAHOO.util.Dom.setStyle(tableIntEl,'background','transparent');
		
		//compare stored bgImage to new randImage picked
		if ( bgImage == randImage ){
			rand = Math.round((rand / 2) + 1);
			//store background image and properties
			image = imgPaths[rand];
			bgProperties =  'transparent url(' + image + ') no-repeat center top';
			//store tile properties
			tileProperties = tiles[rand];
			//set background image and corresponding tile
			//YAHOO.util.Dom.setStyle('bgTile','background',tileProperties);
			YAHOO.util.Dom.setStyle('contentCenter','background',bgProperties);
			//set space at bottom to same as content bg
			YAHOO.util.Dom.setStyle(htmlEl,'background',tileProperties);
			YAHOO.util.Dom.setStyle(tbodyEl,'background',tileProperties);
			YAHOO.util.Dom.setStyle(tableIntEl,'background','transparent');
			//reset bgImage to new image
			bgImage = image;
		}
		else {
			//store background image and properties
			image = randImage;
			bgProperties =  'transparent url(' + image + ') no-repeat center top';
			//store tile properties
			tileProperties = randTile;
			//set background image and corresponding tile
			//YAHOO.util.Dom.setStyle('bgTile','background',tileProperties);
			YAHOO.util.Dom.setStyle('contentCenter','background',bgProperties);
			YAHOO.util.Dom.setStyle(htmlEl,'background',tileProperties);
			YAHOO.util.Dom.setStyle(tbodyEl,'background',tileProperties);
			YAHOO.util.Dom.setStyle(tableIntEl,'background','transparent');
			//reset bgImage to new image
			bgImage = image;
		}
	},
	
	/**
	 * Learn to Ride Overlay
	 */
	launchRidersEdge : function (){
		
		//Set Tracking
		var pageURL = window.location.pathname;
        var PageName = pageURL.substring(pageURL.lastIndexOf('/') + 1);    
		_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Learn+to+Ride');
		
		var overlayContent = '<div class="ridersEdgeOverlay">\
								<div class="overlayHeader">\
									<h1>Learn to Ride</h1>\
									<p>In just one course, you could be riding. No joke. With the <a href="http://www.harley-davidson.com/wcm/Content/Pages/riders_edge_online/search.jsp?locale=en_US&expLvl=new" onclick="_hbPageView(\''
									+ PageName
									+ '\', \'/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Link+Click/RidersEdge\');">Harley-Davidson&#174; Rider\'s Edge&#174; New Rider Course</a>, you can learn from the experts and go from four wheels to two in just a few days. See for yourself.</p>\
								</div>\
								<div id="dcVideo" class="overlayVideoContainer">\
									<div id="jwPlayer"></div>\
								</div>\
								<div id="overlayIcons">\
									<div class="box1">\
										<a href="javascript:DC.util.launchRidersEdgeVideo(1)">BMX riders</a>\
										<p>A group of BMX riders try their hand at riding motorcycles.</p>\
									</div>\
									<div class="box2">\
										<a href="javascript:DC.util.launchRidersEdgeVideo(2)">Marisa Miller</a>\
										<p>Supermodel Marisa Miller learned to ride. What are you waiting for.</p>\
									</div>\
									<div class="box3">\
										<a href="javascript:DC.util.launchRidersEdgeVideo(3)">Metal Band Job</a>\
										<p>Metal band Job For A Cowboy takes the Rider\'s Edge&#174; New Rider Course.</p>\
									</div>\
								</div>\
								<div class="overlayButtons">\
									<a href="http://www.harley-davidson.com/wcm/Content/Pages/riders_edge_online/search.jsp?locale=en_US&expLvl=new" onclick="_hbPageView(\''
									+ PageName
									+ '\', \'/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Link+Click/RidersEdge\');" class="btn1">Sign Up For a Rider\'s Edge Class Near You</a>\
									<a href="javascript:void(0);" onclick="_hbPageView(\''
									+ PageName
									+ '\', \'/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Link+Click/MSF\'); window.open(\'http://www.msf-usa.org/\');" class="btn2">Learn About MSF Courses</a>\
									<select id="stateLicensing" name="stateLicensing">\
										<option value="">Find licensing info for your state...</option>\
										<option value="AL">Alabama</option>\
										<option value="AK">Alaska</option>\
										<option value="AZ">Arizona</option>\
										<option value="AR">Arkansas</option>\
										<option value="CA">California</option>\
										<option value="CO">Colorado</option>\
										<option value="CT">Connecticut</option>\
										<option value="DE">Delaware</option>\
										<option value="FL">Florida</option>\
										<option value="GA">Georgia</option>\
										<option value="HI">Hawaii</option>\
										<option value="ID">Idaho</option>\
										<option value="IL">Illinois</option>\
										<option value="IN">Indiana</option>\
										<option value="IA">Iowa</option>\
										<option value="KS">Kansas</option>\
										<option value="KY">Kentucky</option>\
										<option value="LA">Louisiana</option>\
										<option value="ME">Maine</option>\
										<option value="MD">Maryland</option>\
										<option value="MA">Massachusetts</option>\
										<option value="MI">Michigan</option>\
										<option value="MN">Minnesota</option>\
										<option value="MS">Mississippi</option>\
										<option value="MO">Missouri</option>\
										<option value="MT">Montana</option>\
										<option value="NE">Nebraska</option>\
										<option value="NV">Nevada</option>\
										<option value="NH">New Hampshire</option>\
										<option value="NJ">New Jersey</option>\
										<option value="NM">New Mexico</option>\
										<option value="NY">New York</option>\
										<option value="NC">North Carolina</option>\
										<option value="ND">North Dakota</option>\
										<option value="OH">Ohio</option>\
										<option value="OK">Oklahoma</option>\
										<option value="OR">Oregon</option>\
										<option value="PA">Pennsylvania</option>\
										<option value="RI">Rhode Island</option>\
										<option value="SC">South Carolina</option>\
										<option value="SD">South Dakota</option>\
										<option value="TN">Tennessee</option>\
										<option value="TX">Texas</option>\
										<option value="UT">Utah</option>\
										<option value="VT">Vermont</option>\
										<option value="VA">Virginia</option>\
										<option value="WA">Washington</option>\
										<option value="WV">West Virginia</option>\
										<option value="WI">Wisconsin</option>\
										<option value="WY">Wyoming</option>\
									</select>\
									<img class="stateLicensing" alt="GO" src="/en_US/Media/images/Content/Pictorial/dark_custom_v3/spacer.gif">\
								</div>\
							</div>';	
							var overlayEl = HD.util.Common.showOverlay(overlayContent, "", 790, 792, true, 'riderEdgeVideo');
							
							//setup the first video							
							DC.util.launchRidersEdgeVideo(1);
							
							//open state licensing
							HD.getByClass('stateLicensing', '*', 'hdwcOverlay', function(el) {

								el.onclick = function() {

									var stateSelect = HD.get('stateLicensing');
									var stateAbbrev = stateSelect.value;
									var licensing = DarkCustom.templates.overlays.licensing;
									
									//Set Tracking
									var pageURL = window.location.pathname;
							        var PageName = pageURL.substring(pageURL.lastIndexOf('/') + 1);
							        var trackingString = '/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Link+Click/License/' + stateAbbrev;
									_hbPageView(PageName, trackingString);

									if(stateAbbrev){

										var overlayEl = HD.util.Common.showOverlay(licensing.showState(licensing.states[stateAbbrev]), "", 487, 200, true, 'bgGTR');
										DarkCustom.engine.dao.notifyObservers('stateLicensingOpened', {state:stateSelect.options[stateSelect.selectedIndex].text});

										// Set Listener for link tracking 
										HD.getByClass('stateLink', '*', overlayEl, function(el) {
											el.onclick = function() {
												var stateEl = HD.get('state');
												DarkCustom.engine.dao.notifyObservers('licenseLinkClicked', {state:stateEl.value});
											};
										});

										// Set listener for url submission
										HD.getByClass('hdSubmitBtn', '*', overlayEl, function(el) {
											el.onclick = function() {
												var stateEl = HD.get('state');
												var urlEl = HD.get('url');
												var currentUrlEl = HD.get('currentUrl');
												HD.Login.Model.prototype.setRpc();
												var urlRequest = {state:stateEl.value, url: urlEl.value, currentUrl: currentUrlEl.value};
												HD.getByClass('hdActive', '*', overlayEl, function(el) {
												HD.removeClass(el, 'hdActive');
												});
												EmailService.sendStateMotorcycleURLLink(urlRequest, function(urlResponse){
													// Some work goes here. 
													var errors = urlResponse.errors;
													if (errors && errors.length > 0){
														HD.getByClass('hdErrors', '*', overlayEl, function(el) {
															var errorMessage = '';
															for (var i=0; i<errors.length; i++){
																errorMessage += '<p>The '+errors[i].errorMessage+' is missing.</p>';
															}
															HD.addClass(el, 'hdActive');
															el.innerHTML = errorMessage; 
														});
													}
													else{
														HD.getByClass('hdThanks', '*', overlayEl, function(el) {		
															HD.addClass(el, 'hdActive');
															HD.removeClass(el, 'hdHidden');
														});
														HD.getByClass('hdForm', '*', overlayEl, function(el) {		
															HD.addClass(el, 'hdHidden');
														});
													}
												});
												HD.Login.Model.prototype.resetRpc();
											};
										});
									}
								};
							});			

							
							
		
	},
	
	/**
	 * Launch Learn to Ride Videos
	 */
	launchRidersEdgeVideo : function (videoNumber){		
		
		//Get page name for Tracking
		var pageURL = window.location.pathname;
        var PageName = pageURL.substring(pageURL.lastIndexOf('/') + 1);
		
		HD.get('overlayIcons').className = "video" + videoNumber;
		
		var fileName;
		
		if (videoNumber == 1) {
			fileName = '/en_US/Media/video/dark_custom_v3/DC_ridersEdge_1.mp4';
			//Set Tracking   
			_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Video+Play/BMX');
		} 
		else if (videoNumber == 2) {
			fileName = '/en_US/Media/video/dark_custom_v3/DC_ridersEdge_2.mp4';
			//Set Tracking   
			_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Video+Play/Marisa+Miller');
		}
		else if (videoNumber == 3) {
			fileName = '/en_US/Media/video/dark_custom_v3/DC_ridersEdge_3.mp4';
			//Set Tracking   
			_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Learn+to+Ride/Video+Play/Cowboy');
		}
		
		//setup the video
		jwplayer("jwPlayer").setup({
	        flashplayer: "/hdjs/core/1.0/hd_player/assets/player.swf",
	        skin: "/en_US/Media/js/harlistas/documentary/jwplayer/harlistasDocumentary.zip",
	        autostart: "true",
	        file: fileName,
	        controlbar: "bottom",
	        height: 360,
	        width: 640
	    });
		
	},
	
	/**
	 * Launch Dip Dark Custom Video
	 */	
	launchDipVideoDarkCustom : function (){
    	HD.util.Common.showOverlay('<div id="jwPlayer"></div>', "", 720, 480, true, 'dipVideo');

    	//setup the video
		jwplayer("jwPlayer").setup({
	        flashplayer: "/hdjs/core/1.0/hd_player/assets/player.swf",
	        skin: "/en_US/Media/js/harlistas/documentary/jwplayer/harlistasDocumentary.zip",
	        autostart: "true",
	        file: "/en_US/Media/video/dark_custom_v3/HD_Dark_Custom_v3.mp4",
	        controlbar: "bottom",
	        height: 480,
	        width: 720
	    });

		//Set Tracking
		var pageURL = window.location.pathname;
        var PageName = pageURL.substring(pageURL.lastIndexOf('/') + 1);    
		_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Video+Play/Dark+Custom/landing');
		if(typeof mmConversion=='function') {
				mmConversion(115160);
		};
	},
	
	/**
	 * Launch Dip Blackline Video
	 */	
	launchDipVideoBlackline : function (){
    	HD.util.Common.showOverlay('<div id="jwPlayer"></div>', "", 720, 480, true, 'dipVideo');

    	//setup the video
		jwplayer("jwPlayer").setup({
	        flashplayer: "/hdjs/core/1.0/hd_player/assets/player.swf",
	        skin: "/en_US/Media/js/harlistas/documentary/jwplayer/harlistasDocumentary.zip",
	        autostart: "true",
	        file: "/en_US/Media/video/dark_custom_v3/Blackline2011_Rev2_60_SHOW.mp4",
	        controlbar: "bottom",
	        height: 480,
	        width: 720
	    });		
		
		//Set Tracking
		var pageURL = window.location.pathname;
        var PageName = pageURL.substring(pageURL.lastIndexOf('/') + 1);    
		_hbPageView(PageName, '/Products/Motorcycles/Dark+Custom/Video+Play/Blackline/landing');
		
	},
	
	/**
	 * Executes user logout 
	 */	
	userLogout : function (){
		HD.Profile.profile.view.logoutUser();
	}

}

/*
Survey code below
*/

var _DOMAIN	= 'harley-davidson.com';
var _TEST	= '#testsurvey3';

var Survey4 = { };
Survey4.DarkCustom = {
	checkVisitCookie: function(){
		var visitCookie = YAHOO.util.Cookie.get("hd_darkcustom_survey");
		//console.log('cookie:'+visitCookie);
		var expdate = new Date();
		expdate.setFullYear(expdate.getFullYear() + 1);
		// create cookie
		if(!visitCookie || (location.hash==_TEST)){
			YAHOO.util.Cookie.set("hd_darkcustom_survey", (visitCookie = "0,0,0,0,0,0,0,0,0"), {
				path: "/", domain: _DOMAIN, expires: expdate
			});
		// already taken or opted out
		} else if(visitCookie == '-1,-1,-1,-1,-1,-1,-1,-1,-1'){
			return;
		}
		//-- for 5% of the time, offer a option at taking a survey if 3 of 4 visits > 0
		var n = Math.round(Math.random()*100);
		visitCookie = visitCookie.split(',');
		var uv = 0;
		// count unique pages
		var loc = window.location.toString().match(/.*\/([a-z0-9.\-]+)(#.*)?$/);
		loc = loc[1];
		var pgs = ['dark-custom.html','iron-883.html','nightster.html','forty-eight.html','seventy-two.html','street-bob.html',
				   'fat-bob.html','blackline.html','cross-bones.html','bikes-gallery.html'];
		for(var pi = 0; pi < pgs.length; pi++){ if(pgs[pi] == loc) break; }
		if(pi < visitCookie.length) visitCookie[pi]++;
		//console.log('Cookie incremented:'+visitCookie.join(','));
		for(var i = 0; i < visitCookie.length; i++){ visitCookie[i] = parseInt(visitCookie[i]); uv += visitCookie[i] ? 1 : 0; }
		//console.log('count yields:'+uv);
		if((uv >= 3 && n <= 10) || (location.hash==_TEST)) {
			Survey4.DarkCustom.askSurvey();
		} else {
			YAHOO.util.Cookie.set("hd_darkcustom_survey", visitCookie.join(','), {
				path: "/", domain: _DOMAIN, expires: expdate
			});
		} // if..else
	} // checkVisitCookie
	,
	askSurvey: function(){
		YAHOO.util.Get.script("http://www.harley-davidson.com/hdjs/combo.jsp?/core/1.0/hd_observable/hd_observable-min.js&/core/1.0/hd_common/hd_common-min.js", {
			onSuccess: function() {
				YAHOO.util.Get.css([
					//"http://www.harley-davidson.com/Community/media/external/hd-external-all.css",
					//"http://www.harley-davidson.com/Community/media/hd-all.css",
					"/en_US/Media/css/dark-custom-survey.css"
				], {
					onSuccess: function() {
						var transaction = YAHOO.util.Connect.asyncRequest('GET', '/en_US/Content/Pages/dark-custom/dark-custom-survey.dialog.html', {
							success: function(result) {
								var overlayDataHTML = result.responseText;
								HD.util.Common.showOverlay(overlayDataHTML, "", 711, 204, true, "darkcustomSurveyDialog");
								YAHOO.util.Event.onContentReady("hd_darkcustom_survey", function(){
									YAHOO.util.Event.addListener('darkcustomSurveyYesLink', 'click', Survey4.DarkCustom.offerSurvey);
									YAHOO.util.Event.addListener('darkcustomSurveyNoLink', 'click', Survey4.DarkCustom.neverSurvey);
								}); // onContentReady
								//-- Omniture
								_hbPageView('survey_ask','/Community+Surveys/Dark+Custom/ask');
							},
							failure: function (oResponse) {
								alert("Sorry, we couldn't show the survey dialog.  Refresh your browser to try again.");
							},
							argument: "Got dark-custom-survey.dialog.html"
						}, null);
					} // onSuccess..Get.css
					,
					onFailure: function() {
						alert("Sorry, we couldn't style the survey dialog.  Refresh your browser to try again.");
					} // onFailure..Get.css
				}); // YAHOO.util.Get.css
			} // onSuccess..Get.script
			,
			onFailure: function() {
				alert("Sorry, we couldn't open the survey dialog.  Refresh your browser to try again.");
			} // onFailure..Get.script
		}); // YAHOO.util.Get.script
	} // askSurvey
	,
	offerSurvey: function(e){
		YAHOO.util.Event.stopEvent(e);
		var s_vi	= encodeURI(YAHOO.util.Cookie.get("s_vi"));
		var hbx_mlc	= (typeof hbx == "undefined") ? '' : encodeURI(hbx.mlc);
		var hbx_pn	= (typeof hbx == "undefined") ? '' : encodeURI(hbx.pn);
		window.open('http://polldaddy.com/s/309C6003081C0D28?s_vi='+s_vi+'&hbx.mlc='+hbx_mlc+'&hbx.pn='+hbx_pn, '', 'width=745,height=540,scrollbars=yes,resizable=yes,toolbar=no,location=no,menubar=no,directories=no,status=no');

		var expdate = new Date();
		expdate.setFullYear(expdate.getFullYear() + 1);
		YAHOO.util.Cookie.set("hd_darkcustome_survey", "-1,-1,-1,-1,-1,-1,-1,-1,-1", {
			path: "/", domain: _DOMAIN, expires: expdate
		});
		//-- Omniture
		_hbPageView('survey_accepted','/Community+Surveys/Dark+Custom/accepted');
		//-- close dialog
		HD.util.Common.hideOverlay(true);
	} // offerSurvey
	,
	neverSurvey: function(e){
		YAHOO.util.Event.stopEvent(e);

		var expdate = new Date();
		expdate.setFullYear(expdate.getFullYear() + 1);
		YAHOO.util.Cookie.set("hd_darkcustom_survey", "-1,-1,-1,-1,-1,-1,-1,-1,-1", {
			path: "/", domain: _DOMAIN, expires: expdate
		});
		//-- Omniture
		_hbPageView('survey_refused','/Community+Surveys/Dark+Custom/never');
		//-- close dialog
		HD.util.Common.hideOverlay(true);
	} // neverSurvey

}; // end Survey.Satisfaction namespace


YAHOO.util.Event.onDOMReady(function(){

	//add required YUI class to body tag
	var bodyEl = document.getElementsByTagName('body');
	YAHOO.util.Dom.addClass(bodyEl,'yui-skin-sam');
		
	//check for center content div and then init util script (runs preloader and assigns initial bkg image randomly to contentCenter div
	YAHOO.util.Event.onAvailable('contentCenter',function(){
		DC.util.init();
	});
	
	Survey4.DarkCustom.checkVisitCookie();
	s.prop27 = YAHOO.util.Cookie.get("s_vi").replace(/[\[\]\|]/g,''); //-- Survey ID - prestrip ] [ and | to match PollDaddy
});
