if (document.getElementsByTagName && document.getElementsByClassName  ) {
	// Create a link to the Javascript-only stylesheet

	var $link_element1 = document.createElement('link');
	$link_element1.setAttribute("rel","stylesheet");
	$link_element1.setAttribute("href","/assets/templates/mulberry/css/javascript_only.css");
	$link_element1.setAttribute("media","screen");	

	// Append this stylesheet link to the document
	var $head_element = document.getElementsByTagName('head')[0];
	$head_element.appendChild($link_element1);
}



function init(){

		// Hide workshop details
		var lnx
		var lnx2
		var workshops=$$('.workshops h3'); // headings
		workshops.each(function(hdg){
			lnx=hdg.down()
			lnx.setAttribute('href', 'javascript:void(0)')  // reset links
			hdg.next(1).hide() // hide all panels			
		})
		
		
		

		
		$$('.workshops h3').each(function(h){
			
			lnx2=h.down() // get link
			lnx2.onclick=function(){
				
				if ( h.hasClassName('open') ){				

					new Effect.BlindUp( h.next(1), {duration:.7} ) // open 1
					new Effect.Fade( h.next(1), {duration:.7} ) // open 1
					h.removeClassName('open')
					h.addClassName('closed')
				} else {
					// close all open first
					$$('.workshops h3').each(function(w){
						if (w.hasClassName('open')) {
							new Effect.BlindUp( w.next(1), {duration:.2} ) // 
							new Effect.Fade( w.next(1), {duration:.2} ) // 
							w.removeClassName('open')
						}
						
					})
				



					new Effect.BlindDown( h.next(1), {duration:.7} ) // open 1
					new Effect.Appear( h.next(1), {duration:.7} ) // open 1
					h.addClassName('open')					
					
//					alert(lnx2.innerHTML + ": " + lnx2.className)

					
				
				}
				
				
				
			}
			
		})
		
		
		
		
		
		
		if ($('map_canvas') ){
			initMap(); // google map script
		}
		// rollover details for therapies
		/*
		var status
		var txt
		var heading
		var therapies=$$('.therapy');
		therapies.each( function(l){
			l.onmouseover=function(){
				if (l.next(0)){
				t=l.next(0);
				heading=l.innerHTML;
				txt=t.innerHTML;			
//				$('more').update(txt);
				
				$('moreHeading').update("<h1>" + heading + "</h1>\n" + txt);
				
				}
			}
		})
		*/
		
		var therapists=$$('.split li'); //links
		therapists.each( function(l){
			if (l.next(0)){
			var t
				t=l.next(0);
			}
		})
		
		
		//table stripe
		var tables=$$('table');
		var rows;
		var alt=true;
		tables.each(function(t){
			alt=true;
			rows=t.select('tr');
			rows.each(function(row){
				if(alt) {
					row.addClassName('alt')
				}
				alt=!alt
			})
		
		})

		
				 
				 
				 
if ($('findTherapyForm')){
		var findTherapyForm=$('findTherapyForm');
		$('findTherapyOptions').onchange = function() {
			selected=$('findTherapyOptions');
			if (selected.value==''){
				alert('Select a therapy from the dropdown list');
				return false;
			}	else{
				window.location.href=$('findTherapyOptions').value;
				return false;
			}

		}
	}
				 
				
	
// end of init
}


Event.observe(window, 'load', init, false);
//addEvent(window,'load',init)
