﻿$(document).ready(function() {

    function updateSFL(domObj) {
        var me = $(domObj);
        var pos = me.position();
        jQuery.post(
            'UpdateSFL.ashx',
            {
                divId: domObj.id,
                left: parseInt(pos.left),
                top: parseInt(pos.top),
                productId: $(document).getUrlParam("productId")
            }
        );
    }

    var prodId = $(document).getUrlParam("productId");
    var transImageUrl = "../img/product/Trans_koelstra.png";
    var glowImageUrl = "../img/SP_Images/glow.png";
    
    if (prodId == 13 || prodId == 140) { //Grijze cirkels voor Binque Daily en Mambo Daily (omdat die zelf al oranje zijn)
        transImageUrl = "../img/SP_Images/Special_features_grijs1.png";
        glowImageUrl = "../img/SP_Images/Special_features_grijs2.png";
    }

    $('a.tip').html('<div><div class="trans" style="position: absolute"><img src="' + transImageUrl + '" /></div><div class="glow" style="display: none; position: absolute; top:-20px; left:-20px;"><img src="' + glowImageUrl + '" /></div></div>')
    .each(function() {
        var me = $(this);
        var coordinates = me.attr('alt').split(',');
        me.css({ top: coordinates[0] + 'px', left: coordinates[1] + 'px' });
        me.hover(function() {
            me.find('.trans').hide();
            me.find('.glow').show();
        }, function() {

            me.find('.glow').hide();
            me.find('.trans').show();
        });
    });


    /*$('a.tip').qtip({
    position: {
    corner: {
    target: 'bottomMiddle',
    tooltip: 'topMiddle'
    }
    },
    style: {
    width: 220,
    padding: 5,
    background: '#F8F8F8',
    color: '#828282',
    textAlign: 'center',
    border: {
    width: 2,
    radius: 3,
    color: '#cdcdcd'
    }
    // name: 'dark' // Inherit the rest of the attributes from the preset dark style
    },
    show: 'mouseover',
    hide: 'mouseout'
    })*/

    $(function() {
        /*$("a.tip").draggable({
        stop: function(event, ui) {
        updateSFL(this);
        }
        });*/
    });

    //$('.mainDiv').corner("keep");

});

function showSF_text(txt) {
    $('.sf_desc').css('display', 'block');
    $('.sf_descText').html(txt);
}

function hideSF_text() {
    $('.sf_desc').css('display', 'none');
    $('.sf_descText').html('');
}

