﻿// JScript File
function attachMyEvent(obj, evType, fn){if (obj.addEventListener){obj.addEventListener(evType, fn, false);return true;} else if (obj.attachEvent){var r = obj.attachEvent("on"+evType, fn);return r;} else {return false;}}
var mapWindow;
function OpenMapWindow(lat, lng)
{
mapWindow = window.open ("Windows/SimpleGMap.aspx?lat=" + lat + "&lng=" + lng,"SimpleGMap","width=500px,height=300px,status=0,toolbar=0");
}

function HandleChangeIndex(obj)
{


}



var curindex = 0;
function InitializeImages()
{
var i;
var img = document.getElementById("imgDetail");
var lblCount = document.getElementById("NavImgCount");
    if (Images.length > 0)
    {
        lblCount.innerHTML = "Image 1 of " + Images.length;
        img.src = Images[0].src;
        
        if(img.width > img.height)
        {
        img.width = 320;
        img.height = 260;
        }
        else
        {
        img.width = 260;
        }
        
        
    }

}

function NavImage(dir)
{

    if (Images.length == 0)
    return false;


    switch(dir)
    {
        case "prev": 
        curindex = curindex -1;
        break;
        case "next": 
        curindex = curindex + 1;
        break;
    }
    
    if(curindex  < 0)
    {
        curindex = Images.length +  curindex;
    }

    if(curindex  >= Images.length)
    {
    curindex  = 0
    }
    
    var img = document.getElementById("imgDetail");
    var lblCount = document.getElementById("NavImgCount");
    lblCount.innerHTML = "Image " + (curindex +1) + " of " + Images.length;
    img.src = Images[curindex].src;

}

