function imgpopup(myHREF) {
	//alert(myHREF)	
	myHREF = "/inc/pic.asp?img=" + myHREF
	window.open(myHREF, 'imgpopup', 'width=640,height=480')
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		} else if ((anchor.getAttribute("href") && anchor.getAttribute("rel") == "imgpopup")) {
			myHREF = anchor.getAttribute("href")
			anchor.href = "javascript:imgpopup('" + myHREF + "')";
		}
	}
}
window.onload = externalLinks;

function isnumeric(strString)
// check for valid numeric strings
{
var strValidChars = "0123456789";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;

// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}

function gallerySwapIMG(src, alt) {
    //src = src.replace('/uf/gallery/', '/uf/gallery/lg/');
    document.getElementById('gallery-lg-img').src = src;
    document.getElementById('gallery-desc').innerHTML = alt;
}


function leftArrowPressed() {
    if (document.getElementById("gallery-nav-previous")) {
        window.location = document.getElementById("gallery-nav-previous").href
    }
}

function rightArrowPressed() {
   if (document.getElementById("gallery-nav-next")) {
        window.location = document.getElementById("gallery-nav-next").href
    }
}

document.onkeydown = function(evt) {
    evt = evt || window.event;
    switch (evt.keyCode) {
        case 37:
            leftArrowPressed();
            break;
        case 39:
            rightArrowPressed();
            break;
    }
};

function clearinput(thiselement) {
    document.getElementById(thiselement).value='';
    document.getElementById(thiselement).style.color = '#000000';
}
