﻿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.gty.org.au':
    case 'au.gty.org':
        theImages[0] = '/media/headers/Australia/header-01.jpg'
        theImages[1] = '/media/headers/Australia/header-02.jpg'
        theImages[2] = '/media/headers/Australia/header-03.jpg'
        theImages[3] = '/media/headers/Australia/header-04.jpg'
        break;
    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;
    case 'www.gty.org.nz': 
    case 'nz.gty.org':
        theImages[0] = '/media/headers/NewZealand/header-01.jpg'
        break;
    case 'www.gtysg.org': 
    case 'sg.gty.org':
        theImages[0] = '/media/headers/Singapore/header-01.jpg'
        break;
    case 'www.gty.org.za':
    case 'za.gty.org':
        theImages[0] = '/media/headers/SouthAfrica/header-01.jpg'
        theImages[1] = '/media/headers/SouthAfrica/header-02.jpg'
        theImages[2] = '/media/headers/SouthAfrica/header-03.jpg'
        theImages[3] = '/media/headers/SouthAfrica/header-04.jpg'
        theImages[4] = '/media/headers/SouthAfrica/header-05.jpg'
        theImages[5] = '/media/headers/SouthAfrica/header-06.jpg'
        theImages[6] = '/media/headers/SouthAfrica/header-07.jpg'
                                                        
        break;
    default: 
        theImages[0] = '/media/headers/GTY/header-01.jpg';
        theImages[1] = '/media/headers/GTY/header-02.jpg';
        theImages[2] = '/media/headers/GTY/header-03.jpg';
        theImages[8] = '/media/headers/GTY/header-04.jpg';
        theImages[7] = '/media/headers/GTY/header-06.jpg';
        theImages[6] = '/media/headers/GTY/header-07.jpg';
        theImages[5] = '/media/headers/GTY/header-08.jpg';
        theImages[4] = '/media/headers/GTY/header-09.jpg';
        theImages[3] = '/media/headers/GTY/header-10.jpg';    
        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=415,height=140,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    return false;
}

function PlayPodcast(Type, ID)
{
    var link = '/AudioPlayer/' + Type + '/' + ID;
   
    window.open(link, 'AudioPlayer', 'width=415,height=140,directories=no,location=0,menubar=no,resizable=0,scrollbars=0,status=no,toolbar=no');
    return false;
}

