//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

var Tips=new Class({Implements:[Events,Options],options:{onShow:function(A){A.setStyle("visibility","visible");},onHide:function(A){A.setStyle("visibility","hidden");
},showDelay:100,hideDelay:100,className:null,offsets:{x:16,y:16},fixed:false},initialize:function(){var C=Array.link(arguments,{options:Object.type,elements:$defined});
this.setOptions(C.options||null);this.tip=new Element("div").inject(document.body);if(this.options.className){this.tip.addClass(this.options.className);
}var B=new Element("div",{"class":"tip-top"}).inject(this.tip);this.container=new Element("div",{"class":"tip"}).inject(this.tip);var A=new Element("div",{"class":"tip-bottom"}).inject(this.tip);
this.tip.setStyles({position:"absolute",top:0,left:0,visibility:"hidden"});if(C.elements){this.attach(C.elements);}},attach:function(A){$$(A).each(function(D){var G=D.retrieve("tip:title",D.get("title"));
var F=D.retrieve("tip:text",D.get("rel")||D.get("href"));var E=D.retrieve("tip:enter",this.elementEnter.bindWithEvent(this,D));var C=D.retrieve("tip:leave",this.elementLeave.bindWithEvent(this,D));
D.addEvents({mouseenter:E,mouseleave:C});if(!this.options.fixed){var B=D.retrieve("tip:move",this.elementMove.bindWithEvent(this,D));D.addEvent("mousemove",B);
}D.store("tip:native",D.get("title"));D.erase("title");},this);return this;},detach:function(A){$$(A).each(function(C){C.removeEvent("mouseenter",C.retrieve("tip:enter")||$empty);
C.removeEvent("mouseleave",C.retrieve("tip:leave")||$empty);C.removeEvent("mousemove",C.retrieve("tip:move")||$empty);C.eliminate("tip:enter").eliminate("tip:leave").eliminate("tip:move");
var B=C.retrieve("tip:native");if(B){C.set("title",B);}});return this;},elementEnter:function(B,A){$A(this.container.childNodes).each(Element.dispose);
var D=A.retrieve("tip:title");if(D){this.titleElement=new Element("div",{"class":"tip-title"}).inject(this.container);this.fill(this.titleElement,D);}var C=A.retrieve("tip:text");
if(C){this.textElement=new Element("div",{"class":"tip-text"}).inject(this.container);this.fill(this.textElement,C);}this.timer=$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this);
this.position((!this.options.fixed)?B:{page:A.getPosition()});},elementLeave:function(A){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this);
},elementMove:function(A){this.position(A);},position:function(D){var B=window.getSize(),A=window.getScroll();var E={x:this.tip.offsetWidth,y:this.tip.offsetHeight};
var C={x:"left",y:"top"};for(var F in C){var G=D.page[F]+this.options.offsets[F];if((G+E[F]-A[F])>B[F]){G=D.page[F]-this.options.offsets[F]-E[F];}this.tip.setStyle(C[F],G);
}},fill:function(A,B){(typeof B=="string")?A.set("html",B):A.adopt(B);},show:function(){this.fireEvent("show",this.tip);},hide:function(){this.fireEvent("hide",this.tip);
}});

function sha1(msg) {

	function rotate_left(n, s) {
		var t4 = (n << s) | (n >>> (32 - s));
		return t4;
	};

	function lsb_hex(val) {
		var str = "";
		var i;
		var vh;
		var vl;

		for (i = 0; i <= 6; i += 2) {
			vh = (val >>> (i * 4 + 4)) & 0x0f;
			vl = (val >>> (i * 4)) & 0x0f;
			str += vh.toString(16) + vl.toString(16);
		}
		return str;
	};

	function cvt_hex(val) {
		var str = "";
		var i;
		var v;

		for (i = 7; i >= 0; i--) {
			v = (val >>> (i * 4)) & 0x0f;
			str += v.toString(16);
		}
		return str;
	};


	function Utf8Encode(string) {
		string = string.replace(/\r\n/g, "\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			} else if ((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			} else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	};

	var blockstart;
	var i, j;
	var W = new Array(80);
	var H0 = 0x67452301;
	var H1 = 0xEFCDAB89;
	var H2 = 0x98BADCFE;
	var H3 = 0x10325476;
	var H4 = 0xC3D2E1F0;
	var A, B, C, D, E;
	var temp;

	msg = Utf8Encode(msg);

	var msg_len = msg.length;

	var word_array = new Array();
	for (i = 0; i < msg_len - 3; i += 4) {
		j = msg.charCodeAt(i) << 24 | msg.charCodeAt(i + 1) << 16 | msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3);
		word_array.push(j);
	}

	switch (msg_len % 4) {
		case 0:
		i = 0x080000000;
		break;
		case 1:
		i = msg.charCodeAt(msg_len - 1) << 24 | 0x0800000;
		break;

		case 2:
		i = msg.charCodeAt(msg_len - 2) << 24 | msg.charCodeAt(msg_len - 1) << 16 | 0x08000;
		break;

		case 3:
		i = msg.charCodeAt(msg_len - 3) << 24 | msg.charCodeAt(msg_len - 2) << 16 | msg.charCodeAt(msg_len - 1) << 8 | 0x80;
		break;
	}

	word_array.push(i);

	while ((word_array.length % 16) != 14) word_array.push(0);

	word_array.push(msg_len >>> 29);
	word_array.push((msg_len << 3) & 0x0ffffffff);


	for (blockstart = 0; blockstart < word_array.length; blockstart += 16) {

		for (i = 0; i < 16; i++) W[i] = word_array[blockstart + i];
		for (i = 16; i <= 79; i++) W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);

		A = H0;
		B = H1;
		C = H2;
		D = H3;
		E = H4;

		for (i = 0; i <= 19; i++) {
			temp = (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B, 30);
			B = A;
			A = temp;
		}

		for (i = 20; i <= 39; i++) {
			temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B, 30);
			B = A;
			A = temp;
		}

		for (i = 40; i <= 59; i++) {
			temp = (rotate_left(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B, 30);
			B = A;
			A = temp;
		}

		for (i = 60; i <= 79; i++) {
			temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
			E = D;
			D = C;
			C = rotate_left(B, 30);
			B = A;
			A = temp;
		}

		H0 = (H0 + A) & 0x0ffffffff;
		H1 = (H1 + B) & 0x0ffffffff;
		H2 = (H2 + C) & 0x0ffffffff;
		H3 = (H3 + D) & 0x0ffffffff;
		H4 = (H4 + E) & 0x0ffffffff;

	}

	var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);

	return temp.toLowerCase();

}

function inputfilter(formname, strict, inobj) {
	var formobject = document.forms[formname].elements;
	var content = formobject[inobj.name].value;
	var newcontent = content;
	if (strict == true) {
		var expression = /[^\w\d]/;
	} else {
		var expression = /[^\w\d\s.,']/;
	}

	newcontent = content.replace(expression, "");
	if (content != newcontent) {
		formobject[inobj.name].value = newcontent;
	}
}

function encryptpassword(formname, hasconfirm) {
	var formobject = document.forms[formname].elements;
	var oldpassword = formobject["passwordprehash"].value;
	var newpassword = "";

	formobject["password"].value = sha1(oldpassword + "WoWtCgLoOt");

	for (var counter = 0; counter < oldpassword.length; counter++) {
		newpassword += "*";
	}

	if (hasconfirm) {
		var conpassword = formobject["passwordconfirm"].value;
		if (oldpassword != conpassword) {
			alert("Passwords do not match");
			return false;
		}
		formobject["passwordconfirm"].value = newpassword;
	}

	formobject["passwordprehash"].value = newpassword;

	return true;
}

if (!String.prototype.rot13) {
	String.prototype.rot13 = function () {
		return this.replace(/[a-zA-Z]/g, function (c) {
			return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
		});
	};
}

function storedhref(inobj, place) {
	inobj.href = outhref[place].rot13();
}

function graphchange(graphtype, typeid) {
	formobj = document.forms["formgraph-" + graphtype + "-" + typeid];
	graphobj = document.getElementById("graph-" + graphtype + "-" + typeid);

	var pricetype = "b";
	for (counter = 0; counter < formobj.elements["pr"].length; counter++) {
		if (formobj.elements["pr"][counter].checked) {
			pricetype = formobj.elements["pr"][counter].value;
			break;
		}
	}

	graphobj.style.visibility = "hidden";
	graphobj.style.display = "none";
	graphobj.src = "/images/graph/?ty=" + graphtype + "&id=" + typeid + "&pr=" + pricetype;
}

function graphshow(graphtype, typeid) {
	graphobj = document.getElementById("graph-" + graphtype + "-" + typeid);
	graphobj.style.visibility = "visible";
	graphobj.style.display = "block";
}

// chatbox
function chatlistredraw(chatlist) {
	var chatboxdiv = $("chatboxdiv");
	chatboxdiv.empty();

	if (chatlist["chatbox"].length > 0) {
		chatlist["chatbox"].each(function (details) {
			var chatentry = new Element("div", {
				"class": "preview"
			});

			var chattop = new Element("div", {
				"class": "previewtop"
			}).inject(chatentry);
			var chatnum = new Element("span", {
				"class": "chatnum",
				"html": "#" + details["chatid"]
			}).inject(chattop);
			var username = new Element("h3", {
				"html": details["username"]
			}).inject(chattop);
			var chatrank = new Element("img", {
				"class": "chatrank",
				"src": "/images/chatbox/" + details["chatrank"] + ".png"
			}).inject(username);
			if (details["level"] > 1) {
				username.setStyle("color", "#930");
			}

			var localdatetime = new Element("span", {
				"class": "chatlocaldatetime",
				"html": details["localdatetime"]
			}).inject(chattop);
			var datetime = new Element("span", {
				"class": "chatdatetime",
				"html": details["datetime"]
			}).inject(chattop);
			var continent = new Element("img", {
				"src": "/images/continents/" + details["continent"] + ".png",
				"title": details["countrycode"]
			}).inject(chattop);

			var chatbottom = new Element("div", {
				"class": "previewbottom",
				"id": details["chatid"] + "-" + details["datetime"]
			}).inject(chatentry);
			var content = new Element("span", {
				"html": details["content"]
			}).inject(chatbottom);

			chatentry.inject(chatboxdiv);
		});
	} else {
		var chatentry = new Element("div", {
			"class": "preview"
		});
		var chattop = new Element("div", {
			"class": "previewtop"
		}).inject(chatentry);
		var chatbottom = new Element("div", {
			"class": "previewbottom"
		}).inject(chatentry);

		var datetime = new Element("span", {
			"html": ""
		}).inject(chattop);
		var username = new Element("h3", {
			"html": "No chat available"
		}).inject(chattop);
		username.setStyle("color", "#930");

		var content = new Element("span", {
			"html": ""
		}).inject(chatbottom);

		chatentry.inject(chatboxdiv);
	}

	Mediabox.scanPage();
}

function chatboxupdate(withsend) {
	var senddata = new Object();
	senddata["action"] = "chatboxget";

	if (withsend == true) {
		var formobject = document.forms["chatboxsubmit"].elements;
		senddata["content"] = formobject["content"].value;

		var browsertime = new Date();
		var fullyear = browsertime.getFullYear();
		var month = browsertime.getMonth() + 1;
		if (month < 9) { month = "0" + month; }
		var day = browsertime.getDate() < 9 ? "0" + browsertime.getDate() : browsertime.getDate();
		var hour = browsertime.getHours() < 9 ? "0" + browsertime.getHours() : browsertime.getHours();
		var minute = browsertime.getMinutes() < 9 ? "0" + browsertime.getMinutes() : browsertime.getMinutes();
		var second = browsertime.getSeconds() < 9 ? "0" + browsertime.getSeconds() : browsertime.getSeconds();
		senddata["localtime"] = fullyear + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;

		formobject["content"].disabled = true;
		formobject["submit"].value = "Wait";
		formobject["submit"].disabled = true;
		clearTimeout(chatboxtimeout);
		chatboxreload(30, 40);
	}

	var ajaxrequest = new Request({
		url: "/ajax/gateway.php",
		data: senddata,
		onSuccess: function (responseText) {
			chatlistredraw(JSON.decode(responseText));
			//			chatlistglow();
			if (withsend == true) {
				formobject["content"].disabled = false;
				formobject["content"].value = "";
				formobject["submit"].disabled = false;
				formobject["submit"].value = "Chat";
			}
		},
		onFailure: function () {
		}
	}).send();
}

function chatboxreload(reloadsec, reloadtimes) {
	if (reloadtimes > 0) {
		if (reloadsec <= 10 || reloadsec >= 19) {
			if (reloadsec == 19) {
				$("chatboxtimer").set("html", "&nbsp;");
			} else {
				$("chatboxtimer").set("html", "(Chat refresh in " + reloadsec + "sec)");
			}
		}

		if (reloadsec <= 0) {
			chatboxupdate(false);
			reloadsec += 30;
			reloadtimes--;
		}
		reloadsec--;
		chatboxtimeout = setTimeout("chatboxreload(" + reloadsec + "," + reloadtimes + ")", 1000);
	} else {
		$("chatboxtimer").set("html", "<a href=\"#\" onclick=\"chatboxreload(3,40); return false;\">Restart Auto Refresh</a>");
	}
}

function chatlistglow() {
	$$("div#chatboxdiv div.preview div.previewbottom").each(function (element) {
		var idarray = element.id.split("-");
		if (isFinite(idarray[1]) && idarray[1] > visitprev) {
			var effect = new Fx.Tween(element);
			var periodical;
			var fx = function () {
				effect.start('background-color', '#f8f8f8').chain(function () {
					effect.start('background-color', '#efefef');
				});
			}
			fx();
			periodical = fx.periodical(1700);
		}
	});
}

var LightFace = new Class({
	
	Implements: [Options,Events],
	
	options: {
		width: 'auto',
		height: 'auto',
		draggable: false,
		title: '',
		buttons: [],
		fadeDelay: 400,
		fadeDuration: 400,
		keys: { 
			esc: function() { this.close(); } 
		},
		content: '<p>Message not specified.</p>',
		zIndex: 9001,
		pad: 100,
		overlayAll: false,
		constrain: false,
		resetOnScroll: true,
		baseClass: 'lightface',
		errorMessage: '<p>The requested file could not be found.</p>'/*,
		onOpen: $empty,
		onClose: $empty,
		onFade: $empty,
		onUnfade: $empty,
		onComplete: $empty,
		onRequest: $empty,
		onSuccess: $empty,
		onFailure: $empty
		*/
	},
	
	
	initialize: function(options) {
		this.setOptions(options);
		this.state = false;
		this.buttons = {};
		this.resizeOnOpen = true;
		this.ie6 = typeof document.body.style.maxHeight == "undefined";
		this.draw();
	},
	
	draw: function() {
		
		//create main box
		this.box = new Element('table',{
			'class': this.options.baseClass,
			styles: {
				'z-index': this.options.zIndex,
				opacity: 0
			},
			tween: {
				duration: this.options.fadeDuration,
				onComplete: function() {
					if(this.box.getStyle('opacity') == 0) {
						this.box.setStyles({ top: -9000, left: -9000 });
					}
				}.bind(this)
			}
		}).inject(document.body,'bottom');

		//draw rows and cells;  use native JS to avoid IE7 and I6 offsetWidth and offsetHeight issues
		var verts = ['top','center','bottom'], hors = ['Left','Center','Right'], len = verts.length;
		for(var x = 0; x < len; x++) {
			var row = this.box.insertRow(x);
			for(var y = 0; y < len; y++) {
				var cssClass = verts[x] + hors[y], cell = row.insertCell(y);
				cell.className = cssClass;
				if (cssClass == 'centerCenter') {
					this.contentBox = new Element('div',{
						'class': 'lightfaceContent',
						styles: {
							width: this.options.width
						}
					});
					cell.appendChild(this.contentBox);
				}
				else {
					document.id(cell).setStyle('opacity',0.4);
				}
			}
		}
		
		//draw title
		if(this.options.title) {
			this.title = new Element('h2',{
				'class': 'lightfaceTitle',
				html: this.options.title
			}).inject(this.contentBox);
			if(this.options.draggable && window['Drag'] != null) {
				this.draggable = true;
				new Drag(this.box,{ handle: this.title });
				this.title.addClass('lightfaceDraggable');
			}
		}
		
		//draw message box
		this.messageBox = new Element('div',{
			'class': 'lightfaceMessageBox',
			html: this.options.content || '',
			styles: {
				height: this.options.height
			}
		}).inject(this.contentBox);
		
		//button container
		this.footer = new Element('div',{
			'class': 'lightfaceFooter',
			styles: {
				display: 'none'
			}
		}).inject(this.contentBox);
		
		//draw overlay
		this.overlay = new Element('div',{
			html: '&nbsp;',
			styles: {
				opacity: 0
			},
			'class': 'lightfaceOverlay',
			tween: {
				link: 'chain',
				duration: this.options.fadeDuration,
				onComplete: function() {
					if(this.overlay.getStyle('opacity') == 0) this.box.focus();
				}.bind(this)
			}
		}).inject(this.contentBox);
		if(!this.options.overlayAll) {
			this.overlay.setStyle('top',(this.title ? this.title.getSize().y - 1: 0));
		}
		
		//create initial buttons
		this.buttons = [];
		if(this.options.buttons.length) {
			this.options.buttons.each(function(button) {
				this.addButton(button.title,button.event,button.color);
			},this);
		}
		
		//focus node
		this.focusNode = this.box;

		return this;
	},
	
	// Manage buttons
	addButton: function(title,clickEvent,color) {
		this.footer.setStyle('display','block');
		var focusClass = 'lightfacefocus' + color;
		var label = new Element('label',{
			'class': color ? 'lightface' + color : '',
			events: {
				mousedown: function() {
					if(color) {
						label.addClass(focusClass);
						var ev = function() {
							label.removeClass(focusClass);
							document.id(document.body).removeEvent('mouseup',ev);
						};
						document.id(document.body).addEvent('mouseup',ev);
					}
				}
			}
		});
		this.buttons[title] = (new Element('input',{
			type: 'button',
			value: title,
			events: {
				click: (clickEvent || this.close).bind(this)
			}
		}).inject(label));
		label.inject(this.footer);
		return this;
	},
	showButton: function(title) {
		if(this.buttons[title]) this.buttons[title].removeClass('hiddenButton');
		return this.buttons[title];
	},
	hideButton: function(title) {
		if(this.buttons[title]) this.buttons[title].addClass('hiddenButton');
		return this.buttons[title];
	},
	
	// Open and close box
	close: function(fast) {
		if(this.isOpen) {
			this.box[fast ? 'setStyles' : 'tween']('opacity',0);
			this.fireEvent('close');
			this._detachEvents();
			this.isOpen = false;
		}
		return this;
	},
	
	open: function(fast) {
		if(!this.isOpen) {
			this.box[fast ? 'setStyles' : 'tween']('opacity',1);
			if(this.resizeOnOpen) this._resize();
			this.fireEvent('open');
			this._attachEvents();
			(function() {
				this._setFocus();
			}).bind(this).delay(this.options.fadeDuration + 10);
			this.isOpen = true;
		}
		return this;
	},
	
	_setFocus: function() {
		this.focusNode.setAttribute('tabIndex',0);
		this.focusNode.focus();
	},
	
	// Show and hide overlay
	fade: function(fade,delay) {
		this._ie6Size();
		(function() {
			this.overlay.setStyle('opacity',fade || 1);
		}.bind(this)).delay(delay || 0);
		this.fireEvent('fade');
		return this;
	},
	unfade: function(delay) {
		(function() {
			this.overlay.fade(0);
		}.bind(this)).delay(delay || this.options.fadeDelay);
		this.fireEvent('unfade');
		return this;
	},
	_ie6Size: function() {
		if(this.ie6) {
			var size = this.contentBox.getSize();
			var titleHeight = (this.options.overlayAll || !this.title) ? 0 : this.title.getSize().y;
			this.overlay.setStyles({
				height: size.y - titleHeight,
				width: size.x
			});
		}
	},
	
	// Loads content
	load: function(content,title) {
		if(content) this.messageBox.set('html',content);
		if(title && this.title) this.title.set('html',title);
		this.fireEvent('complete');
		return this;
	},
	
	// Attaches events when opened
	_attachEvents: function() {
		this.keyEvent = function(e){
			if(this.options.keys[e.key]) this.options.keys[e.key].call(this);
		}.bind(this);
		this.focusNode.addEvent('keyup',this.keyEvent);
		
		this.resizeEvent = this.options.constrain ? function(e) { 
			this._resize(); 
		}.bind(this) : function() { 
			this._position(); 
		}.bind(this);
		window.addEvent('resize',this.resizeEvent);
		
		if(this.options.resetOnScroll) {
			this.scrollEvent = function() {
				this._position();
			}.bind(this);
			window.addEvent('scroll',this.scrollEvent);
		}
		
		return this;
	},
	
	// Detaches events upon close
	_detachEvents: function() {
		this.focusNode.removeEvent('keyup',this.keyEvent);
		window.removeEvent('resize',this.resizeEvent);
		if(this.scrollEvent) window.removeEvent('scroll',this.scrollEvent);
		return this;
	},
	
	// Repositions the box
	_position: function() {
		var windowSize = window.getSize(), 
			scrollSize = window.getScroll(), 
			boxSize = this.box.getSize();
		this.box.setStyles({
			left: scrollSize.x + ((windowSize.x - boxSize.x) / 2),
			top: scrollSize.y + ((windowSize.y - boxSize.y) / 2)
		});
		this._ie6Size();
		return this;
	},
	
	// Resizes the box, then positions it
	_resize: function() {
		var height = this.options.height;
		if(height == 'auto') {
			//get the height of the content box
			var max = window.getSize().y - this.options.pad;
			if(this.contentBox.getSize().y > max) height = max;
		}
		this.messageBox.setStyle('height',height);
		this._position();
	},
	
	// Expose message box
	toElement: function () {
		return this.messageBox;
	},
	
	// Expose entire modal box
	getBox: function() {
		return this.box;
	},
	
	// Cleanup
	destroy: function() {
		this._detachEvents();
		this.buttons.each(function(button) {
			button.removeEvents('click');
		});
		this.box.dispose();
		delete this.box;
	}
});

window.addEvent("domready", function () {
	if (pagelocation == "chatbox") {
		// chatlistglow();
		chatboxreload(30, 40);
	}

	$$("div.ltip").each(function (element, index) {
		var related = element.get("rel").split("|");
		var sellerid = related[0];

		if (typeof sellerid != "undefined") {
			var details = outsellers[sellerid];
			if (typeof details != "undefined") {
				if (details["partner"] == "ebay") {
					var located = outlocations[related[1]];
					var shippingto = related[2];
					var shiplist = shippingto.split("+");
					if (shiplist.length > 0) {
						shippingto = new Array;
						for (var counter = 0; counter < shiplist.length; counter++) {
							shippingto[shippingto.length] = outlocations[shiplist[counter]];
						}
						shippingto = shippingto.join(", ");
					} else {
						shippingto = outlocations[shipping];
					}
					element.store("tip:title", "<strong>" + details["userid"] + "</strong> ( " + details["fbscore"] + " " + (details["fbratingstar"] != "none" ? "<img style=\"background: none; border: none; vertical-align: middle; padding: 0px;\" src=\"/images/fbicons/" + details["fbratingstar"] + ".png\" />" : "") + "<img style=\"background: none; border: none; vertical-align: middle; padding: 0 0 0 5px;\" src=\"/images/icons/small_ebay.png\" />" + (details["toprated"] == "t" ? "<img style=\"background: none; border: none; vertical-align: middle; padding: 0 0 0 3px;\" src=\"/images/icons/toprated.png\" />" : "") + " )");
					element.store("tip:text", "Positive feedback: " + details["fbpercent"] + "%" + (details["userstore"] ? "<br />eBay Store: <strong>" + details["userstore"] + "</strong>" : "") + "<br />Located: " + located + "<br />Ships to: " + shippingto);
				} else if (details["partner"] == "merchant") {
					var presale = related[1].split("+");
					var prices = related[2].split("+");
					if (presale[0] == "f") {
						element.store("tip:title", "<strong>" + details["userid"] + "</strong> ( <img style=\"background: none; border: none; vertical-align: middle; padding: 0px;\" src=\"/images/icons/pp.gif\" /> )");
						element.store("tip:text", (prices[0] ? "Instant Price: $" + prices[0] + "<br />" : "") + (prices[1] ? "Postal Price: $" + prices[1] : ""));
					}
					else if (presale[0] == "t") {
						element.store("tip:title", "<strong>" + details["userid"] + " Pre-Sale</strong> ( <img style=\"background: none; border: none; vertical-align: middle; padding: 0px;\" src=\"/images/icons/pp.gif\" /> )");
						element.store("tip:text", "Add to cart for digital delivery.<br />Code delivered on " + presale[1]);
					}
				} else if (details["partner"] == "amazon") {
					element.store("tip:title", "<strong>" + details["userid"] + "</strong> ( " + details["fbscore"] + " " + (details["fbratingstar"] != "none" ? "<img style=\"background: none; border: none; vertical-align: middle; padding: 0px;\" src=\"/images/icons/small_amazon.png\" />" : "") + " )");
					element.store("tip:text", "Positive feedback: " + details["fbpercent"] + " / 5.0");
				}
			}
		}
	});

	var mytips = new Tips("div.ltip", {
		className: "ltip",
		offsets: {
			"x": 80,
			"y": 16
		},
		fixed: true,
		hideDelay: 50,
		showDelay: 50
	});

});
