/* calendar sort and detail functionality */
calendar =  {
	
	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('feature',{duration: .3,afterFinish: function(){
			new Ajax.Request('/calendar/ajax/'+id, {
				onSuccess: function(t){
					$('feature').update(t.responseText);
					Effect.Appear('feature',{duration: .6});
				}
			});
		}});
	}
	
}

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

/* 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;

