﻿// LHR.js
window.onload = initiateBoth;

var homeImages = new Array("Images/HomeRotate01.jpg", "Images/HomeRotate02.jpg", "Images/HomeRotate03.jpg", "Images/HomeRotate04.jpg", "Images/HomeRotate05.jpg", "Images/HomeRotate06.jpg");
							
var thisHomeImage = 0;


function initiateBoth() {

    //alert("rotateBoth: 1");

	if (document.getElementById("RotatingImages") != null)
	{
	    rotateImages();
	}
	
	openInNewWindow();

}

function rotateImages() {

    //alert("rotateImages: 1");
	thisHomeImage++;
	if (thisHomeImage == homeImages.length) {
	
		thisHomeImage = 0;
		
	}
	document.getElementById("RotatingImages").src = homeImages[thisHomeImage];
	
	setTimeout("rotateImages()", 5 * 1000);
	
}

function openInNewWindow() {

    var links = document.getElementsByTagName('a');
    for (var i=0;i < links.length;i++) {
        if (links[i].className == 'new-window') {
            links[i].onclick = function() {
                window.open(this.href);
                return false;
            };
        }
    }

}

