//generic functions for use by RelBehavior instances … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …
/*var windowStatus = {
	storedStatus : '',
	setToTitle : function(){
		windowStatus.store();
		window.status = this.title;
		return true;
	},
	store : function(){
		this.storedStatus = window.status;
	},
	restore : function(){
		window.status = windowStatus.storedStatus;
	}
}*/


//assignRelBehaviors … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …
function assignRelBehaviors(){
	var a, aRels;
	for (var i = 0; (a = document.links[i]); i++) {
		if (!a.rel) continue;
		aRels = a.rel.split(' ');
		for(var rel in aRels){
			var behavior = eval(aRels[rel]);
			if(behavior && behavior.constructor == RelBehavior){
				behavior.assign(a, aRels[rel]);
			}
		}
	}
}


//RelBehavior constructor … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …
function RelBehavior(){
	this.eventHandlers = new Object();
}
RelBehavior.prototype.assign = function(a, rel){
	for(var h in this.eventHandlers){
		a[h] = this.eventHandlers[h];
	}
}
RelBehavior.prototype.setup = function(initObj){
	for(var i in initObj){
		this[i] = initObj[i];
	}
}


//RelBehavior instances … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … … …

var portfolioImage = new RelBehavior();
portfolioImage.lastWin = 'foo';
portfolioImage.eventHandlers.onclick = function(){
	if(portfolioImage.lastWin != 'foo') portfolioImage.lastWin.close();
	portfolioImage.lastWin = window.open(this.href, 'window_largeView', 'width=610,height=460,resizable,left=0,top=0');
	return false;
}
//largeView.eventHandlers.onmouseover = windowStatus.setToTitle;
//largeView.eventHandlers.onmouseout = windowStatus.restore;

/*
var portfolioImage = new RelBehavior();
portfolioImage.assign = function(a, rel){
	a.swapImg = document.images["portfolioLargeView"];
	//a.swapImg = document.getElementById("portfolioLargeView");
	for(var h in this.eventHandlers){
		a[h] = this.eventHandlers[h];
	}
}

portfolioImage.eventHandlers.onclick = function(){
	this.swapImg.src = this.href;
	window.scrollTop = window.location + '#portfolioImage';
	return false;
}*/