//product tool tip
window.addEvent('domready', function() {
    $$('img.tips').each(function(element, index) {
        var content = element.getNext('.tool-tip-content').getChildren('p');
        element.store('tip:title', content[0]);
        element.store('tip:text', content[1]);
    });
    var productTips = new Tips($$('.tips'), {
        offsets: { 'x': -140, 'y': 95 },
        className: 'tipcontainer',
        fixed: true,
        hideDelay: 100,
        showDelay: 0,
        onShow: function(toolTipElement) {
            toolTipElement.setStyle('visibility', 'visible')
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
        },
        onHide: function(toolTipElement) {
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
            this.options.tipTimer = (
				function() { toolTipElement.setStyle('visibility', 'hidden') }
			).delay(1500);
        }
    });
    $$('a.tips1').each(function(element, index) {
        var content = element.getNext('.tool-tip-content').getChildren('p');
        element.store('tip:text', content[0]);
    });
    var ingredientsTips = new Tips($$('.tips1'), {
        offsets: { 'x': 35, 'y': -52 },
        className: 'ingredientstip',
        fixed: true,
        hideDelay: 100,
        showDelay: 0,
        onShow: function(toolTipElement) {
            toolTipElement.setStyle('visibility', 'visible')
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
        },
        onHide: function(toolTipElement) {
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
            this.options.tipTimer = (
				function() { toolTipElement.setStyle('visibility', 'hidden') }
			).delay(1500);
        }
    });
    $$('a.tips2').each(function(element, index) {
        var content = element.getNext('.tool-tip-content').getChildren('p');
        element.store('tip:text', content[0]);
    });
		$$('a.profile-thumb').each(function(element, index) {
        var content = element.getNext('.tool-tip-content').getChildren('p');
        element.store('tip:text', content[0]);
    });
    var hpOfferTips = new Tips($$('.tips2'), {
        offsets: { 'x': -60, 'y': 35 },
        className: 'hpOfferTip',
        fixed: true,
        hideDelay: 0,
        showDelay: 0,
        onShow: function(toolTipElement) {
            toolTipElement.setStyle('visibility', 'visible')
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
        },
        onHide: function(toolTipElement) {
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
            this.options.tipTimer = (
				function() { toolTipElement.setStyle('visibility', 'hidden') }
			).delay(0);
        }
    });
    $$('.btn_media').each(function(element, index) {
        var content = element.getNext('.tool-tip-content').getChildren('p');
        element.store('tip:text', content[0]);
    });
    var downloadTips = new Tips($$('.btn_media'), {
        offsets: { 'x': 12, 'y': -43 },
        className: 'mediatip',
        fixed: true,
        hideDelay: 0,
        showDelay: 0,
        onShow: function(toolTipElement) {
            toolTipElement.setStyle('visibility', 'visible')
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
        },
        onHide: function(toolTipElement) {
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
            this.options.tipTimer = (
				function() { toolTipElement.setStyle('visibility', 'hidden') }
			).delay(2500);
        }
    });
    var profileThumbTip = new Tips($$('.profile-thumb'), {
        offsets: { 'x': 170, 'y': 20 },
        className: 'profile-thumb-tip',
        fixed: true,
        hideDelay: 100,
        showDelay: 0,
        onShow: function(toolTipElement) {
            toolTipElement.setStyle('visibility', 'visible')
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
        },
        onHide: function(toolTipElement) {
            if (this.options.tipTimer) this.options.tipTimer = $clear(this.options.tipTimer);
            this.options.tipTimer = (
				function() { toolTipElement.setStyle('visibility', 'hidden') }
			).delay(0);
        }
    });
});