var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

function showImg(i, name) {
        var b = document.getElementById(name);
        b.src = i;
        if (interior == 1) {
            document.getElementById("interior360container").style.display="none";
            document.getElementById("mainImageFrame").style.display="block";
            interior=0;
        }
        if (exterior == 1) {
            document.getElementById("exterior360container").style.display="none";
            document.getElementById("mainImageFrame").style.display="block";
            exterior=0;
        }
}
function findImageIndex() {
    for (ind in image) {
        if (image[ind] == document.getElementById("highlight_main").src) {
            return ind;
        } else {
            url=image[ind];
            url=url.replace(/\ /,"%20");
            if (url == document.getElementById("highlight_main").src) {
                return ind;
            }
        }
    }
    return -1;
}
function imageCount() {
    var count=0;
    for (ind in image) {
        count++;
    }
    return count;
}
function previousImage() {
    var index=findImageIndex();
    if (index != -1) {
        if (index == 0) {
            index=imageCount()-1;
        } else {
            index--;
        }
        setTimeout('document.getElementById("highlight_main").src=image['+index+']',1);
    }
}
var playId;
function nextImage() {
    var index=findImageIndex();
    if (index != -1) {
        if (index == (imageCount()-1)) {
            index=0;
        } else {
            index++;
        }
        setTimeout('document.getElementById("highlight_main").src=image['+index+']',1);
        setTimeout('document.getElementById("pane_anchor").href=dest['+index+']',1);
    }
}
function play() {
    clearInterval(playId);
    playId=setInterval("nextImage()", 4000);
}
function playAndFix(obj,img) {
    obj.style.color="#FFFFFF";
    document.getElementById(img).width="108";
    document.getElementById(img).height="59";
	if (isIE6) {
		obj.style.marginLeft="40px";
	} else {
    document.getElementById(img).style.marginTop="0px";
    document.getElementById(img).style.marginLeft="0px";
    document.getElementById(img).style.marginRight="0px";
	}
    play();
}
function stop() {
    clearInterval(playId);
}
function stopAndHighlight(ind,obj,img) {
    stop();
    document.getElementById("highlight_main").src=image[ind];
    document.getElementById("pane_anchor").href=dest[ind];
    obj.style.color="#C00000";
    document.getElementById(img).width="122";
    document.getElementById(img).height="66";
	if (isIE6) {
		if (img=='pane_one') { obj.style.marginLeft="33px"; } else { obj.style.marginLeft="26px"; }
	} else {
    document.getElementById(img).style.marginTop="-7px";
    document.getElementById(img).style.marginLeft="-7px";
    document.getElementById(img).style.marginRight="-7px";
	}
}
document.getElementById("highlight_main").src=image[0];
document.getElementById("pane_anchor").href=dest[0];
play();
