/** 
 * @fileOverview Site configuration and localisation.
 * @author Oliver Bishop / Tom McCourt
 * @version 1.0.0
 * @changeLog Created.
 */

/** 
 * Main configuration values 
 */
UKISA.env = {
	/**
	 * What region is this site based: EUK, EIE, EZA.
	 */
	REGION: "EIE",

	/**
	 * What is the site shortcode: CUP, DLX, HAM.
	 */
	CODE: "DWS",

	/**
	 * What is the name of the site: Cuprinol, Dulux, Polycell.
	 */
	SITE: "Weathershield",
	
	/**
	 * What is the Sitestat site code? This is used for Ajax calls to Sitestat.
	 */
	SITESTAT: "ws-ie",

	/**
	 * Globally available onDOMReady function.
	 */
	onDOMReady: function() { // Run when the DOM has loaded

		if (typeof UKISA.site.Order !== "undefined") {
			UKISA.site.Order.Basket.init();
		}

		// Add the clear default to the mini search.
		UKISA.util.clearDefault("mini-search-field");

		// Cufon font replacement goes here and makes use of YUI Selector to gather the elements to style.
		if (Cufon && $) {
			var replace_1 = [
				"h1, h4, .product-detail-bullet dt, .product-detail-bullet-key dt, .storeName, #footer-nav .footer-more-detail a, .product-detail-bullet-information dt"
			];
			
			var replace_2 = [
				"h2, h3, .product-detail-title, .home-top-visual h1"
			];

			Cufon.replace($(replace_1.join(", ")), { fontFamily: 'HelveticaNeue LT 97 BlackCn' });
			Cufon.replace($(replace_2.join(", ")), { fontFamily: 'HelveticaNeue LT 47 LightCn' });
		}

		// Add the clear default to the mini search.
		UKISA.util.PNGFix("#logo img, #nav a");

		// Quick PNG fix.
		if (document.body.id === "products-landing-page") {
			UKISA.util.PNGFix("p.product-detail-packshot img, #products-landing-page #layout-section-2 #competition .competition-detail");
		}
		
		// Quick PNG fix.
		if (document.body.id === "home-page") {
			UKISA.util.PNGFix("img.trim, img.wall");
		}

	},
	
	/**
	 * Globally available onLoad function.
	 */
	onLoad: function() { // Run when the content has loaded
		var i, el, w;
		
		// Do the weather widget.
		w = new UKISA.site.WeatherWidget();

		// Find all the print buttons.
		el = $("a.print", "content");
		i = el.length;
		for (; i--;) { el[i].onclick = function() { UKISA.util.print(); return false; }; }

		// This adds a modal box for links e.g. terms & conditions.
		el = $("a.terms", "content");
		i = el.length;
		for (; i--;) { el[i].onclick = function() { UKISA.site.Navigation.terms(this); return false; }; }
	}
};

/**
 * Create the localisation namespace. Widgets may use settings specified here.
 */
UKISA.locale[UKISA.env.SITE] = {
	// L10n values here (strings, functions, etc.)
	widget: {
		FormValidation: {
			display: {
				xOffset: 132,
				yOffset: 0
			}
		},
		Flash: {
			supports: "8.0.0", // Default supported version.	
			width: 512,	// Default width.
			height: 288, // Default width.
			flashDir: "/web/flash/",
			movieDir: "/web/movies/",
			params: { // Default params.
				"quality": "high",
				"scale": "noscale",
				"pluginspage": "http://www.macromedia.com/go/getflashplayer",
				"wmode": "transparent"
			},
			vars: { // Default variables.
				"MM_ComponentVersion": "1",
				"skinName": "/web/flash/Clear_Skin_1",
				"autoPlay": "true",
				"autoRewind": true
			},
			skins: {
				"Halo_Skin_3": {
					top: 11,
					right: 11,
					bottom: 40,
					left: 11
				}
			},
			attributes: {},
			callback: null
		},
		Colour: {
			ToolBox: {
				
			}
		}
	},
	site: {
		Order: {
			Basket: {
				automaticAddToBasket: true
			}
		},
		Favourites: {
			automaticAddToFavourites: true
		}
	}
};
