// JavaScript Document


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
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";
 }
}
function matchColumns(){ 
  if(document.getElementsByTagName){ 
	 var divs,contDivs,maxHeight,divHeight,d; 
	
     // get all <div> elements in the document 
   divs=document.getElementsByTagName('div'); 
   contDivs=[]; 
   // initialize maximum height value 
   maxHeight=0; 
   // iterate over all <div> elements in the document 
   for(var i=0;i<divs.length;i++){ 
        // make collection with <div> elements with class attribute 'container' 
        if(/\bcolumn\b/.test(divs[i].className)){ 
              d=divs[i]; 
              contDivs[contDivs.length]=d; 
              // determine height for <div> element 
              if(d.offsetHeight){ 
                   divHeight=d.offsetHeight; 					
              } 
              else if(d.style.pixelHeight){ 
                   divHeight=d.style.pixelHeight;					 
              } 
              // calculate maximum height 
              maxHeight=Math.max(maxHeight,divHeight); 
        } 
   } 
   // assign maximum height value to all of container <div> elements 
   for(var i=0;i<contDivs.length;i++){ 
        contDivs[i].style.height=maxHeight + "px"; 
   } 

} 
}
function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
addLoadEvent(domRollover);
addLoadEvent(externalLinks);
addLoadEvent(matchColumns);
var openedWindow;

function openWindow(winURL) {
 // openedWindow = window.open('slideshow/slideshow.html');
 openedWindow = window.open(winURL,"whitneycollinsslideshow","width=850,height=700");
}

