var sale_countries = [ 'at', 'de', 'us', 'nl', 'uk', 'ie' ];
var loc = wlfapi_call('userlocale', 'userlocale');

if ( $.inArray(loc['country'], sale_countries) >= 0 ) {
	var url_sale = 'http://www.wolford.com/shop';
	var url_badge = 'http://www.wolford.com/newsletter/2012-12_Sale1/badge_{COUNTRY}_noseason.png';
	var title = 'Sale';
	
	switch (loc['country']) {
		case 'de':
			url_sale = 'http://www.wolfordshop.de/produkte/boutique/sale/g500004721?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'de');
			title = 'Sale - Bis zu -50%';
			break;
		case 'at':
			url_sale = 'http://www.wolfordshop.at/Produkte/boutique/sale/g500004721?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'de');
			title = 'Sale - Bis zu -50%';
			break;
		case 'us':
			url_sale = 'http://www.wolfordshop.com/Sale/cp56531/cl1/?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'en');
			title = 'Up to 50% on all styles of the Autumn/Winter 2011/12 Collection';
			break;
		case 'nl':
			url_sale = 'http://www.wolfordshop.nl/producten/boutique/sale/g500004721?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'en');
			title = 'Sale - Tot 50%';
			break;
		case 'uk':
			url_sale = 'http://www.wolfordshop.co.uk/products/boutique/sale/g500004721?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'en');
			title = 'Up to 50% on all styles of the Autumn/Winter 2011/12 Collection';
			break;
		case 'ie':
			url_sale = 'http://www.wolfordshop.ie/products/boutique/sale/g500004721?cid=cmbdg';
			url_badge = url_badge.replace('{COUNTRY}', 'en');
			title = 'Up to 50% on all styles of the Autumn/Winter 2011/12 Collection';
			break;
	}

	var badge_img = $('<img alt="" />', { 'src': url_badge });
	badge_img.attr('src', url_badge);
	badge_img.css( {
		'position': 'relative',
		'width': '100%',
		'display': 'inline-block',
		'margin': '0',
		'padding': '0',
		'border': '0'
	} );
	
	var badge_link = $('<a>', { 'href': url_sale });
	badge_link.attr('href', url_sale);
	badge_link.attr('title', title);
	badge_link.css( {
		'position': 'relative',
		'width': '100%',
		'display': 'inline-block',
		'margin': '0',
		'padding': '0',
		'border': '0'
	} );
	badge_link.append(badge_img);
	
	var badge_div = $('<div>');
	badge_div.css( {
		'position': 'absolute',
		'left': '-3.9144144144%',
		'top': '1.3706563%',
		'width': '180px',
		'height': '180px',
		'display': 'inline-block',
		'z-index': '1000'
	} );
	badge_div.append(badge_link);
	
	$('#landing_right').css('padding-top', '140px');
	$('#centercontainer').append(badge_div);
}

