function setCollectionsHighlightsHeights(){
	//container = document.getElementById("collectionshighlights");
	if (document.getElementById("collectionshighlights")){
		// set variables for three sections of the div
		headHeight=0
		infoHeight=0
		linkHeight=0
		//find divs
		divs = document.getElementById("collectionshighlights").getElementsByTagName("div");
		//loop through divs once to find the highest instances
		for (i=0; i<divs.length; i++){
			if (divs[i].className.indexOf("highlight")!=-1){
				//currentHeadHeight = divs[i].getElementsByTagName("h2")[0].offsetHeight
				//if (currentHeadHeight > headHeight){
				//	headHeight = currentHeadHeight;
				//}
				currentInfoHeight = divs[i].getElementsByTagName("div")[0].offsetHeight
				if (currentInfoHeight > infoHeight){
					infoHeight = currentInfoHeight;
				}
				currentLinkHeight = divs[i].getElementsByTagName("div")[2].offsetHeight
				if (currentLinkHeight > linkHeight){
					linkHeight = currentLinkHeight;
				}
			}
		}
		//loop through divs again to set all heights to the highest values
		for (i=0; i<divs.length; i++){
			if (divs[i].className.indexOf("highlight")!=-1){
				if (divs[i].className.indexOf("single")==-1){
					//divs[i].getElementsByTagName("p")[0].style.height=headHeight + "px"
					divs[i].getElementsByTagName("h2")[0].style.height=infoHeight + "px"
					divs[i].getElementsByTagName("p")[1].style.height=linkHeight + "px"
				}
			}
		}
	}
	
	if (document.getElementById("highlight-list")){
		// set variables for three sections of the div
		headHeight=0
		infoHeight=0
		linkHeight=0
		//find divs
		divs = document.getElementById("highlight-list").getElementsByTagName("div");
		//loop through divs once to find the highest instances
		for (i=0; i<divs.length; i++){
			if (divs[i].className.indexOf("highlights")!=-1){
				//currentHeadHeight = divs[i].getElementsByTagName("p")[0].offsetHeight
				//if (currentHeadHeight > headHeight){
				//	headHeight = currentHeadHeight;
				//}
				currentInfoHeight = divs[i].getElementsByTagName("h2")[0].offsetHeight
				if (currentInfoHeight > infoHeight){
					infoHeight = currentInfoHeight;
				}
				currentLinkHeight = divs[i].getElementsByTagName("p")[1].offsetHeight
				if (currentLinkHeight > linkHeight){
					linkHeight = currentLinkHeight;
				}
			}
		}
		//loop through divs again to set all heights to the highest values
		for (i=0; i<divs.length; i++){
			if (divs[i].className.indexOf("highlights")!=-1){
				//divs[i].getElementsByTagName("p")[0].style.height=headHeight + "px"
				divs[i].getElementsByTagName("h2")[0].style.height=infoHeight + "px"
				divs[i].getElementsByTagName("p")[1].style.height=linkHeight + "px"
			}
		}
	}
}

function setHovers() { 
			//this function is for the hover on all links by which they all have underlines when one is hovered
			var elem = document.getElementsByTagName('DIV');
			for(var i = 0; i < elem.length; i++)
			{
				//this is for the tourlist page
				if (elem[i].className == 'highlights d')		
				{
						elem[i].onmouseover = function(){this.className = "highlights dh";};
						elem[i].onmouseout = function(){this.className = "highlights d";};
				}
				else if (elem[i].className == 'highlights right d')
				{
						elem[i].onmouseover = function(){this.className = "highlights right dh";};
						elem[i].onmouseout = function(){this.className = "highlights right d";};	
				}
				//this is for the highlights page
				else if (elem[i].className == 'highlight d')		
				{
						document.getElementById("leftHighlight").onmouseover = function(){this.className = "highlight dh";};
						document.getElementById("leftHighlight").onmouseout = function(){this.className = "highlight d";};
						document.getElementById("middleHighlight").onmouseover = function(){this.className = "highlight dh";};
						document.getElementById("middleHighlight").onmouseout = function(){this.className = "highlight d";};
						document.getElementById("rightHighlight").onmouseover = function(){this.className = "highlight right dh";};
						document.getElementById("rightHighlight").onmouseout = function(){this.className = "highlight right d";};
					if (document.getElementById("LatestTourSingle") != -1) {
						document.getElementById("LatestTourSingle").onmouseover = function(){this.className = "highlight single dh";};
						document.getElementById("LatestTourSingle").onmouseout = function(){this.className = "highlight single d";};
					}
					if (document.getElementById("LatestTourRight") == -1) {
						document.getElementById("LatestTourRight").onmouseover = function(){this.className = "highlight right dh";};
						document.getElementById("LatestTourRight").onmouseout = function(){this.className = "highlight right d";};
					}
				}
				//this is for the comment detail page
				else 	if (elem[i].className == 'highlight-item highlight-item-comments d')		
				{
						elem[i].onmouseover = function(){this.className = "highlight-item highlight-item-comments dh";};
						elem[i].onmouseout = function(){this.className = "highlight-item highlight-item-comments d";};
				}
				//this is for the comment detail page
				else 	if (elem[i].className == 'highlight-item tour-items d')		
				{
						elem[i].onmouseover = function(){this.className = "highlight-item tour-items dh";};
						elem[i].onmouseout = function(){this.className = "highlight-item tour-items d";};
				}
			} 
	} 
	 
//set full screen links to open in new window
function targBlank() {
	var show = document.getElementsByTagName("a");
	for ( var j=0; j < show.length; j++ ) {
		var anchor = show[j];
		if (anchor.getAttribute("id") == "fullscreenlink")
			anchor.href = "#"
      
		}
}
window.onload = targBlank; 
	 
	 
function addLoadEvent(func) { 
  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload) { 
        oldonload(); 
      } 
      func(); 
    } 
  } 
} 

addLoadEvent(setCollectionsHighlightsHeights); 
addLoadEvent(setHovers); 
addLoadEvent(targBlank);
 