tca_events =  {
	
	sort_by_cat: function(){
		si = $('event_cat').selectedIndex;
		val = $('event_cat').options[si].value;
		window.location = '/calendar/view_by_cat/'+val;
	},

	load_details: function(id){
		new Effect.Fade('event-detail',{duration: .3,afterFinish: function(){
			new Ajax.Request('/calendar/ajax/'+id, {
				onSuccess: function(t){
					$('event-detail').update(t.responseText);
					Effect.Appear('event-detail',{duration: .6});
				}
			});
		}});
	}
	
}

around_taos =  {
	
	sort_by_cat: function(){
		si = $('event_cat').selectedIndex;
		val = $('event_cat').options[si].value;
		window.location = '/around-taos/cat/'+val;
	},

	load_details: function(id){
		new Effect.Fade('event-detail',{duration: .3,afterFinish: function(){
			new Ajax.Request('/around-taos/detail/'+id, {
				onSuccess: function(t){
					$('event-detail').update(t.responseText);
					Effect.Appear('event-detail',{duration: .6});
				}
			});
		}});
	}
	
}

sponsors =  {
	
	load_details: function(id){
		new Effect.Fade('sponsor-detail',{duration: .3,afterFinish: function(){
			new Ajax.Request('/sponsors/ajax/'+id, {
				onSuccess: function(t){
					$('sponsor-detail').update(t.responseText);
					Effect.Appear('sponsor-detail',{duration: .6});
				}
			});
		}});
	}
	
}

disciplines =  {
	
	sort_by: function(main_cat){
		
		si = $('disciplineSort').selectedIndex;
		val = $('disciplineSort').options[si].value;
		
		if(main_cat){
			window.location = '/resources/view_by_cat/'+main_cat+'/'+val;
		}else{
			window.location = '/resources/view_by_cat/'+val;
		}
		
	}
	
}

/* swap function to show detailed event in CALENDAR */

function swapDetailedEvent(event_id){
	var curHtml = "<div class='event-detail'>" + $('calDetail_'+event_id).innerHTML + "</div>";
 	$('leftCol').update(curHtml);
	initLightbox();
}

/* open links in new window */
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;

