﻿
function showHero(thumbnail)
{
    var img = document.getElementById('thumbnail');

    if(img !=null)
    {
        img.src=thumbnail;
    }
}

function hideHero()
{
    var img = document.getElementById('thumbnail');

    if(img !=null)
    {
        img.src="images/blank magazine cover.gif";
    }

}

function casestudysearch(media, brand, advsector) {
    document.location.href = "casestudysearch.aspx?media=" + media + "&brand=" + brand + "&advsector=" + advsector;
    return false;
}


$(function() {
    var wh = $(window).height();
    var dh = $(document).height();
    if (wh >= dh) {
//        $('div.centrePanel').height(wh - dh - 187);
    }
//    alert(dh);
});

        /*        window.onresize=positionFooter;
        window.onload=positionFooter;
        function positionFooter(){
        var winHeight = GetWinHeight();
        var docHeight = GetDocHeight();
        if(winHeight>docHeight)
        {
        var centerPanel = document.getElementById('centre-panel');
        if(centerPanel==null)
        centerPanel=document.getElementsByName('centre-panel')[0];
        if(centerPanel!=null)
        centerPanel.style.height = (winHeight-352) + "px";
        }
        var divFooter = document.getElementsByName("overlay");
        divFooter[0].style.display="block";
        }

        function GetWinHeight()
        {
        // Return the height of the visible area.
        // Assumes the document is HTML strict.
        var appVersion = navigator.appVersion;
        // Get platform
        var Platform;
        var PlatformPattern1 = /mac/i;
        var PlatformPattern2 = /windows/i;
        if(appVersion.match(PlatformPattern1))Platform="mac";
        else if(appVersion.match(PlatformPattern2))Platform="windows";
        else Platform="unknown";

        // Get browser make
        var userAgent = navigator.userAgent;
        var Browser="";
        var BrowserPattern = /(opera)|(msie)|(safari)|(firefox)/i;
        Browser = userAgent.match(BrowserPattern)[0].toLowerCase();
        if(Browser=="")Browser="mozilla";
        if((Platform=="windows" && Browser=="msie")||(Browser=="firefox")||(Browser=="opera")) return document.documentElement.clientHeight;
        else if(Platform=="mac" && Browser=="msie")	return document.body.clientHeight;
        else if(Browser=="safari") return document.documentElement.clientHeight;
        else return false;

        }
        function GetDocHeight()
        {
        // Return the height of the visible area.
        // Assumes the document is HTML strict.
        var appVersion = navigator.appVersion;
        // Get platform
        var Platform;
        var PlatformPattern1 = /mac/i;
        var PlatformPattern2 = /windows/i;
        if(appVersion.match(PlatformPattern1))Platform="mac";
        else if(appVersion.match(PlatformPattern2))Platform="windows";
        else Platform="unknown";

        // Get browser make
        var userAgent = navigator.userAgent;
        var Browser="";
        var BrowserPattern = /(opera)|(msie)|(safari)|(firefox)/i;
        Browser = userAgent.match(BrowserPattern)[0].toLowerCase();
        if(Browser=="")Browser="mozilla";
        if((Platform=="windows"&&Browser=="msie")||(Browser=="opera"))return document.documentElement.scrollHeight;
        else if((Browser=="firefox")||(Browser=="opera")) return document.documentElement.offsetHeight;
        else if(Platform=="mac"&&Browser=="msie")	return document.body.clientHeight;
        else if(Browser=="safari") return document.documentElement.scrollHeight;
        else return false;

        }
        */
        
        
    function theRotator() {
        //Set the opacity of all images to 0
        $('div#rotator ul li').css({ opacity: 0.0 });

        //Get the first image and display it (gets set to full opacity)
        $('div#rotator ul li:first').css({ opacity: 1.0 });

        //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
        setInterval('rotate()', 4500);
    }

    function rotate() {
        //Get the first image
        var current = ($('div#rotator ul li.show') ? $('div#rotator ul li.show') : $('div#rotator ul li:first'));

        //Get next image, when it reaches the end, rotate it back to the first image
        var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') : current.next()) : $('div#rotator ul li:first'));

        //Set the fade in effect for the next image, the show class has higher z-index
        next.css({ opacity: 0.0 })
	    .addClass('show')
	    .animate({ opacity: 1.0 }, 1000);

        //Hide the current image
        current.animate({ opacity: 0.0 }, 1000)
    	.removeClass('show');
    };

    $(document).ready(function() {
        //Load the slideshow
        theRotator();
    });

        