<!--
//set up an object

function wopen(url, name, w, h)
{
	w += 32;
	h += 96;
	 var win = window.open(url,
	  name,
	  'width=' + w + ', height=' + h + ', ' +
	  'location=no, menubar=no, ' +
	  'status=no, toolbar=no, scrollbars=no, resizable=no');
	 win.resizeTo(w, h);
	 win.focus();
}


var Portfolio;
if (!Portfolio) Portfolio = {};
if (!Portfolio.linkedHover) Portfolio.linkedHover = {};

Portfolio.linkedHover = function (element) {

	this.attachHandlers (element);
};


Portfolio.linkedHover.prototype.attachHandlers = function (element) {
	
	//recieves a box with multiple photos inside and a particular setup for the buttons.
	var self = this;
	var theImage, theTitle;
	var divsToCheck = element.getElementsByTagName("div");	
	for (y in divsToCheck){
		if (isNaN(y)) { continue; }
		if (divsToCheck[y].tagName == "div" || divsToCheck[y].tagName == "DIV"){
			//only check divs, not any other sort of objects.
			if ( document.hasClassName(divsToCheck[y], "phase_photo")) {
				theImage = divsToCheck[y];
				this.theImage = theImage;
				theImage.addEventListener('click',function(e) { return self.hoverChanger(e); },false);
				this.theImage.addEventListener('mouseover',function(e) { return self.hoverChanger(e); },false);
				this.theImage.addEventListener('mouseout',function(e) { return self.hoverChanger(e); },false);
			} else if ( document.hasClassName(divsToCheck[y], "galleryViewerButtonLeft") || document.hasClassName(divsToCheck[y], "galleryViewerButtonRight")) {
				divsToCheck[y].addEventListener('mouseover',function(e) { e.target.style.opacity=.8; },false);
				divsToCheck[y].addEventListener('mouseout',function(e) { e.target.style.opacity=.3; },false);
			}
		} 
	}
	var spansToCheck = element.getElementsByTagName("span");	
	for (x in spansToCheck){
		if (isNaN(x)) { continue; }
		if (spansToCheck[x].tagName.toUpperCase() == "SPAN"){
			if ( document.hasClassName(spansToCheck[x], "ixd_phase_title")) {
				theTitle = spansToCheck[x].getElementsByTagName('a')[0];
				this.theTitle = theTitle;

			} 
		}
	}
}

Portfolio.linkedHover.prototype.hoverChanger = function (e) {
	if (e.type == "mouseover") {
		Portfolio.addClassName(this.theTitle, "ixd_phase_title_hovered");
	} else if (e.type == "mouseout") {
		Portfolio.removeClassName(this.theTitle, "ixd_phase_title_hovered");
	}

};

Portfolio.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};


Portfolio.addClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Portfolio.removeClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};


function openDiv(thisDiv, hiddenDivs, arrowClass) {
	/*This function opens up specified divs and closes them if they're already open

	It accepts three parameters:
	a. the container that holds all the divs that will be closed up
	b. a classname of the divs that will be closed
	c. classname of a div wherein an arrow image will be switched out.

	Use it by:
	1. Include a button such as this:
	<a name="JunctureDetails" onclick="openDiv(this.parentNode.parentNode, 'detailsDiv');">Show More</a>
	2. that shares a grandparent* div with the divs you want it to affect 
	* or whatever # of parentNodes you put
	3. Let the second parameter appear in the classname only of the divs you want to be affected
	4. TODO: Optionally, use the third - optional - parameter as a boolean switch to hide an image named "closedArrow.gif" and show one called "openedArrow.gif" in the same scope
	Copyleft Daniel Erwin DQE1.com 2010
	*/
	var divsToCheck = thisDiv.getElementsByTagName("div");
	var moreClass = arrowClass+'More';
	var lessClass = arrowClass+'Less';
	var moreDiv;
	var lessDiv; 
	for (x in divsToCheck){
		if (divsToCheck[x].tagName == "div" || divsToCheck[x].tagName == "DIV")
		{
			if (divsToCheck[x].className.indexOf(hiddenDivs) != -1) //if the classname matches
			{
				if (divsToCheck[x].style.display == "none" || divsToCheck[x].style.display == "") 
					//the second element of this "if" assumes that these divs are all set to hidden when the page loads, 
					//and lets the function work on the first click if the element's "hidden" attribute is set through CSS
				{
					//divsToCheck[x].style.visibility = "visible"; //this just makes it invisible, doesn't collapse it.
					divsToCheck[x].style.display = "block";
					//arrowBtnDiv.style.background = "url(site/nav/lessbtn.gif)";
					moreDiv.style.display = "none";
					lessDiv.style.display = "block";
					thisDiv.getElementsByTagName("input")[0].value = " Less";
				} else {
					divsToCheck[x].style.display = "none";
					//divsToCheck[x].style.visibility = "hidden";
					//arrowBtnDiv.style.background = "url(site/nav/morebtn.gif)";
					moreDiv.style.display = "block";
					lessDiv.style.display = "none";
					thisDiv.getElementsByTagName("input")[0].value = "More";
				}
			} else if (divsToCheck[x].className.indexOf(moreClass) != -1) //if it's the arrow image div
			{
				//arrowBtnDiv = divsToCheck[x];
				moreDiv = divsToCheck[x];
			}else if (divsToCheck[x].className.indexOf(lessClass) != -1) //if it's the arrow image div
			{

				//arrowBtnDiv = divsToCheck[x];
				lessDiv = divsToCheck[x];
			}
			//alert ("div["+x+"] ="+divsToCheck[x]+" and its classname="+divsToCheck[x].className+" and is it = to moreClass?"+divsToCheck[x].className.indexOf(moreClass));

		} else {
			//there are things in the list that are not divs, i.e. length...
		}
	}
}









	//start of program to change the front picture at intervals
		var randomnumber=Math.floor(Math.random()*9);
		photoname='rand/front'+randomnumber+'.jpg';
		//document.getElementByID('random_photo').src=photoname;
		//document.getElementByID('random_photo').src='rand/front2.jpg';

// -->
