var imageRestoreDelay=500;
var topTimeOn = null;
var bottomTimeOn = null;

var topImageTotal = 13;
var bottomImageTotal = 12;

var topRndmNbr = (Math.round(Math.random()*(topImageTotal-1)+1));
	if (topRndmNbr<10) {
		var topImageNbr = "0" + topRndmNbr;
	}
	else {
		var topImageNbr = topRndmNbr;
}
var bottomRndmNbr = (Math.round(Math.random()*(bottomImageTotal-1)+1));
	if (bottomRndmNbr<10) {
		var bottomImageNbr = "0" + bottomRndmNbr;
	}
	else {
		var bottomImageNbr = bottomRndmNbr;
}

if (location.href.indexOf("gallery01")!= -1) {
	var topImageMenuBlur = new Image();
	topImageMenuBlur.src = "../../gallery/images/menu_bg.gif";
	var topImage = new Image();
	topImage.src = "../../gallery/images/gallery_top01.jpg";
	var topImageBlur = new Image();
	topImageBlur.src = "../../gallery/images/gallery_top01_blur.jpg";
	var bottomImageMenuBlur = new Image();
	bottomImageMenuBlur.src = "../../gallery/images/menu_bg.gif";
	var bottomImage = new Image();
	bottomImage.src = "../../gallery/images/gallery_bottom01.jpg";
	var bottomImageBlur = new Image();
	bottomImageBlur.src = "../../gallery/images/gallery_bottom01_blur.jpg";
	}
else if (location.href.indexOf("plans")!= -1) {
	var topImageMenuBlur = new Image();
	topImageMenuBlur.src = "../../tt1/images/menu_bg.gif";
	var topImage = new Image();
	topImage.src = "../../tt1/images/plans_site.gif";
	var topImageBlur = new Image();
	topImageBlur.src = "../../tt1/images/plans_site_blur.gif";
	var bottomImageMenuBlur = new Image();
	bottomImageMenuBlur.src = "../../tt1/images/menu_bg.gif";
	var bottomImage = new Image();
	bottomImage.src = "../../tt1/images/plans_floor.gif";
	var bottomImageBlur = new Image();
	bottomImageBlur.src = "../../tt1/images/plans_floor_blur.gif";
	}
else if (location.href.indexOf("mapDirections")!= -1) {
	var topImageMenuBlur = new Image();
	topImageMenuBlur.src = "../../contact/images/menu_bg.gif";
	var topImage = new Image();
	topImage.src = "../../contact/images/map_top.gif";
	var topImageBlur = new Image();
	topImageBlur.src = "../../contact/images/map_top_blur.gif";
	var bottomImageMenuBlur = new Image();
	bottomImageMenuBlur.src = "../../contact/images/menu_bg.gif";
	var bottomImage = new Image();
	bottomImage.src = "../../contact/images/map_bottom.gif";
	var bottomImageBlur = new Image();
	bottomImageBlur.src = "../../contact/images/map_bottom_blur.gif";
	}
else {
	var topImageMenu = new Image();
	topImageMenu.src = "../../images/image_top_menu" + topImageNbr + ".jpg";
	var topImageMenuBlur = new Image();
	topImageMenuBlur.src = "../../images/image_top_menu" + topImageNbr + "_blur.jpg";
	var topImage = new Image();
	topImage.src = "../../images/image_top_main" + topImageNbr + ".jpg";
	var topImageBlur = new Image();
	topImageBlur.src = "../../images/image_top_main" + topImageNbr + "_blur.jpg";
		
	var bottomImageMenu = new Image();
	bottomImageMenu.src = "../../images/image_bottom_menu" + bottomImageNbr + ".jpg";
	var bottomImageMenuBlur = new Image();
	bottomImageMenuBlur.src = "../../images/image_bottom_menu" + bottomImageNbr + "_blur.jpg";
	var bottomImage = new Image();
	bottomImage.src = "../../images/image_bottom_main" + bottomImageNbr + ".jpg";
	var bottomImageBlur = new Image();
	bottomImageBlur.src = "../../images/image_bottom_main" + bottomImageNbr + "_blur.jpg";
}
	


function loadImages() {
	document.write("\t\t<table width='379' border='0' cellpadding='0' cellspacing='0' class='tableImagesTop'>\r\t\t\t<tr>\r\t\t<td width='379' height='27' background='" + topImageMenuBlur.src + "' name='topImageMenu' id='topImageMenu'>\r\t\t\t\t\t<div id='topMenuPos' style='position:relative; width:379px; height:27px;'>\r\t\t\t\t\t<img src='../../images/1dot.gif' width='379px' height='27px' /></div></td>\r\t</tr>\r\t<tr>\r\t\t<td width='379' height='211' align='left' valign='top'><img src='" + topImage.src + "' name='topImage' width='379' height='211' id='topImage' /></td>\r\t</tr>\r\t</table>\r\t<img src='../../images/1dot.gif' width='379' height='20' />\r\t<table width='379' border='0' cellpadding='0' cellspacing='0' class='tableImagesBottom'>\r\t\t\t<tr>\r\t\t<td width='379' height='27' background='" + bottomImageMenuBlur.src + "'  name='bottomImageMenu' id='bottomImageMenu'>\r\t\t\t\t\t<div id='bottomMenuPos' style='position:relative; width:379px; height:27px;'>\r\t\t\t\t\t<img src='../../images/1dot.gif' width='379px' height='27px' /></div></td>\r\t</tr>\r\t<tr>\r\t\t<td width='379' height='211' align='left' valign='top'><img src='" + bottomImage.src + "' name='bottomImage' width='379' height='211' id='bottomImage' /></td>\r\t</tr>\r\t </table>");	
}

function blurTopImage() {
	document.images["topImage"].src = topImageBlur.src;
}

function blurBottomImage() {
	document.images["bottomImage"].src = bottomImageBlur.src;
}

function restoreTopImageTimer() {
	topTimeOn = setTimeout("restoreTopImage()",imageRestoreDelay);
}

function restoreBottomImageTimer() {
	bottomTimeOn = setTimeout("restoreBottomImage()",imageRestoreDelay);
}

function restoreTopImage() {
	document.images["topImage"].src = topImage.src;
}

function restoreBottomImage() {
	document.images["bottomImage"].src = bottomImage.src;
}

function showLargeImage(title, imageNbr, height, width) {
	largeImageWindow = window.open('','largeImage','width=' + width + ',height=' + height + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,background=black');
	largeImageWindow.document.write('<html><title>Corra Villa images</title><body leftmargin="0" marginheight="0" marginwidth="0" topmargin="0"  onBlur="window.close()"><img src="../images/01_' + imageNbr + '.jpg" width=' + width + ' height=' + height + '></body></html>');
}

