window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A" && document.images[i].className == 'roll') {
			setupRollover(document.images[i]);
		}
		if (document.images[i].parentNode.tagName == "A" && document.images[i].className == 'prod_roll') {
			setupRollover_prod(document.images[i]);
		}
	}
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/" + thisImage.id + "_on.gif";
	thisImage.onmouseover = rollOver;
}

function setupRollover_prod(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = document.getElementById('main').src;
	thisImage.onmouseout = rollOut2;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "/images/" + thisImage.id + ".jpg";
	thisImage.onmouseover = rollOver2;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollOut2() {
	document.getElementById('main').src = this.outImage.src;
}

function rollOver2() {
	document.getElementById('main').src = this.overImage.src;
}

function validategiftfindfrm() {
	if (document.giftfinderfrm.gender.value=="" && document.giftfinderfrm.age.value=="" && document.giftfinderfrm.price.value=="")
	{ alert('Please select atleast one search criteria'); return false; }
	return true;
}
