function pageLoaders () {
	var p = new Portfolio();
	p.setBG(firstBG);
	var c = new Contact();
} 

/* -----------------------------------------------------------*/
/*  Contact                                                   */
/* -----------------------------------------------------------*/
function Portfolio () {
	this.currentLink = YAHOO.util.Dom.get('selected')
	this.currentProj = YAHOO.util.Dom.getElementsByClassName('proj-selected', 'table', 'proj-content')[0];
	this.navLinks = YAHOO.util.Dom.get('nav-list').getElementsByTagName('a');
	this.normLink = YAHOO.util.Dom.get('norm-link').getElementsByTagName('a');
	this.projLink = YAHOO.util.Dom.get('proj-link').getElementsByTagName('a');
	this.ectjLink = YAHOO.util.Dom.get('ectj-link').getElementsByTagName('a');
	this.MACFF = (navigator.platform.toLowerCase().indexOf('mac') > -1 && navigator.userAgent.toLowerCase().indexOf('firefox') > -1);
	
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('noonlogo'), 'click', this.showProject, [this, null, true], true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('noonpayoff'), 'click', this.showProject, [this, null, true], true);
	YAHOO.util.Event.addListener(YAHOO.util.Dom.get('noonpayoff2'), 'click', this.showProject, [this, null, true], true);
	for (var i = 0; i < this.navLinks.length; i++) {
		YAHOO.util.Event.addListener(this.navLinks[i], 'click', this.showProject, [this, this.navLinks[i]], true);
	}
	for (var i = 0; i < this.normLink.length; i++) {
		YAHOO.util.Event.addListener(this.normLink[i], 'click', this.showProject, [this, this.normLink[i]], true);
	}
	for (var i = 0; i < this.projLink.length; i++) {
		YAHOO.util.Event.addListener(this.projLink[i], 'click', this.showProject, [this, this.projLink[i]], true);
	}
	for (var i = 0; i < this.ectjLink.length; i++) {
		YAHOO.util.Event.addListener(this.ectjLink[i], 'click', this.showProject, [this, this.ectjLink[i]], true);
	}
}
Portfolio.prototype.showProject = function (e, args) {
	var base = args[0];
	var link = args[1];
	var noon = args[2];
	
	if (noon) {
		if (base.currentProj) YAHOO.util.Dom.removeClass(base.currentProj, 'proj-selected');
		if (base.currentLink) base.currentLink.id = '';
		base.currentProj = YAHOO.util.Dom.get('proj-noon');
		YAHOO.util.Dom.addClass(base.currentProj, 'proj-selected');
		base.setBG('bg/noon.jpg');
		return;
	}
	/* update link */
	if (base.currentLink) base.currentLink.id = '';
	link.parentNode.id = 'selected';
	base.currentLink = link.parentNode;
	/* update projectinfo */
	if (base.currentProj) YAHOO.util.Dom.removeClass(base.currentProj, 'proj-selected');
	base.currentProj = YAHOO.util.Dom.get('proj-' + link.id);
	YAHOO.util.Dom.addClass(base.currentProj, 'proj-selected');
	/* loadImages */
	base.loadImages(base.currentProj);
	/* update bg */
	base.setBG('bg/' + link.id + '.jpg');
	
	return false;
}
Portfolio.prototype.loadImages = function (projDom) {
	var img;
	var entries = YAHOO.util.Dom.getElementsByClassName('proj-img', 'div', projDom);
	for (var i = 0; i < entries.length; i++) {
		while (entries[i].firstChild) {entries[i].removeChild(entries[i].firstChild)}
		img = document.createElement('img');
		img.src = entries[i].title;
		entries[i].appendChild(img);
	}
}
Portfolio.prototype.setBG = function (img) {
	if (this.MACFF) {
		YAHOO.util.Dom.get('bg').innerHTML = '<img src="' + img + '" />';
	} else {
		var so = new SWFObject("static/flash/NoonBG.swf?bg=" + img, "nb", "100%", "100%", "8", "#ffffff");
		so.addParam("wmode", "opaque");
		so.write("bg");
	}
}

/* -----------------------------------------------------------*/
/*  Contact                                                   */
/* -----------------------------------------------------------*/
function Contact () {
	this.POS_OPEN = 651;
	this.POS_CLOSED = 351;
	this.but = YAHOO.util.Dom.get('contact-link');
	this.DOMContainer = YAHOO.util.Dom.get('contact');
	this.opened = false;
	if (this.but && this.DOMContainer) {
		YAHOO.util.Event.addListener(YAHOO.util.Dom.get('contact-link'), 'click', this.toggle, this, true);
	}
}
Contact.prototype.toggle = function () {
	if (this.opened) {
		this.animateClose();
		this.opened = false;
	} else {
		this.animateOpen();
		this.opened = true;
	}
}
Contact.prototype.animateOpen = function () {
	var attributes = {
		left: { to: this.POS_OPEN }
	}
	anim = new YAHOO.util.Motion(this.DOMContainer, attributes,.3, YAHOO.util.Easing.easeOut);
	anim.animate();
	YAHOO.util.Dom.addClass(this.but, 'contact-link-selected');
}
Contact.prototype.animateClose = function () {
	var attributes = {
		left: { to: this.POS_CLOSED }
	}
	anim = new YAHOO.util.Motion(this.DOMContainer, attributes,.3, YAHOO.util.Easing.easeOut);
	anim.animate();
	YAHOO.util.Dom.removeClass(this.but, 'contact-link-selected');
}
