﻿

$jq(document).ready(function () {
    $jq('.promos').cycle({
        fx: 'fade',
        delay: 2000,
        speed: 500,
        timeout: 3500,
        pause: 1,
        before: function (curr, next, opts) { },
        pager: '.promo-nav',
        pagerAnchorBuilder: function (idx, slide) {
            return '<a href="#"><span><\/span><\/a>';
        }
    });

    $jq('.promoblock').each(function (index) {
        promoblockIndex = index;
        $jq('.hotspot-it', this).each(function (index) {
            var coordsvar = $jq(this).attr("coords").split(',');
            $jq(this).next().css('left', parseInt(coordsvar[0]) - 21 + 'px');
            $jq(this).next().css('top', parseInt(coordsvar[1]) - 21 + 'px');
            $jq(this).next().css('display', 'block');
            if($jq(this).css('zIndex',30000));

            $jq(this).next().mouseenter(function (e) {
                if (isIE) $jq('.hotspot-inner', this).css('display', 'block'); else $jq('.hotspot-inner', this).fadeTo('slow', 1.0);
                $jq('.promos').cycle('pause');

                leftInt = "9px";
                topInt = "23px";

                if ($jq(this).hasClass('tl')) { leftInt = "-205px"; topInt = "-" + ($jq('.hotspot-inner', this).height() - 22) + "px"; };
                if ($jq(this).hasClass('tr')) { leftInt = "10px"; topInt = "-" + ($jq('.hotspot-inner', this).height() - 22) + "px"; };
                if($jq(this).css('zIndex',100000));

                $jq('.hotspot-inner', this).css('left', leftInt);
                $jq('.hotspot-inner', this).css('top', topInt);
                $jq('.spotOver', this).css('display', 'block');
            });
            $jq(this).next().mouseleave(function (e) {
                if($jq(this).css('zIndex',30000));
                $jq('.hotspot-inner', this).css('display', 'none');
                $jq('.spotOver', this).css('display', 'none');
                $jq('.promos').cycle('resume');
            });
        });
    });
});

