var ccBehaviors = {
	Version: '1.0',
	require: function(libraryName) {
		// inserting via DOM fails in Safari 2.0, so brute force approach
		document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
	},
	load: function( ) {	
			
    	//ss
		//this.require('/scripts/jquery/jquery126.js');
		
		//ss
		//this.require('/scripts/jquery.cycle.js');
	
		//ss
		//this.require('/scripts/slideshow.js');
					
		//prototype is the core objects javascript library
		this.require('/scripts/javascript/prototype.js');		
				
		//some core carroll college functions for the cms
		this.require('/scripts/lib.js');	
		
		//anti spam takes the server-side emails and makes them usable again
		this.require('/scripts/antispam_email.js');		
		
		//pass in an arg at the end indicating to ONLY load scriptaculous effects
		this.require('/scripts/javascript/scriptaculous.js?load=effects');
		//this.require('/scripts/moo.fx.js');
		
		//lightwindow, loads pics and stuff with darker background behind
		this.require('/scripts/lightwindow/lightwindow.js');
		//this.require('/scripts/moo.fx.js');
				
		//behavior allows us to attach behaviors to classes
		this.require('/scripts/behavior/behavior.js');
		
		//ajax forms searches for all forms specified in the file and 
		//attaches the neccesary behaviors to eliminate submission and 
		//submit via ajax requests
		this.require('/scripts/ajax_forms.js');	
		
		//add live search functions to the site
		this.require('/scripts/live_search.js');
		
		//add google analytics tracking to the site
		this.require('/scripts/urchin.js');
		
		//various and sundry js scripts of randomness
		this.require('/scripts/various.js');
		
		//behavior allows us to attach behaviors to classes
		this.require('/scripts/wmvplayer.js');
				
		//when the dom loads, run this tracking code
		this.addDOMLoadEvent( 
			function(){ 
				_uacct = "UA-212750-1";
				urchinTracker(); 
			}
		);
		//create base javascript behaviors for this site
		this.addDOMLoadEvent( this.addBehaviors );			

		//create "alt" classes on alternate table rows 
		this.addDOMLoadEvent( this.tableStripe );			
	},
	addDOMLoadEvent: function(f){//(C)webreflection.blogspot.com
	var a,b=navigator.userAgent,d=document,w=window,
	c="__onContent__",e="addEventListener",o="opera",r="readyState",
	s="<scr".concat("ipt defer src='//:' on",r,"change='if(this.",r,"==\"complete\"){this.parentNode.removeChild(this);",c,"()}'></scr","ipt>");
	w[c]=(function(o){return function(){w[c]=function(){};for(a=arguments.callee;!a.done;a.done=1)f(o?o():o)}})(w[c]);
	if(d[e])d[e]("DOMContentLoaded",w[c],false);
	if(/WebKit|Khtml/i.test(b)||(w[o]&&parseInt(w[o].version())<9))
	(function(){/loaded|complete/.test(d[r])?w[c]():setTimeout(arguments.callee,1)})();
	else if(/MSIE/i.test(b))d.write(s);
	},
	addBehaviors: function(){
		if (typeof $$ != "function" ) return;
		$$('a[rel=external]').each(
			function( lnk ){
				lnk.setAttribute( "target", "_blank" );
			}
		);
	},
	tableStripe: function(){
		if( window.location.toString().indexOf("/admin") < 0 ){
			var tables = $A(document.getElementsByTagName('table'));
			tables.each( 
				function( tableObj ){
					tableObj.setAttribute('cellSpacing','0');
					//var theadExists = tableObj.getElementsByTagName('thead').length > 0;
					if( tableObj.getElementsByTagName('tr').length > 1 ){	
						$A(tableObj.getElementsByTagName('tr')).each(
							function( trObj, rowNum ){
								/*if( rowNum==0 && !theadExists){
									if(tableObj.childNodes.length > 0){
										var newThead = tableObj.insertBefore( document.createElement('thead') , tableObj.childNodes[0] );
										newThead.appendChild( trObj );
									}
								}*/						
								if( rowNum % 2 == 0 && rowNum!==0){	
									$(trObj).addClassName('alt');
								}else{
									$(trObj).removeClassName('alt');
								}
							}//end function
						);
					}//end if
				}
			);
		}//end window.location
	}	
}

ccBehaviors.load();

