﻿/* Google analytics code */

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3359794-3']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

/* Initialize sliding presentation panel */
$(window).load(function() {
    $(".presentation_container .sub_info").tabs(".presentation_container .panels > div.panel", {
        effect: 'fade',
        fadeOutSpeed: "fast",
        rotate: true,
        event: 'mouseover'
    }).slideshow({
        interval: 10000,
        autoplay: true
    });
});

/* Initialize scrolling tech logos at the bottom of the page */
$(function () {
    $("div.techlogoscroller").smoothDivScroll({ autoScroll: "onstart", autoScrollDirection: "endlessloopright", autoScrollStep: 1, autoScrollInterval: 30, startAtElementId: "startAtMe", visibleHotSpots: "always" });
});

/* Initialize image with description hover effect */
$(window).load(function () {
    //for each description div...
    $('div.image_with_hover_description div.description').each(function () {
        //...set the opacity to 0...
        $(this).css('opacity', 0);
        //..set width same as the image...
        $(this).css('width', $(this).siblings('img').width());
        //...get the parent (the wrapper) and set it's width same as the image width... '
        $(this).parent().css('width', $(this).siblings('img').width());
        //...set the display to block
        $(this).css('display', 'block');
    });

    $('div.image_with_hover_description').hover(function () {
        //when mouse hover over the wrapper div
        //get it's children elements with class descriptio
        //and show it using fadeTo
        $(this).children('.description').stop().fadeTo(500, 0.7);
    }, function () {
        //when mouse out of the wrapper div
        //use fadeTo to hide the div
        $(this).children('.description').stop().fadeTo(500, 0);
    });

});

/* Facebook like us button */
(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));

/* Google+ button */
window.___gcfg = { lang: 'en-GB' };

(function () {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();

/* Initialize Twitter follow us */
!function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs");
