function initImgRotation() {
	// create rotating image objects here 
	// arguments: image name, rotation speed
	var rotator1 = new rotateImgObj('imgHome',5000);
	// add the images to rotate into that image object  
	rotator1.addImages("Home_3-tiered-deck.jpg","Home_Pool-and-Fence.jpg","Home_Asian-gate2.jpg","Home_Open-back-porch.jpg","Home_Yellow-back-porch.jpg");
	rotator1.rotate();
		
	rotateImgObj.start();
	}

	// If all the images you wish to display are in the same location, you can specify the path here 
	rotateImgObj.imagesPath = "Images/";

	// no need to edit code below 
	/////////////////////////////////////////////////////////////////////
	rotateImgObjs = []; // holds all rotating image objects defined
	// constructor 
	function rotateImgObj(nm,s) {
	this.speed=s; this.ctr=0; this.timer=0;  
	this.imgObj = document.images[nm]; // get reference to the image object
	this.index = rotateImgObjs.length; rotateImgObjs[this.index] = this;
	this.animString = "rotateImgObjs[" + this.index + "]";
	}

	rotateImgObj.prototype = {
	addImages: function() { // preloads images
		this.imgObj.imgs = [];
		for (var i=0; arguments[i]; i++) {
		this.imgObj.imgs[i] = new Image();
		this.imgObj.imgs[i].src = rotateImgObj.imagesPath + arguments[i];
		}
	},

	rotate: function() {
		if (this.ctr < this.imgObj.imgs.length-1) this.ctr++;
		else this.ctr = 0;
		this.imgObj.src = this.imgObj.imgs[this.ctr].src;
	}
	}

	// sets up rotation for all defined rotateImgObjs
	rotateImgObj.start = function() {
	for (var i=0; i<rotateImgObjs.length; i++) 
		rotateImgObjs[i].timer = setInterval(rotateImgObjs[i].animString + ".rotate()", rotateImgObjs[i].speed);                     
	}

	function showHomePopup(filename, linkUrl)
	{
		popUp("HomePagePopup.aspx?filename=" + filename + "&linkurl=" + linkUrl, 275,265);
		}

function KeyPressFunction(buttonType)
{
	if (event.keyCode == 13) 
	{ 
		if (buttonType == "Login")
		{
			document.forms[0].btnLogin.click(); 
			event.returnValue = false;
			return false;    
		} 
		else
		{
			searchImages(buttonType);
			event.returnValue = false;
			return false;
		}
	}
}    

function searchImages(fieldName)
{
							
	if (document.forms[0].elements[fieldName].value != "")
	{
		var SearchTerm = document.forms[0].elements[fieldName].value;					
		document.location   = "GalleryImageList.aspx?searchterm=" + SearchTerm;
	}	
}
			
function popUp(url, width, height, menubar, name, top, left) 
{
	var strName
	if(!top)
	{
		if(height)
			top = (screen.height / 2 - height / 2);
		else
			top = 50;
	}
	if(!left)
	{
		if(width)
			left = (screen.width / 2 - width / 2);
		else
			left = 100;
	}
	if(name) strName = name; else strName = "popup"
	if(menubar)
		window.open(url,strName,'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
	else
		window.open(url,strName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
}


function EmailAFriend(url)
{
	popUp("EmailAFriend.aspx?url=" + url,550,400);
}
