// PORTFOLIO IMAGE SWAP

// We grabbed this from 
// Rob Weychert (http://www.robweychert.com),
// who got it from
// Mr. T and Me (http://www.mrtandme.com/),
// who in turn got it from 
// DHTML Kitchen (http://www.dhtmlkitchen.com/).
// Remember, the image's name will be the same as the
// file name except without the extension (.gif/.jpg/.png)

function loadimages() {

 for (var i = 0; i < arguments.length; i++) {
	 var temp = makeId(arguments[i]);
	 eval(temp +"= new Image()");
	 eval(temp+".src ='"+ arguments[i] +"'");

 }
}

// used above

function makeId(path) {
	return path.substring(path.lastIndexOf("/")+1, path.lastIndexOf("."));
}

// swap used for gallery

function swap(id, newimg) {
	var me = document.getElementById(id);	
	me.src = newimg.src;
}

// DROP DOWN MENUS

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// OPEN IN NEW WINDOW

window.onload = function() {
    var links = document.getElementsByTagName('a');
    for (var i=0;i < links.length;i++) {
        if (links[i].className == 'new-window') {
            links[i].onclick = function() {
                window.open(this.href);
                return false;
            };
        }
    }
};