﻿var sponsors = new Array();
sponsors[0] = new Object();
sponsors[0].src = 'images/sponsors/SAIT-poly-logo2.png';
sponsors[0].title = 'SAIT';
sponsors[0].href = 'http://www.sait.ca';

sponsors[1] = new Object();
sponsors[1].src = 'images/sponsors/CHRC-web_banner.gif';
sponsors[1].title = 'The Cultural Human Resources Council';
sponsors[1].href = 'http://www.culturalhrc.ca/index-e.asp';

sponsors[2] = new Object();
sponsors[2].src = 'images/sponsors/robotspencils.png';
sponsors[2].title = 'Robots & Pencils';
sponsors[2].href = 'http://www.robotsandpencils.com';

sponsors[3] = new Object();
sponsors[3].src = 'images/sponsors/mediumrare.gif';
sponsors[3].title = 'Medium Rare';
sponsors[3].href = 'http://www.mrare.ca';

sponsors[4] = new Object();
sponsors[4].src = 'images/sponsors/nextMEDIA-Banff-BlkBack_Digital_Alberta.jpg';
sponsors[4].title = 'nextMedia Banff';
sponsors[4].href = 'http://www.nextmediaevents.com/banff/';

sponsors[5] = new Object();
sponsors[5].src = 'images/sponsors/vovia-logo_web.jpg';
sponsors[5].title = 'Vovia Online Marketing';
sponsors[5].href = 'http://www.vovia.com/';

sponsors[6] = new Object();
sponsors[6].src = 'images/sponsors/ChristieColourlogo.jpg';
sponsors[6].title = 'Christie Communications';
sponsors[6].href = 'http://www.christie.ab.ca/';

sponsors[7] = new Object();
sponsors[7].src = 'images/sponsors/thunderhead_ent.jpg';
sponsors[7].title = 'Thunderhead Entertainment';
sponsors[7].href = 'http://www.thunderheadent.biz/';

sponsors[8] = new Object();
sponsors[8].src = 'images/sponsors/GamesCafe.png';
sponsors[8].title = 'Games Cafe';
sponsors[8].href = 'http://www.gamescafe.com/';

sponsors[9] = new Object();
sponsors[9].src = 'images/sponsors/AMPIALogo683.jpg';
sponsors[9].title = 'AMPIA';
sponsors[9].href = 'http://www.ampia.org/';

sponsors[10] = new Object();
sponsors[10].src = 'images/sponsors/UofL.png';
sponsors[10].title = 'University of Lethbridge';
sponsors[10].href = 'http://www.uleth.ca/';

sponsors[11] = new Object();
sponsors[11].src = 'images/sponsors/AACTI_Logo.jpg';
sponsors[11].title = 'AACTI Logo';
sponsors[11].href = 'http://www.aacti.ca';

sponsors[12] = new Object();
sponsors[12].src = 'images/sponsors/kelly_bros.png';
sponsors[12].title = 'Kelly Brothers Productions';
sponsors[12].href = 'http://www.kellybrothers.ca';

var activeAds = new Array();

var moveIncrement = 1;
var currentPosition = 0;

var currentAddIndex = 0;

function drawElement(element) {

    var sponsorBanner = document.getElementById('linkTrack');
    var sponsorBanner2 = document.getElementById('linkTrack2');
    
    var div = document.createElement('div');
    div.setAttribute('class', 'sponsorLogo');
    var a = document.createElement('a');
    var img = document.createElement('img');
    a.setAttribute('href', element.href);
    a.setAttribute('target', '_blank');
    a.setAttribute('style', 'float:left;');
    img.setAttribute('src', element.src);
    img.setAttribute('border', 0);
    img.setAttribute('title', element.title);
    img.setAttribute('alt', element.title);
    var td = document.createElement('td');
    

    var div2 = document.createElement('div');
    div2.setAttribute('class', 'sponsorLogo');
    var a2 = document.createElement('a');
    var img2 = document.createElement('img');
    a2.setAttribute('href', element.href);
    a2.setAttribute('target', '_blank');
    a2.setAttribute('style', 'float:left;');
    img2.setAttribute('src', element.src);
    img2.setAttribute('border', 0);
    img2.setAttribute('title', element.title);
    img2.setAttribute('alt', element.title);
    var td2 = document.createElement('td');
    

    a.appendChild(img);
    div.appendChild(a);
    td.appendChild(div);
    
    a2.appendChild(img2);
    div2.appendChild(a2);
    td2.appendChild(div2);

    var table0 = document.getElementById('tr0');
    var table1 = document.getElementById('tr1');

    table0.appendChild(td);
    table1.appendChild(td2);
    
    //sponsorBanner.appendChild(div);
    //sponsorBanner2.appendChild(div2);


}

function moveActiveAds() {

    var bannerWrapper = document.getElementById('bannerWrapper');
    var linkTrack = document.getElementById('linkTrack');
   // alert(bannerWrapper);
   // alert(linkTrack);
    currentPosition -= moveIncrement;
    newLeft = currentPosition + "px";

    //alert(currentPosition);
   // alert(linkTrack.clientWidth);

    if (currentPosition < (linkTrack.clientWidth * -1)) {
        currentPosition = 0;
    }
    if (!IE7) {
        bannerWrapper.setAttribute('style', 'position: relative; left: ' + newLeft);
    }
    else {
        // FOR IE7
        bannerWrapper.style.left = currentPosition + "px";
    }
}

// javascript:alert(document.getElementById('bannerWrapper').style.left);

NS4 = (document.layers) ? true : false;
IE4 = (navigator.appVersion.indexOf('MSIE 4.') == -1) ? false : true;
IE5 = (navigator.appVersion.indexOf('MSIE 5.') == -1) ? false : true;
IE6 = (navigator.appVersion.indexOf('MSIE 6.') == -1) ? false : true;
IE7 = (navigator.appVersion.indexOf('MSIE 7.') == -1) ? false : true;
IE8 = (navigator.appVersion.indexOf('MSIE 8.') == -1) ? false : true;
//ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape') == -1) ? false : true;
	
function initBanner() {
	
        
	/*	
    if(IE7)
    	    document.getElementById('sponsorBanner').style.display = 'none';
    else if(IE6)
    	    document.getElementById('sponsorBanner').style.display = 'none';
    else if(IE8)
    	    document.getElementById('sponsorBanner').style.display = 'none';
    else
    {*/
    //drawElement(sponsors[0]);
    //drawElement(sponsors[1]);
    
    for (i = 0; i < sponsors.length; i++) {
        drawElement(sponsors[i]);
    }
    var bannerWrapper = document.getElementById('bannerWrapper');
    var linkTrack = document.getElementById('linkTrack');
  //  moveActiveAds();
    //if(!IE7)
        setInterval('moveActiveAds()', 50);
    
}