/*
Javascript for ANAHATA
*/
// Begin jQuery
  //ROUNDED IMG
$(document).ready(function(){
  $(".rounded-img, .rounded-img2").load(function() {
    $(this).wrap(function(){
      return '<span class="' + $(this).attr('class') + '" style="background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />';
    });
    $(this).css("opacity","0");
  });
});
//END ROUNDED IMG

// POPUP BUBBLE 
     $(function () {
        $('.bubbleInfo').each(function () {
            var distance = 10;
            var time = 250;
            var hideDelay = 500;

            var hideDelayTimer = null;
            var beingShown = false;
            var shown = false;
            var trigger = $('.trigger', this);
            var info = $('.popup', this).css('opacity', 0);

            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;
                    info.css({
                        top: -10,
                        left: 140,
                        display: 'block'
                    }).animate({
                        left: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }
                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        left: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });
                }, hideDelay);
                return false;
            });
        });
    });
	//POPUP BUBBLE END

// http://www.aakashweb.com/resources/pages/demos/jquery-lite-content-slider/
$(document).ready(function(){
	$('.sliderWrap').liteSlider({
		content : '.sliderContent',	// The sliding content selector. Can be a list also. eg:li
		width : 940,			// Width of the slider
		height : 195,			// Height of the slider
		autoplay : true,		// Autoplay the slider. Values, true & false
		delay : 5,			// Transition Delay. Default 3s
		buttonsClass : 'buttons',	// Button's class
		activeClass : 'active',		// Active class
		controlBt : '.control',		// Control button selector
		playText : 'Play',		// Play text
		pauseText : 'Stop'		// Stop text
	});
});

// TABLE Effects http://www.red-team-design.com/practical-css3-tables-with-rounded-corners
$(document).ready(function(){
	$('.bordered tr').mouseover(function(){
		$(this).addClass('highlight');
	}).mouseout(function(){
		$(this).removeClass('highlight');
	});
});
