﻿function qTipInit(txt, clientId) {
	var msg = txt;
	var myValue = document.getElementById(clientId);
	$(myValue).each(function () {
		if ($.browser.msie && $.browser.version == "6.0") {
			$(this).qtip({
				show: {
					when: {
						event: 'focus'
					},
					effect: {
						type: 'fade',
						length: 200
					}
				},
				hide: 'blur',
				content: msg, // Use the tooltip attribute of the element for the content
				style: {
					width: 400,
					name: 'blue',
					border: {
						width: 3,
						radius: 3,
						color: '#dddddd'
					},
					tip: 'leftMiddle',
					background: '#03315b',
					color: '#eeeeee'
				},
				position: {
					type: 'fixed',
					container: $('#ie6tooltip'),
					corner: {
						target: 'rightMiddle'
					},
					adjust: {
						y: 1,
						x: 1,
						scroll: false,
						screen: true
					},
					api: {
						onRender: function () {
							this.elements.tooltip.click(this.hide);
						}
					}
				}
			});
		} else {
			$(this).qtip({
				show: {
					when: {
						event: 'focus'
					},
					effect: {
						type: 'fade',
						length: 200
					}
				},
				hide: {
					effect: 'blur',
					fixed: true
					},
				content: msg, // Use the tooltip attribute of the element for the content
				style: {
					width: 400,
					name: 'blue',
					border: {
						width: 3,
						radius: 3,
						color: '#dddddd'
					},
					tip: 'leftMiddle',
					background: '#03315b',
					color: '#eeeeee'
				},
				position: {
					type: 'absolute',
					corner: {
						target: 'rightMiddle'
					},
					adjust: {
						y: -17,
						x: 9,
						resize: true,
						scroll: false,
						screen: true
					}
				},
				api: {
					onRender: function () {
						this.elements.tooltip.click(this.hide);
					},
					onHide: function () {
						// Reset the scroll position
						this.elements.content.children('div').css({ scrollTop: 0 });
					}
				}
			});
		};
	});
}
