// JavaScript Document
window.onload = loadFunctions;
window.onunload = function() {};

function loadFunctions() {
	newWinLinks();
	rolloverInit();
}

//begin new window scripts

function newWinLinks() {
	for (var i=0; i<document.links.length; i++) {
		if (document.links[i].className == "newWin") {
			document.links[i].onclick = newWindow;
		}
		else {
			document.links[i].onclick = closeWindow;
		}
	}
}

function newWindow() {

	var artWindow = window.open(this.href,"artWin"+Math.random());

	
	artWindow.focus();
	
	return false;
	
	
}

function closeWindow() {
	if (this.id == "closeWin") {
		window.close();
	}
}

//end new window scripts

//begin rollover scripts

//function rolloverSubmit() {
	//if(form.input.id == "submit") {
		//form.input.src = thisImage;
			//setupRollover(thisImage);
	//}
//}


function rolloverInit() {
	for(var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A");
		//while (document.links[i].className == "rollOver") {
			setupRollover(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 + "_over.jpg";
	thisImage.onmouseover = rollOver;
}


function rollOver() {
	this.src = this.overImage.src;
}


function rollOut() {
	this.src = this.outImage.src;
}
// JavaScript Document