
var imgThumbs;

/* assign mouseovers to all buttons following the _off and _on convention */ 
function roller(){

	var imgs = document.getElementsByTagName("img");
	for (var i=0; img = imgs[i]; i++) {
		if ( /_sm_off/.test(img.src) || img.id == "thumbOn" ) {
			
			if ( /_sm_off/.test(img.src) ) {
			
				img.overSRC = img.src.replace("_sm_off","_sm_on");
				img.outSRC = img.src;
			}
			else {
				img.outSRC = img.src.replace("_sm_on","_sm_off");
				img.overSRC = img.src;
			}
			preLoad(img.overSRC);
			img.onmouseover=rollon;
			preLoad(img.outSRC);
		}
	}
	
	
	var childs = document.getElementById("rightCol").childNodes;
	
	for (var i=0; i < childs.length; i++) {
		if (childs[i].nodeName == "SPAN"){
			imgThumbs = childs[i].getElementsByTagName("img");
		}
	}
	
}
var loaded = new Array();

function preLoad(imgSrc) { 
	loaded[loaded.length] = new Image(); 
	loaded[loaded.length-1].src = imgSrc; 
} 



function rollon(){ 
	for (var i=0; imgThumb = imgThumbs[i]; i++) {
		if ( /_sm_on/.test(imgThumb.src) ) {
			imgThumb.src = imgThumb.src.replace("_sm_on","_sm_off");
		}
	}

	this.src = this.overSRC; 
} 

function rolloff(){ 
	//this.src = this.outSRC; 
}

function enlargeImage(dir,imgName) 
{
	newImage = new Image();
	newImage.src = "images/" + dir + "/lg/" + imgName;
	document.getElementById('popMainImage').src = newImage.src;
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";

  var regex = new RegExp( regexS );

  var results = regex.exec( window.location.href );

  if( results == null )
    return "";
  else
    return results[1];
}
