﻿
function slideSwitch() {
    var $active = $('#slideshow img.active');

    if ( $active.length == 0 ) $active = $('#slideshow img:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});


function slideSwitchdoctor() {

    $active = $('#slideDoctor div.active');

    if ($active.length == 0) $active = $('#slideDoctor div:last');

    var $next = $active.next().length ? $active.next()
        : $('#slideDoctor div:first');


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchdoctor()", 7000 );
});


$(document).ready(function() { 
 
    // initialize tooltip 
    $("#question-box img[title]").tooltip({ 
     
        // use single tooltip element for all tips 
        tip: '#demotip',  
         
        // tweak the position 
       offset: [15, 110], 
         
        // use "slide" effect 
     effect: 'fade' 
         
    // add dynamic plugin  
    })
});


this.tooltip = function() {
    /* CONFIG */
    xOffset = -10;
    yOffset = 20;
    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result		
    /* END CONFIG */
    $("a.tooltip").hover(function(e) {
        this.t = $(this).next().html();
        this.title = "";
        $("body").append("<p id='tooltip'>" + this.t + "</p>");
        $("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function() {
	    
	    $("#tooltip").remove();
	});
    $("a.tooltip").mousemove(function(e) {
        $("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
};



// starting the script on page load
$(document).ready(function() {
    tooltip();
});
