﻿var img = new Array();
var path = 'images/category/';

if(document.images)
{
     img[0] = new Image();
     img[0].src = path + 'best-commercial-web-leaves_03.png';
     img[1] = new Image();
     img[1].src = path + 'best-non-commercial-website_03.png';
     img[2] = new Image();
     img[2].src = path + 'best-mobile-or-wireless_03.png';
     img[3] = new Image();
     img[3].src = path + 'best-digital-advertising_03.png';
     img[4] = new Image();
     img[4].src = path + 'best-digital-video_03.png';
     img[5] = new Image();
     img[5].src = path + 'best-social-media_03.png';
     img[6] = new Image();
     img[6].src = path + 'best-e-learning-product_03.png';
     img[7] = new Image();
     img[7].src = path + 'best-game_03.png';
     img[8] = new Image();
     img[8].src = path + 'best-tv-or-film_03.png';
     img[9] = new Image();
     img[9].src = path + 'best-design_03.png';
     img[10] = new Image();
     img[10].src = path + 'best-in-innovation_03.png';
     img[11] = new Image();
     img[11].src = path + 'best-in-aboriginal_03.png';
     img[12] = new Image();
     img[12].src = path + 'best-entrepreneur_03.png';
     img[13] = new Image();
     img[13].src = path + 'best-mobile-or-wireless_03.png';
     img[14] = new Image();
     img[14].src = path + 'best-entrepreneur_03.png';
}

var oldDiv;
var oldIndex = -1;

function changeCat(index)
{
    if(index != oldIndex)
    {
    var divParent;
    //alert(document.getElementById("bckImage"));
    var imgDiv = document.getElementById("bckImage");
    //document.images["bckImage"];
    //var imgDiv = document.images[5];
    var newDiv = document.getElementById("d"+index);
   // alert(imgDiv.style.backgroundImage);
    
    newDiv.style.visibility = 'visible';
    newDiv.style.display = 'block';
    
    if(oldDiv != null)
    {
        oldDiv.style.visibility = 'hidden';
        oldDiv.style.display = 'none';
    }
    oldDiv = newDiv;
    oldIndex = index;
    
    document.images.namedItem('bckImage').src = img[index].src;
    
    //var imgNew = document.createElement('img');
    //imgNew.src = img[index].src;
    
    //divParent = imgDiv.parentNode;
    //divParent.replaceChild(imgNew,imgDiv);
    //imgDiv = null;
    //imgDiv.setAttribute(src,img[index].src);
    //document.bckImage.src = img[index].src;
    //document.images['bckImage'].src = img[index].src;
    //addReflections();
   }
}