﻿if(document.location.protocol == "https:" && !window.location.href.match("(Login|Download|Checkout|Admin|MyAccount)"))
{
    window.location = window.location.href.replace(/https/, "http");
}

//<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
var folder
switch(location.hostname)
{
    case 'www.gtycanada.org':
    case 'ca.gty.org':
        theImages[0] = '/media/headers/Canada/header-01.jpg'
        theImages[1] = '/media/headers/Canada/header-02.jpg'
        theImages[2] = '/media/headers/Canada/header-03.jpg'
        break;
    case 'www.gty.org.uk': 
    case 'eu.gty.org':
        theImages[0] = '/media/headers/Europe/header-01.jpg'
        theImages[1] = '/media/headers/Europe/header-02.jpg'
        theImages[2] = '/media/headers/Europe/header-03.jpg'
        theImages[3] = '/media/headers/Europe/header-03.jpg'
        theImages[4] = '/media/headers/Europe/header-03.jpg'
        theImages[5] = '/media/headers/Europe/header-03.jpg'
        break;
    case 'www.gracetoindia.org':
    case 'in.gty.org':
        theImages[0] = '/media/headers/India/header-01.jpg'
        theImages[1] = '/media/headers/India/header-02.jpg'
        theImages[2] = '/media/headers/India/header-03.jpg'
        theImages[3] = '/media/headers/India/header-04.jpg'
        theImages[4] = '/media/headers/India/header-05.jpg'
        theImages[5] = '/media/headers/India/header-06.jpg'
        theImages[6] = '/media/headers/India/header-07.jpg'
        break;
    default: 
        break;
}


// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));

function showImage()
{
    document.write('<img class="headerImage" src="'+theImages[whichImage]+'" border=0 width="718" height="129" alt="Welcome to Grace to You">');
}


function AudioPlayer(ID)
{
    var link = '/AudioPlayer/' + ID;
   
    window.open(link, 'AudioPlayer', 'width=550,height=220,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
}

function AudioPlayerByType(Type, ID)
{
    var link = '/AudioPlayer/' + Type + '/' + ID;
   
    window.open(link, 'AudioPlayer', 'width=550,height=220,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    return false;
}

function WatchVideo(Video)
{
    var link = '/Video/Player/' + Video;
   
    window.open(link, '', 'width=470,height=320,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    return false;   
}

function ToggleDownloadLinks(id)
{
    if(document.getElementById(id).style.display == "none")
        document.getElementById(id).style.display = "inline";
    else
        document.getElementById(id).style.display = "none";
}
