$(document).ready(function(){ 

	
		$("a[rel='lightbox']").colorbox();
		
		$(".map").colorbox();
		
				
		$("#slider").easySlider();
		
	
});


// function to enable standards compliant 'rel="external"' to be used instead of 'target="_blank"' //
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";
		}
}
window.onload = externalLinks;

function openWin(theURL,winName,features, myWidth, myHeight, isCenter) {
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
		features+='toolbar=0,menubar=0,scrollbars=1,resizable=0,status=0,location=0,directories=0,copyhistory=0';
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	return false;
}

matchColumns=function(){ 
     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(/\btopmatch\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"; 
     } 
} 

matchTourColumns=function(){ 
     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(/\bbottommatch\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"; 
     } 
}



// Runs the script when page loads 
window.onload=function(){ 
     if(document.getElementsByTagName){ 
         matchColumns();
		 matchTourColumns();
		 matchNoticeColumns();
     } 
} 


//Sfhover action for ie
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent){
	window.attachEvent("onload", sfHover);
}
