// -----------------------------------------------------------------------------------------------
/* (c) 2010 Swelen Medusa Tracker v0.8.3 */
// -----------------------------------------------------------------------------------------------
(function(){var b,g=window,f=document,a=!!f.getElementsByClassName,h=[];function d(c){c.each=function(j){for(i=0;i<c.length;i++){j.apply(c[i],[])}return c};c.show=function(){return c.each(function(){this.style.display="block"})};c.hide=function(){return c.each(function(){this.style.display="none"})};c.click=function(j){return c.each(function(){b.attach(this,"click",j)})};c.toggle=function(k,j){fn=function(){if(!b.togs[c]){b.togs[c]=true;k.apply(this,[])}else{if(b.togs[c]===true){b.togs[c]=false;j.apply(this,[])}}};return c.each(function(){b.attach(this,"click",fn)})};c.hover=function(k,j){return c.each(function(){b.attach(this,"mouseover",k);if(j){b.attach(this,"mouseout",j)}})};c.on=function(j,k){return c.each(function(){b.attach(this,j,k)})};return c}g.$w=$w=function(j,k,c){var l=typeof j;if(l==="function"){return b.attach(window,"load",j)}else{if(l==="string"){return d(b(j,k,c))}else{if(l==="object"){return d(j)}}}};b=g._=function(k,p,m){if(h[k]&&!m&&!p){return h[k]}p=p||f;var r=function(s){return p.getElementsByTagName(s)};var n=[],q=0;switch(k.charAt(0)){case"#":q=k.slice(1);n=f.getElementById(q);if(f.all&&n.id!==q){n=f.all[q]}n=n?[n]:[];break;case".":var o=k.slice(1);if(a){n=(q=(n=p.getElementsByClassName(o)).length)?n:[]}else{o=" "+o+" ";var c=r("*"),l=0,j;while(j=c[l++]){if((" "+j.className+" ").indexOf(o)!=-1){n[q++]=j}}n=q?n:[]}break;default:n=(q=(n=r(k)).length)?n:[];break}return(m||!!p)?n:h[k]=n};b.togs=[];b.attach=function(m,j,l){var c,k=function(n){b.bind(n,this,l)};if(m.addEventListener){m.addEventListener(j,k,false)}else{if(m.attachEvent){m._cb=function(n){b.bind(n,event.srcElement,l)};m.attachEvent("on"+j,m._cb)}else{if(typeof m["on"+j]=="function"){c=m["on"+j];m["on"+j]=function(){b.bind(e,m,l);c()}}else{m["on"+j]=k}}}return m};b.bind=function(n,m,k){var n=n?n:window.event,c=n.charCode||false,l=n.keyCode||false,j=n.which||false;k.apply(m,[{e:n,key:c?c:(l?l:(j?j:0))}])}})();
// -----------------------------------------------------------------------------------------------
(function(){var _$welen = this._$welen = window._$welen||{};})();
// -----------------------------------------------------------------------------------------------
(function(){

var win = window,
	doc = document;
// -----------------------------------------------------------------------------------------------
_$welen.bench = {
	start : function(){
		var d = new Date();
		win.__starTimer = d.getTime(); 
	},
	finish : function(){
		var d = new Date();		
		return (d.getTime()) - win.__starTimer;
	}
}
// -----------------------------------------------------------------------------------------------
_$welen.domReady = {
	add: function(fn) {
		var ie = !!(window.attachEvent && !window.opera),
			webkit = navigator.userAgent.indexOf('AppleWebKit/') > -1,
			observers = _$welen.domReady.observers;
			
		if (_$welen.domReady.loaded) { return fn(); }
		if (!observers) { observers = _$welen.domReady.observers = []; }
		observers[observers.length] = fn;
		if (_$welen.domReady.callback) { return; }
	
		_$welen.domReady.callback = function() {
			if (_$welen.domReady.loaded) { return; }
			_$welen.domReady.loaded = true;
			if (_$welen.domReady.timer) {
				clearInterval(_$welen.domReady.timer);
				_$welen.domReady.timer = null;
			}
		
			var observers = _$welen.domReady.observers;
			for (var i = 0, length = observers.length; i < length; i++) {
				var fn = observers[i];
				observers[i] = null;
				fn();
			}
			_$welen.domReady.callback = _$welen.domReady.observers = null;
		};
		
		if (document.readyState && webkit) {
			_$welen.domReady.timer = setInterval(function() {
				var state = document.readyState;
				if (state == 'loaded' || state == 'complete') {
					_$welen.domReady.callback();
				}
			}, 10);
		} else if (document.readyState && ie) {
			
			_$welen.domReady.timer = setInterval(function() {
				try {
					document.documentElement.doScroll('left');
					_$welen.domReady.callback();
				} catch (e) { }
			}, 10);
			
			//var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)';
			//document.write('<script type="text/javascript" defer="defer" src="' + src + '" onreadystatechange="if (this.readyState == \'complete\') {_$welen.domReady.callback();}"><\/script>');


		} else {
			if (window.addEventListener) {
				document.addEventListener("DOMContentLoaded", _$welen.domReady.callback, false);
				window.addEventListener("load", _$welen.domReady.callback, false);
			} else if (window.attachEvent) {
				window.attachEvent('onload', _$welen.domReady.callback);
			} else {
				var fn = window.onload;
				window.onload = function() {
					_$welen.domReady.callback();
					if (fn) { fn(); }
				};
			}
		
		}
	
	}
}
// -----------------------------------------------------------------------------------------------
_$welen.bench.start();
// -----------------------------------------------------------------------------------------------
_$welen.plugins = {
	suggest : { delayed:false, launched:false},
	screen : {loaded:false}
};
// -----------------------------------------------------------------------------------------------
_$welen.cookie = {
	value : '',
	
	set : function(name, value, expires, path, domain, secure) {
		var today = new Date(),
			e = (expires)?expires*1000*60*60*24:'';
		today.setTime( today.getTime() );
		var expires_date = new Date( today.getTime() + (e) );
		doc.cookie = name + "=" + escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" );
	},
	
	get : function(check_name) {
		var a_all_cookies = doc.cookie.split( ';' ),
			a_temp_cookie = '',
			cookie_name = '',
			cookie_value = '',
			b_cookie_found = false;
	
		for ( i = 0; i < a_all_cookies.length; i++ ) {
			a_temp_cookie = a_all_cookies[i].split( '=' );
			cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
			if ( cookie_name == check_name ) {
				b_cookie_found = true;
				if ( a_temp_cookie.length > 1 ) {
					cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
				}
				return cookie_value;
			}
			a_temp_cookie = null;
			cookie_name = '';
		}
		if ( !b_cookie_found ) {
			return null;
		}
	}

};
// -----------------------------------------------------------------------------------------------
_$welen.panic = {
	callback : function(ServerResponse) {
		this.json = _$welen.json.decode(ServerResponse);
		if (this.json.http) { }
	}
};
// -----------------------------------------------------------------------------------------------
_$welen.json = {
	decode : function (text) {
		return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
	}	
};
// -----------------------------------------------------------------------------------------------
_$welen.api = {
	url : '',
	lastInserted : false,
	
	build : function(u, params) {
		var q = '';
		for(var i in params){
			q += '&'+i+'='+params[i];
		}	
		this.url = u + q;
	},
	request : function(keep) {
		if (this.lastInserted !==false && keep!==true) { $w('head')[0].removeChild(this.lastInserted); }
		this.lastInserted = this.get(this.url);
	},
	get : function(url) {
		var s = doc.createElement('script'),
			h = $w('head')[0];
		s.setAttribute('charset','UTF-8');
		s.setAttribute('type','text/javascript');
		s.setAttribute('src', url);
		h.appendChild(s);
		return s;
	}
	
};
// -----------------------------------------------------------------------------------------------
_$welen.medusa = {
	api : 'http://thx.swelen.com:1234/plurimetrics?client=medusa',
	upd : 'http://thx.swelen.com:1234/meta?client=medusa',
	host : win.location.hostname,
	json : {},
	test : false,
	
	init : function(opt) {
		var sc = _$welen.cookie,
			docurl = doc.location,
			def_thumb = '';

		if (typeof opt!='object') {
			opt = {};
			opt.page = {};
		}

		this.test		 	= opt.test || false;
		this.suggest	 	= (opt.suggest===false)?false:true; // suggest
		this.recommend		= (opt.page.recommend===false)?false:true; // recommendable page
		this.page_thumb 	= opt.page.thumb || def_thumb; // page thumbs
		this.page_title		= opt.page.title || doc.title; // title
		this.page_item		= opt.page.item || ''; // item
		this.page_segment	= opt.page.segment || ''; // segment
		this.page_url		= opt.page.url || ((win.top.location == docurl)?docurl:win.top.location); // url
		this.page_inv_url 	= opt.page.url || docurl;
		this.hostname		= opt.page.hostname || this.host; // hostname

		this.item_geo		= opt.page.geo || ''; // item location
		this.item_price		= opt.page.price || ''; // item price
		this.item_currency	= opt.page.currency || ''; // item price currency

		if (sc.get('_medusa')) {
			sc.value = sc.get('_medusa');
		} else {
			sc.value = '';
			sc.set('_medusa_first_visit', 'yes', 365, '/', this.host, '');
		}
	
		if (win.swelen_medusa) {
			this.multiple = true; win.swelen_medusa+=1;
		} else {
			this.multiple = false; win.swelen_medusa=1;
		}
		return this;
	},
	
	get : function(stck) {
		if (this.multiple===true) {return false;}
		var az = stck.split('-'),
			dat = new Date(),
			scr = win.screen,
			nav = navigator;

		var j = {
			"clt"	: parseInt(az[1], 10),
			"sit"	: parseInt(az[2], 10),
			"cook"	: _$welen.cookie.value,

			"vSW"	: scr.width, // Screen Width
			"vSH"	: scr.height, // Screen Height
			"vSAW"	: scr.availWidth, // Available width
			"vSAH"	: scr.availHeight, // Available height
			"vSCD"	: scr.colorDepth, // Color Depth
			"vTZ"	: -dat.getTimezoneOffset(), // Time Zone
			"vHL"	: history.length, // History length 
			"vJE"	: (nav.javaEnabled())?nav.javaEnabled():'', // Java Enabled
			"vNPL"	: (nav.plugins)?nav.plugins.length:'', // Plugins Length
			"vNML"	: (nav.mimeTypes)?nav.mimeTypes.length:'', // MimeTypes Length
			"vCOO"	: (nav.cookieEnabled)?1:0, // Cookie enabled

			"test"			: this.test?1:0,
			"pg_suggest"	: this.recommend?1:0,
			"pg_dom"		: swelEncoder(this.hostname),
			"pg_top"		: swelEncoder(this.page_url),
			"pg_inv"		: swelEncoder(this.page_inv_url),
			"pg_ref"		: swelEncoder(doc.referrer),
			"pg_lastmod"	: Date.parse(doc.lastModified)/1000,
			"pg_thumb"		: swelEncoder(this.page_thumb),
			"pg_title"		: swelEncoder(this.page_title),
			"pg_segment"	: swelEncoder(this.page_segment),
			"pg_item"		: swelEncoder(this.page_item),

			"item_geo"		: swelEncoder(this.item_geo),
			"item_price"	: swelEncoder(this.item_price),
			"item_currency"	: swelEncoder(this.item_currency),

			"plug_suggest"	: this.suggest?1:0,
			"plug_search"	: this.search?1:0,
		
			"shake" : swelShaker()
		};
		_$welen.api.build(this.api, j);
		_$welen.api.request();
		_$welen.suggest.build();
	},

	update : function() {
		var t = _$welen.medusa.json,
			def_thumb = '';

		$w('img').each(function(){
			var img = this;
			if (img.getAttribute('tag') && img.getAttribute('tag')=='picture') {
				def_thumb = img.getAttribute('src');
			}
		});

		if (def_thumb=='') { return false; }

		var j = {
			"id_user"		: t.id_user,
			"id_site"		: t.id_site,
			"id_page"		: t.id_page,
			"freshness"		: 604800,
			"item_url"		: swelEncoder(this.page_url),
			"item_thumb"	: swelEncoder(def_thumb),
			"item_name"		: swelEncoder(this.page_title),
			"item_geo"		: swelEncoder(this.item_geo),
			"item_price"	: swelEncoder(this.item_price),
			"item_currency"	: swelEncoder(this.item_currency),
			"callback"		: "_$welen.medusa.callback",
			"shake" : swelShaker()
		};
		_$welen.api.build(this.upd, j);
		_$welen.api.request(true);
	},
	
	callback : function(){
	}

};
// -----------------------------------------------------------------------------------------------

win.SwelenMedusa_callBack = function(serverResponse) {
	_$welen.medusa.json = _$welen.json.decode(serverResponse);
	var t = _$welen.medusa.json;
	if (t.cook!=_$welen.cookie.value) {
		_$welen.cookie.set('_medusa', escape(t.cook), 365, '/', _$welen.medusa.host, '');
	}
	if (t.nb_visits>1) {
		_$welen.cookie.set('_medusa_first_visit', 'no', 365, '/', _$welen.medusa.host, '');
	}

	if (t.plug_suggest==1) {
		if (_$welen.suggest) {
			_$welen.domReady.add(function(){
				_$welen.suggest.launch();
			});
		}
	}
	
};
// -----------------------------------------------------------------------------------------------
win.swelShaker = function(){return (new Date()).getTime();};
win.swelEncoder = win.encodeURIComponent || escape;
// -----------------------------------------------------------------------------------------------
win.echo = function(html) {
	var s = doc.createElement('div');
	s.innerHTML = html;
	$w('body')[0].appendChild(s);
};
// -----------------------------------------------------------------------------------------------
})();

// -----------------------------------------------------------------------------------------------
/* (c) 2010 Swelen Suggest Plugin Beta 0.8.3 */
// -----------------------------------------------------------------------------------------------
(function(){
var _$welen = this._$welen = window._$welen||{},
	v = '0.8.3',
	win = window,
	doc = document,
	shea = 'http://shea.swelen.com/',
	styleNode,
	xcorn,
	isie = /msie/i.test(navigator.userAgent) && !window.opera,
	isie6 = isie && !window.XMLHttpRequest,
	mob_iphone = /iphone/i.test(navigator.userAgent),
	mob_ipod = /ipod/i.test(navigator.userAgent),
	mob_android = /android/i.test(navigator.userAgent),
	smartphone = (mob_iphone || mob_ipod || mob_android);
// -----------------------------------------------------------------------------------------------
_$welen.suggest = {};
// -----------------------------------------------------------------------------------------------
_$welen.crn = {
	create: function (opts) {
		function sty(el, h) {
			for (var k in h) {
				if (/ie_/.test(k)) {
					if (isie) { el.style[k.substr(3)] = h[k]; }
				} else {
					el.style[k] = h[k];
				}
			}
		}
		function crdiv(h) {
			var el = doc.createElement("div");
			el.className = "swelen-gen";
			sty(el, h);
			return el;
		}
		function op(v) {
			v = v < 0 ? 0 : v;
			if (v > 0.99999) { return ""; }
			return isie ? " filter:alpha(opacity=" + (v * 100) + ");" : " opacity:" + v + ';';
		}

		var r = opts.corner || 0,
			bor = 0,
			bow = opts.border || 0,
			boo = opts.borderOpacity || 1,
			lw = r,
			rw = lw,
			th = lw,
			bh = lw;
			
		if (bow > 0) {
			bor = r;
			r = r - bow;
		}
		var cx = 0,
			cy = 0,
			cs = 0,
			iclass = r > 0 ? "swelen-inner":"",
			bclass = "swelen-border";
		
		var p = {position: "absolute", left: "0", top: "0", width: lw + "px", height: th + "px", ie_fontSize: "1px", overflow: "hidden", margin: "0", padding: "0"};
		var tl = crdiv(p);
		delete p.left;
		p.right = "0";
		p.width = rw + "px";
		var tr = crdiv(p);
		delete p.top;
		p.bottom = "0";
		p.height = bh + "px";
		var br = crdiv(p);
		delete p.right;
		p.left = "0";
		p.width = lw + "px";

		var bl = crdiv(p);
		var tw = crdiv({position: "absolute", width: "100%", height: th + "px", ie_fontSize: "1px", top: "0", left: "0", overflow: "hidden", margin: "0", padding: "0"});
		var t = crdiv({position: "relative", height: th + "px", ie_fontSize: "1px", margin: "0 " + rw + "px 0 " + lw + "px", overflow: "hidden", padding: "0"});
		tw.appendChild(t);

		var bw = crdiv({position: "absolute", left: "0", bottom: "0", width: "100%", height: bh + "px", ie_fontSize: "1px", overflow: "hidden", margin: "0", padding: "0"});
		var b = crdiv({position: "relative", height: bh + "px", ie_fontSize: "1px", margin: "0 " + rw + "px 0 " + lw + "px", overflow: "hidden", padding: "0"});
		bw.appendChild(b);

		var mw = crdiv({position: "absolute", top: (-bh) + "px", left: "0", width: "100%", height: "100%", overflow: "hidden", ie_fontSize: "1px", padding: "0", margin: "0"});

		function corner(el, t, l) {
			var w = l ? lw : rw,
				h = t ? th : bh,
				s = t ? cs : -cs,
				dsb = [],
				dsi = [],
				dss = [],
				xp = 0,
				xd = 1;

			if (l) {
				xp = w - 1;
				xd = -1;
			}

			var finish = function(dd, y) {
				if (!t) { dd = dd.replace(/top\:\d+px/, "top:0px"); }
				dd = dd.replace(/height\:1px/, "height:" + (y + 1) + "px");
				dsi.push(dd + '" class="' + iclass + '"></div>');
			};

			for (var x = 0; x < w; ++x) {
				var yp = h-1,
					yd = -1;
					
				if (t) {
					yp = 0;
					yd = 1;
				}
				var finished = false;
				for (var y = h - 1; y >= 0 && !finished; --y) {
					var div = '<div style="position:absolute; top:' + yp + 'px; left:' + xp + 'px; ' + 'width:1px; height:1px; overflow:hidden; margin:0; padding:0;',
						xc = x - cx,
						yc = y - cy - s,
						d = Math.sqrt(xc * xc + yc * yc),
						dd;
					if (r > 0) { // draw border
						if (xc < 0 && yc < bor && yc >= r || yc < 0 && xc < bor && xc >= r) {
							dsb.push(div + op(boo) + '" class="' + bclass + '"></div>');
						} else if (d < bor && d >= r - 1 && xc >= 0 && yc >= 0) {
							dd = div;
							if (d >= bor - 1) {
								dd += op((bor - d) * boo);
							} else { dd += op(boo); }
							dsb.push(dd + '" class="' + bclass + '"></div>');
						}
						dd = div + ' z-index:2;' + (t ? 'background-position:0 -' + (r - yc - 1) + 'px;' : 'background-image:none;');
						if (xc < 0 && yc < r || yc < 0 && xc < r) {
							finish(dd, y);
							finished = true;
						} else if (d < r && xc >= 0 && yc >= 0) {
							if (d >= r - 1) {
								dd += op(r - d);
								dsi.push(dd + '" class="' + iclass + '"></div>');
							} else {
								finish(dd, y);
								finished = true;
							}
						}
					}
					yp += yd;
				}
				xp += xd;
			}
			el.innerHTML = dss.concat(dsb.concat(dsi)).join('');
		}
		function mid(mw) {
			var ds = [];
			ds.push('<div style="position:relative; top:' + (th + bh) + 'px; height:2048px; ' + ' margin:0 ' + (rw - r - cx) + 'px 0 ' + (lw - r - cx) + 'px; ' + ' padding:0; overflow:hidden;' + ' background-position:0 ' + (th > 0 ? -(r + cy + cs) : '0') + 'px;"' + ' class="' + iclass + '"></div>');
			var dd = '<div style="position:absolute; width:1px;' + ' top:' + (th + bh) + 'px; height:2048px; padding:0; margin:0;';
			if (bow > 0) {
				var su = ' width:' + bow + 'px;' + op(boo) + '" class="' + bclass + '"></div>';
				ds.push(dd + ' left:' + (lw - bor - cx) + 'px;' + su);
				ds.push(dd + ' right:' + (rw - bor - cx) + 'px;' + su);
			}
			mw.innerHTML = ds.join('');
		}
		function tb(el, t) {
			var ds = [];
			var h = t ? th : bh;
			var dd = '<div style="height:1px; overflow:hidden; position:absolute; margin:0; padding:0;' + ' width:100%; left:0px; ';
			var s = t ? cs : -cs;
			var y = h - s - cy - r;
			if (y >= bow) {
				ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' + op(boo) + ' height:' + bow + 'px;" class="' + bclass + '"></div>');
			}
			ds.push(dd + (t ? 'background-position-y:0; top:' : 'background-image:none; bottom:') + y + 'px;' + ' height:' + (r + cy + s) + 'px;" class="' + iclass + '"></div>');
			el.innerHTML = ds.join('');
		}
		corner(tl, true, true);
		corner(tr, true, false);
		corner(bl, false, true);
		corner(br, false, false);
		mid(mw);
		tb(t, true);
		tb(b, false);
		needsCloning = false;
		return {
			render: function (el) {
				sty(el, { position: "relative",	background: "transparent"});
				
				function resize() {
					twc.style.width = bwc.style.width = mwc.style.width = el.offsetWidth + "px";
					if (isie6) {
						mwc.firstChild.style.height = el.offsetHeight + "px";
					} else {
						for (var i = 0; i < mwc.childNodes.length; ++i) {
							mwc.childNodes[i].style.height = (el.offsetHeight - bh - th) + "px";
						}
					}
					trc.style.right = brc.style.right = null;
					trc.style.left = brc.style.left = (el.offsetWidth - rw) + "px";
				}

				var node = el.firstChild;
				while (node) {
					var nextNode = node.nextSibling;
					if (node.nodeType == 1 && node.className == 'swelen-gen') { el.removeChild(node); }
					node = nextNode;
				}

				var iel = el.firstChild,
					twc = needsCloning ? tw.cloneNode(true) : tw,
					mwc = needsCloning ? mw.cloneNode(true) : mw,
					bwc = needsCloning ? bw.cloneNode(true) : bw,
					tlc = needsCloning ? tl.cloneNode(true) : tl,
					trc = needsCloning ? tr.cloneNode(true) : tr,
					blc = needsCloning ? bl.cloneNode(true) : bl,
					brc = needsCloning ? br.cloneNode(true) : br;
					
				el.insertBefore(tlc, iel);
				el.insertBefore(trc, iel);
				el.insertBefore(blc, iel);
				el.insertBefore(brc, iel);
				el.insertBefore(twc, iel);
				el.insertBefore(mwc, iel);
				el.insertBefore(bwc, iel);
				if (isie6) {
					el.onmouseover = function () {this.className += " hover"; };
					el.onmouseout = function () {this.className = this.className.replace(/ hover/, ""); };
				}
				if (isie) {
					el.onresize = resize;
					resize();
				}
				needsCloning = true;
			}
		};
	}
};
// -----------------------------------------------------------------------------------------------
_$welen.suggest.core = {
	api : 'http://thx.swelen.com:1234/elixir?client=medusa',
	cb : "_$welen.suggest.core.feed",
	json : {},
	jsona : [],
	page : [],
	pagelast : [],
	maxpages : [],
	mxp : 8,
	nb_ads : [],
	channel_uid : [],
	rounded : true,
	cache : [],
	slotstate : [],
	slothtml : [],
	slotmax : 4,

	append : function(slot) {
		var c = this.slothtml[slot+'-'+this.page[slot]] || false;
		if (c) {
			$w('#swelen_sheet_'+slot)[0].innerHTML = c;
			$w('#swelen_pagen_'+slot)[0].innerHTML = this.page[slot];
		} else {
			this.get(slot, this.page[slot], this.nb_ads[slot], this.cb);
		}
	},

	next : function(slot) {
		this.pagelast[slot] = this.page[slot]; 
		this.page[slot]+=1;
		if (this.page[slot]>this.maxpages[slot]) {
			this.page[slot]=1;
		}
		this.append(slot);
	},

	previous : function(slot) {
		this.pagelast[slot] = this.page[slot]; 
		if (this.page[slot]>1) {
			this.page[slot]-=1;
			this.append(slot);
		}
	},

	suggestType : function() {
		var suggest_type,
			t=_$welen.medusa.json.id_visitor;
		if ((t%3)==2) {suggest_type = 0; /* users exposed to Static Suggest */ }
		if ((t%3)==1) {suggest_type = 1; /* users exposed to Dynamic Suggest */ }
		if ((t%3)===0) {suggest_type = 2; /* users exposed to Adaptive Suggest */ }
		return suggest_type;
	},

	getx : function(slot, page, cb) {
		var suggest_type = this.suggestType(),
			t = _$welen.medusa.json,
			def_nbads = (smartphone)?1:-1;

		var j = {
			"slot"			: slot,
			"p"				: page,
			"l"				: def_nbads,
			"nb_annonces"	: 0,
			"channel_uid"	: this.channel_uid[slot],
			"id_page"		: t.id_page,
			"id_user"		: t.id_user,
			"id_site"		: t.id_site,
			"id_visite"		: t.id_visite,
			"id_visitor"	: t.id_visitor,
			"language_code"	: t.language_code,
			"country_code"	: t.country_code,
			"ref_type"		: t.ref_type,
			"test"			: t.test,
			"suggest_type"	: suggest_type,
			"default"		: "none",
			"callback"		: cb,
			"shake"			: win.swelShaker()
		};
		_$welen.api.build(this.api, j);
		_$welen.api.request(true);
	},

	get : function(slot, page, nb_ads, cb) {
		var suggest_type = this.suggestType(),
			t = _$welen.medusa.json;

		var j = {
			"slot"			: slot,
			"p"				: page+(slot-1),
			"l"				: nb_ads,
			"nb_annonces"	: 0,
			"channel_uid"	: this.channel_uid[slot] || '',
			"id_page"		: t.id_page,
			"id_user"		: t.id_user,
			"id_site"		: t.id_site,
			"id_visite"		: t.id_visite,
			"id_visitor"	: t.id_visitor,
			"language_code"	: t.language_code,
			"country_code"	: t.country_code,
			"ref_type"		: t.ref_type,
			"test"			: t.test,
			"suggest_type"	: suggest_type,
			"default"		: "none",
			"callback"		: cb,
			"shake"			: win.swelShaker()
		};
		if ( this.cache[slot + '-' + page] ) {
			this.jsona[slot] = this.cache[slot + '-' + page];
			this.refresh(slot);
		} else {
			if (this.slotstate[slot]) { this.loadingSlot(slot, true); }
			_$welen.api.build(this.api, j);
			_$welen.api.request( (isie)?true:false );
		}
	},

	link : function(slot, f) {
		var t = _$welen.medusa.json,
			pos = (this.page[slot]-1)*(this.nb_ads[slot])+f+1;
			
		var j = {
			"key" : t.test + '-' + pos + '-' + this.suggestType() + '-' + t.id_visitor + '-' + t.id_page + '-' + this.jsona[slot].results[f].id_page + '-' + win.swelShaker()
		};
		_$welen.api.build( 'http://thx.swelen.com:1234/link?client=medusa', j);
		return _$welen.api.url;
	},

	clk : function(slot, f) {
		var t = _$welen.medusa.json,
			pos = (this.page[slot]-1)*(this.nb_ads[slot])+f+1;
			
		var j = {
			"key" : t.test + '-' + pos + '-' + this.jsona[slot].results[f].id_display + '-' + win.swelShaker()
		};
		_$welen.api.build( 'http://thx.swelen.com:1234/clk?client=medusa', j);
		return _$welen.api.url;
	},

	getFontFamily : function(slot) {
		var fontFamily = '',
			ff = this.jsona[slot].channel.font_family;
		
		if (ff=='Courier New') { fontFamily = 'Courier New, Courier, monospace'; }
		else if (ff=='Georgia') { fontFamily = 'Georgia, Times New Roman, Times, serif'; }
		else if (ff=='Times New Roman') { fontFamily = 'Times New Roman, Times, serif'; }
		else if (ff=='Verdana') { fontFamily = 'Verdana, Geneva, sans-serif'; }
		else { fontFamily = 'Arial, Helvetica, sans-serif'; }
		
		return fontFamily;
	},

	init : function() {
		var slot = 0,
			page = 0,
			that = this;

		$w(".swelen_suggest").each(function(){
			slot++;
			page++;
			if (slot<=that.slotmax) {
				this.id = '_SwelenSlot'+slot;
				this.setAttribute('id', this.id);
				that.page[slot] = 1;
				that.pagelast[slot] = 1;
				that.maxpages[slot] = this.mxp;
				that.channel_uid[slot] = (this.getAttribute('channel'))?this.getAttribute('channel'):'';
				that.getx(slot, page, "_$welen.suggest.core.build");
			}
		});

		$w(".swelen_feedback").each(function(){
			this.innerHTML = _$welen.suggest.html.feedbackSheet();
		});

		_$welen.medusa.update();

	},

	buildSlot : function(slot) {
		var that = this,
			x = $w('#_SwelenSlot'+slot)[0],
			s = x.style,
			c = this.jsona[slot].channel;

		//_$welen.css.add('.swelen-inner', 'background-color:#'+c.color_bg);
		//_$welen.css.add('.swelen-border', 'background-color:#'+c.color_border);
		_$welen.css.add('.swelen_suggest .swelen-border', 'background-color:#'+c.color_border);
		_$welen.css.add('.swelen_suggest .swelen-inner', 'background-color:#'+c.color_bg);

		this.slotstate[slot] = true;

		s.color = '#' + c.color_text;
		s.backgroundColor = '#' + c.color_bg;
		s.fontFamily = that.getFontFamily(slot);
		s.fontSize = c.font_size;
		s.padding = c.padding;
		s.width = (c.width)?c.width:s.width;
		s.height = (c.height)?c.height:s.height;

		if (x.offsetWidth <= 230 ) {
			s.fontSize = '10px';
			c.font_size = '10px';
			c.showhost = false;
			c.mini = true;
		} else {
			c.showhost = true;
			c.mini = false;
		}

		if (smartphone) {
			c.showhost = true;
			s.fontSize = '9px';
			s.lineHeight = '10px';
			c.font_size = '9px';
			c.mini = true;
		}

		x.innerHTML = _$welen.suggest.html.suggestSlot(slot);

		if (this.rounded) {
			x.className += " swelen-rnd";
			xcorn.render(x);
		}
		
		s.display = 'block';

	},

	feedSlot : function(slot) {
		var z = $w('#swelen_sheet_'+slot)[0],
			x = $w('#_SwelenSlot'+slot)[0],
			p = $w('#swelen_pagen_'+slot)[0],
			s = x.style,
			c = this.jsona[slot].channel;

		
		if (x.offsetWidth <= 230 ) {
			s.fontSize = '10px';
			c.font_size = '10px';
			c.showhost = false;
			c.mini = true;
		} else {
			c.showhost = true;
			c.mini = false;
		}

		if (smartphone) {
			c.showhost = true;
			s.fontSize = '9px';
			s.lineHeight = '10px';
			c.font_size = '9px';
			c.mini = true;
		}

		z.innerHTML = _$welen.suggest.html.suggestLinks(slot);
		p.innerHTML = this.page[slot]; // show pagenum
		this.slothtml[slot+'-'+this.page[slot]] = z.innerHTML;
	},

	loadingSlot : function(slot, state) {
		if (isie6) { return false; }
		var id = 'swelen_sheet_'+slot;
		if (state) {
			_$welen.fx.fadeOut(id, 80);
		} else {
			_$welen.fx.fadeIn(id, 80);
			_$welen.fx._changeOpac(100, id);
		}
	},

	refresh : function(slot) {
		if (this.jsona[slot].nb_results>0) { 
			this.feedSlot(slot);
			this.maxpages[slot] = this.mxp;
		} else {
			this.page[slot] = this.pagelast[slot];
			this.maxpages[slot] = this.page[slot];
			this.pagelast[slot] = 1; 
			this.page[slot] = 1;
			this.get(slot, 1, this.nb_ads[slot], this.cb);
		}
	},

	build : function(ServerResponse) {
		var js = _$welen.json.decode(ServerResponse),
			slot = js.slot;
			
		this.jsona[slot] = js;

		if (win._swelenSuggestAPI && typeof win._swelenSuggestAPI.display=='function') {
			this.page[slot] = 1;
			this.pagelast[slot] = 1;
			this.maxpages[slot] = this.mxp;
			this.nb_ads[slot] = js.channel.nb_ads;
			for(f=0;f<js.nb_results;f++) {
				js.results[f].click_url = this.link(slot, f);
			}
			win._swelenSuggestAPI.display({
				intl : js.intl,
				slot : slot,
				nb_results : js.nb_results,
				thumbs : (js.channel.thumbs==1)?true:false,
				results : js.results
			});
			return true;
		}

		if (js.nb_results>0) { 
			this.nb_ads[slot] = js.channel.nb_ads;
			if (smartphone) {this.nb_ads[slot] = 1;}
			this.buildSlot(slot);
		}
	},

	feed : function(ServerResponse) {
		var js = _$welen.json.decode(ServerResponse),
			slot = js.slot;

		this.jsona[slot] = js;
		this.cache[slot + '-' + this.page[slot]] = js;
		this.loadingSlot(slot, false);
		this.refresh(slot);	
	}

};

// -----------------------------------------------------------------------------------------------
_$welen.suggest.html = {
	suggestLinks : function(slot) {
		var html = '',
			thumb = '',
			core = _$welen.suggest.core,
			json = core.jsona[slot],
			c = json.channel,
			ff = core.getFontFamily(slot),
			cut = (c.thumbs==1)?50:70;
			
		html += '<ul>';
		
		for(f=0;f<json.nb_results;f++) {
			var	liclass = (c.thumbs==1)?'swpicli':'',
				rs = json.results[f],
				title = rs.title;
			
			min_height = '';
			if (c.thumbs==1) {
				min_height = 'min-height:50px ; height:50px';
			}
			if (rs.type=='ads') {
				min_height = 'min-height:90px ; height:90px';
			}
			
			html += '<li class="'+liclass+'" style="border-top:1px dotted #'+c.color_border+' ; '+min_height+'">';

			if(rs.type == 'ads') {
				if (rs.thumb_url!=='') {
					thumb = '<img src="'+rs.thumb_url+'" width="70" border="0" />';
				} else {
					thumb = '<div class="swnopic"></div>';
				}
				html += '<div class="swpic_ads">';
				html += 	'<div class="swthumb_ads">';
				html += 		'<a href="'+core.clk(slot, f)+'">'+thumb+'</a>';
				html += 	'</div>';
				html += '</div>';
			} else if(c.thumbs == 1) {
				if (rs.thumb_url!=='') {
					thumb = '<img src="'+rs.thumb_url+'" width="50" border="0" />';
				} else {
					thumb = '<div class="swnopic"></div>';
				}
				html += '<div class="swpic">';
				html += 	'<div class="swthumb">';
				html += 		'<a href="'+core.link(slot, f)+'">'+thumb+'</a>';
				html += 	'</div>';
				html += '</div>';
			}

			if (c.mini) { cut = (c.thumbs==1)?30:50; }
			title = _$welen.text.ellipsoid(rs.title, cut);

			if (smartphone) {
				title = _$welen.text.ellipsoid(rs.title, 50);
			}
			
			if (rs.type == 'ads') {
				html += '<a href="'+core.clk(slot, f)+'" class="swlink" id="swlink'+ (f+1) +'">';
				html +=		'<div style="color:#'+c.color_title+' ; text-decoration:underline ; font-size:'+c.font_size+' ; font-family:'+ff+'"><b>'+title+'</b></div>';
				html += 	'<div style="color:#'+c.color_url+' ; text-decoration:none ; font-family:'+ff+' ; font-size:smaller">Sponsored Recommendation</div>';
				html += 	'<div style="color:#'+c.color_text+' ; text-decoration:none ; font-family:'+ff+' ; font-size:smaller">'+rs.item_price+' €</div>';
				html += '</a>';
				html += '</li>';
			} else {
				html += '<a href="'+core.link(slot, f)+'" class="swlink" id="swlink'+ (f+1) +'">';
				html +=		'<div style="color:#'+c.color_title+' ; text-decoration:none ; font-size:'+c.font_size+' ; font-family:'+ff+'"><b>'+title+'</b></div>';
				if (c.showhost) { html += '<div style="color:#'+c.color_url+' ; text-decoration:none ; font-family:'+ff+' ; font-size:smaller">'+rs.url_hostname+'</div>'; }
				html += '</a>';
				html += '</li>';
			}

		}
		html += '</ul>';	

		return html;
	},
	
	suggestSlot : function(slot) {
		var html = '',
			padding = isie?6:12,
			margin = 3,
			navFontSize = 11,
			logo = "swlogo_b",
			core = _$welen.suggest.core,
			json = core.jsona[slot],
			c = json.channel,
			lnk = '<a href="#" style="font-size:112% ; color:#',
			rgb = _$welen.colors.hex2rgb(c.color_bg) || false;

		if (rgb!==false) {
			if ( rgb[0]+rgb[1]+rgb[2] > 255*3/2 ) {
				logo = "swlogo_w";
			} else {
				logo = "swlogo_b";
			}
		}
		if (c.mini) {
			padding = isie?4:8;
		}
		if (smartphone) {
			padding = 6;
			margin = 1;
			navFontSize = 10;
		}
		html += '<swelen>';
		html += '<div style="padding:'+padding+'px">';
		html += 	'<div style="margin-bottom:'+margin+'px ; font-size:larger"><b>' + json.intl.tab1 + '</b></div>';
		html += 	'<div class="swbox" style="clear:both">';

		html += 		'<div class="swelen_sheet" id="swelen_sheet_'+slot+'">';
		html += 		this.suggestLinks(slot);
		html += 		'</div>';

		html +=			'<div style="clear:both;width:100%;height:1px;display:block;overflow:hidden;background-color:#'+c.color_border+'"></div>';

		html += 		'<a href="http://www.swelen.com/" class="'+logo+'"></a>';
 		html += 		'<div class="swbottom" style="color:#'+c.color_url+';text-align:left;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:'+navFontSize+'px">';
		html += 			lnk + c.color_text + '" onclick="_$welen.suggest.core.previous('+slot+');return false;"><b>&laquo;</b></a>';
		html += 			lnk + c.color_url + '" onclick="return false;" id="swelen_pagen_'+slot+'">'+core.page[slot]+'</a>';
		html += 			lnk + c.color_text + '" onclick="_$welen.suggest.core.next('+slot+');return false;"><b>&raquo;</b></a>';
		html += 		'</div>';

		html += 	'</div>';
		html += '</div>';
		html += '</swelen>';
		return html;
	},
	
	feedbackSheet : function(slot) {
		var html = '',
			core = _$welen.suggest.core;
			
		html += '<div style="padding:2px ; border:1px solid #808080;width:500px;background-color:#ffffff">';
		html += 	'<div class="swclear">';
		html += 	'<div id="cnt">125 chars</div>';
		html += 	'	<a class="swbutton" href="#" onclick="this.blur(); return false;"><span>Ok</span></a>';
		html += 	'</div>';
		html += '	<div style="margin-right:68px"><textarea name="swelfeedback" id="swelfeedback" style="border:none ; width:90%; height:60px ; max-height:60px;resize:none"/></textarea></div>';
		html += '</div>';

		return html;
	}

};
// -----------------------------------------------------------------------------------------------
_$welen.text = {
	ellipsoid : function(txt, toLength) {
		if (toLength < 1 || txt.length < toLength) { return txt; }
		return txt.substring(0, toLength).replace(/\w+$/, '') + ' \u2026';
	}
}
// -----------------------------------------------------------------------------------------------
_$welen.colors = {
	hex2rgb : function(hex) {
		var m = hex.match(/^([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])$/);
		if (m) {
			return [parseInt(m[1],16), parseInt(m[2],16), parseInt(m[3], 16)];
		} else {
			return false;
		}
	}
}
// -----------------------------------------------------------------------------------------------
_$welen.fx = {
	hide : function(id, ms) {
		this._slide(id, 98, 0, ms);
	},
	show : function(id, ms) {
		this._changeHeight(0, id);
		this._slide(id, 0, 98, ms);
	},

	fadeIn : function(id, ms) {
		this._opacity(id, 60, 100, ms);
	},
	
	fadeOut : function(id, ms) {
		this._opacity(id, 100, 60, ms);
	},

	_slide : function (id, end, start, millisec) {
		var speed = Math.round(millisec / 100),
			timer = 1;

		if(start > end) {
			// show
			this._changeOpac(85, id);
			for(i = start; i >= end; i-=(0.000010*timer*timer) ) {
				setTimeout("_$welen.fx._changeHeight(" + i + ",'" + id + "')", Math.round(5*millisec-1.5*speed*timer) );
				timer++;
			}
		} else if(start < end) {
			// hide
			this._changeWidth(30, id);
			this._opacity(id, 85, 30, 100);
			for(i = start; i <= end; i+=(0.000010*timer*timer) ) {
				setTimeout("_$welen.fx._changeHeight(" + i + ",'" + id + "')", Math.round(10*millisec-1.5*speed*timer) );
				timer++;
			}
		}
	},

	_changeWidth : function (w, id) {
		var object = $w('#'+id)[0].style; 
		object.left = ((100-w)/2) + '%';
		object.width = w + '%';
		if (w<2) {
			object.display = 'none';
		}
	},
	_changeHeight : function (h, id) {
		var object = $w('#'+id)[0].style; 
		object.top = ((100-h)/2) + '%';
		object.height = h + '%';
		if (h<2) {
			object.display = 'none';
		}
	},

	_opacity : function (id, opacStart, opacEnd, millisec) {
		var speed = Math.round(millisec / 100),
			timer = 0;
	
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("_$welen.fx._changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++)
				{
				setTimeout("_$welen.fx._changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	},
	
	_changeOpac : function (opacity, id) {
		var object = $w('#'+id)[0].style; 
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
		if (opacity==100) {object.filter='';}
	}
};
// -----------------------------------------------------------------------------------------------
_$welen.css = {
	init : function () {
		styleNode = doc.createElement('style');
		styleNode.type = "text/css";
		styleNode.name = "swelen";
		doc.getElementsByTagName("head")[0].appendChild(styleNode);
	},
	
	add : function (selector, property) {
		var css = doc.styleSheets[0];
		
		if (isie && css && css.addRule) {
			if (document.documentMode<8) {
				css.addRule(selector, '{' + property + '}');
			} else {
				css.addRule(selector, property);
			}
		} else {
			if(!!(window.attachEvent && !window.opera)) {
				styleNode.styleSheet.cssText += selector + ' { ' +  property + ' } ';
			} else {
				var styleText = doc.createTextNode(selector + ' { ' +  property + ' } ');
				styleNode.appendChild(styleText);
			}
			//doc.getElementsByTagName('head')[0].appendChild(styleNode);
		}
	},
	
	load : function(filename) {
		var css = doc.createElement('link');
		css.rel = 'stylesheet';
		css.type = 'text/css';
		css.href = filename;
		css.media = 'screen';
		css.title = 'SwelenCSS';
		doc.getElementsByTagName("head")[0].appendChild(css);
	},
	
	launch : function() {
		_$welen.css.init();
		// ----------------
		var opcss = 'filter:progid:DXImageTransform.Microsoft',
			lcss1 = 'display:block;margin-top:6px;float:right;width:67px;height:16px;line-height:16px;z-index:5000;background:url',
			lcss2 = 'background-image:none;'+opcss+'.AlphaImageLoader',
			swcss = '.swelen_suggest .swbox',
			iscss = 'width:50px;height:50px;',
			iscss_ads = 'width:90px;height:90px;',
			iMargin = 'margin',
			iPadding = 'padding',
			iTextDecoration = 'text-decoration';
		
		_$welen.css.add('.swelen_suggest',			'text-align:left;');
		
		_$welen.css.add(swcss,						'text-align:right');
		_$welen.css.add(swcss+' .swbottom',			'padding:6px 0 0 0;');
		_$welen.css.add(swcss+' .swbottom a',		'padding:0px 2px 2px 2px;height:16px;line-height:16px;'+iTextDecoration+':none;margin-right:2px;font-size:14px;font-weight:bolder');
		_$welen.css.add(swcss+' .swbottom a:hover',	'background-color:#808080;color:#FF9900;'+iTextDecoration+':none;'+opcss+'.alpha(opacity=50);opacity:0.50');
		_$welen.css.add(swcss+' ul',				'margin:0;padding:0');
		_$welen.css.add(swcss+' li',				'text-align:left;line-height:15px;min-height:32px;padding:2px;display:list-item;list-style:none;background-image:url();');
		_$welen.css.add(swcss+' li.swpicli',		'height:52px;padding:4px');
		_$welen.css.add(swcss+' .swpic',			iscss+'display:block;padding:0px;float:left ; margin-right:6px');
		_$welen.css.add(swcss+' .swthumb',			iscss+'overflow:hidden');
		_$welen.css.add(swcss+' .swpic_ads',		iscss_ads+'display:block;padding:0px;float:left ; margin-right:6px');
		_$welen.css.add(swcss+' .swthumb_ads',		iscss_ads+'overflow:hidden');
		_$welen.css.add(swcss+' .swnopic',			iscss+''+opcss+'.alpha(opacity=9);opacity:0.09;background:url("'+shea+'sitedata/sw_sgDefault.gif");');
		_$welen.css.add(swcss+' a.swlink',			''+iTextDecoration+':none;padding:4px 0 4px 0;display:block');
		_$welen.css.add(swcss+' a.swlink:hover',	''+iTextDecoration+':none');
		
		_$welen.css.add('.swclear', 'overflow:hidden;margin-top:2px;margin-left:30px;width:64px;float:right;padding:1px');
		_$welen.css.add('a.swbutton', 'background:transparent url("'+shea+'img/bg_button_a.gif") no-repeat scroll top right; color:#444; display:block;float:left;font:normal 12px arial, sans-serif;height:24px;margin-left:6px;margin-right:6px;padding-right:18px;'+iTextDecoration+':none;');
		_$welen.css.add('a.swbutton span', 'background:transparent url("'+shea+'img/bg_button_span.gif") no-repeat;display:block;line-height:14px;padding: 5px 0 5px 18px;');
		_$welen.css.add('a.swbutton:active', 'background-position:bottom right; color:#000; outline:none;');
		_$welen.css.add('a.swbutton:active span', 'background-position:bottom left;padding: 6px 0 4px 18px;');
		
		_$welen.css.add('.swelen_suggest .swlogo_w',		lcss1+'("'+shea+'img/sm1.png") right no-repeat;');
		_$welen.css.add('.swelen_suggest .swlogo_b',		lcss1+'("'+shea+'img/sm2.png") right no-repeat;');
		_$welen.css.add('* html .swelen_suggest .swlogo_w',	lcss2+'(src="'+shea+'img/sm1.png", sizingMethod="crop");');
		_$welen.css.add('* html .swelen_suggest .swlogo_b',	lcss2+'(src="'+shea+'img/sm2.png", sizingMethod="crop");');
		
		_$welen.css.add('.swelen-rnd',				'position:relative;z-index:1;');
		_$welen.css.add('.swelen-rnd *',			'position:relative;z-index:1;');
		_$welen.css.add('* html .swelen-rnd',		'height:1%;');

		if (smartphone) {
			_$welen.css.add(swcss+' li',			'line-height:12px;padding:1px;');
			_$welen.css.add(swcss+' .swbottom',		'padding-top:2px;');
			_$welen.css.add(swcss+' .swbottom a',	'padding:0px 0px 0px 0px;');
			_$welen.css.add('.swelen_suggest .swlogo_w', 'margin-top:0px');
			_$welen.css.add('.swelen_suggest .swlogo_b', 'margin-top:0px');
		}
		
	}
};
// -----------------------------------------------------------------------------------------------
_$welen.suggest.launch = function() {
	var core = _$welen.suggest.core,
		api = win._swelenSuggestAPI || false;

	if (api) {
		var o=api.slots;
		for (var i in o) {
			var h = parseInt(i,10);
			if (o[h]) {
				var slot = h+1;
				core.channel_uid[slot] = o[h].channel || '';
				core.get(slot, o[h].page || 1, o[h].nb || 4, "_$welen.suggest.core.build");
			}
		}

	} else {
		core.init();
	}

	_$welen.plugins.suggest.launched = true;
};
// -----------------------------------------------------------------------------------------------
_$welen.suggest.build = function() {
	_$welen.css.launch();
	if (isie) {
		if (document.documentMode && document.documentMode>=8) {
			xcorn = _$welen.crn.create({corner:10, border:4, borderOpacity:0.4});
		} else {
			xcorn = _$welen.crn.create({corner:10, border:1, borderOpacity:0.8});
		}
	} else {
		if(smartphone){
			xcorn = _$welen.crn.create({corner:8, border:3, borderOpacity:0.5});
		} else {
			xcorn = _$welen.crn.create({corner:12, border:5, borderOpacity:0.3});
		}
	}
};
// -----------------------------------------------------------------------------------------------
if (_$welen.plugins.suggest.delayed===true && _$welen.plugins.suggest.launched===false) {
	_$welen.suggest.launch();
}
// -----------------------------------------------------------------------------------------------

})();