﻿// JScript File

    function ShowMyImage(MyImageIndex, MyHref)
    {
                  
        //if there is only one image in the array don't bother
        if(CommunityPhotos.length>1){
            
            ModelHighlightImageNode = document.getElementById("ModelHighlightImage");         
            ModelHighlightImageInteriorNode = document.getElementById("ModelHighlightImageInterior");
            ModelHomeTitleNode = document.getElementById("NameOfModel");
            PhotosContainerNode = document.getElementById("PhotosContainer");
          
            var NodeToFadeDisplay = ModelHighlightImageInteriorNode.style.display;
            var NodeForBackgroundChange = "";
            
            //find out which div will be displayed      
            if (NodeToFadeDisplay!='none'){
                NodeForBackgroundChange = ModelHighlightImageNode
            }else{
                NodeForBackgroundChange = ModelHighlightImageInteriorNode                  
            }
            
            //change the background image for the div that is about to be displayed 
            
            BackgroundChange = "#fff url('" + CommunityPhotos[MyImageIndex] + "') no-repeat " + CommunityPhotosPlacment[MyImageIndex];  
            NodeForBackgroundChange.style.background = BackgroundChange
            
            //Only toggle the interior div  
            Effect.toggle(ModelHighlightImageInteriorNode);
              
            ModelHomeTitleNode.innerHTML = CommunityPhotosTitles[MyImageIndex];
            
            hrefNodeList = PhotosContainerNode.getElementsByTagName("a");
            
            for(i=0;i<hrefNodeList.length;i++){                
                hrefNodeList.item(i).className = "";
            }
            
            MyHref.className = "ModelHomePhoto"; 
          }
                     
      }
      
