/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

	// hover over for main nav
	window.addEvent('domready',function() {
	
		if ($('overview')) {
	    	    	    	    
		    // project view page
		    $$('div.projdetails')[0].setStyle('display','block');
		    $$('ul.projectsubs li').addEvent('click', function(el) {
	
				// remove at from link that has it	    	
		    	$$('ul.projectsubs li').removeClass('at');
		    	
		    	// add at to link that was clicked on.
		    	this.addClass('at');
		    	
		    	// set all projdetails to display: none
		    	$$('div.projdetails').setStyle('display', 'none');
		    	
		    	// display chosen projdetails
		    	$('p-'+this.get('id')).setStyle('display', 'block');
		    	
		    	if(this.get('id') == 'photos') {
		    		$('photogallery').setStyle('display','block');
		    		$('mainimage').setStyle('display','none');
		    	}
		    	else {
		    		if($('photogallery').getStyle('display') == 'block') $('photogallery').setStyle('display', 'none');
		    		if($('mainimage').getStyle('display') == 'none') $('mainimage').setStyle('display', 'block');
		    	}
		    	
		    });
		    
		}
		
		// scroll bars
		if ($('wn')){
			
		  if ($('lyr1').getScrollSize().y > 200){
		
			  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
			  // if horizontal scrolling, id of element containing scrolling content (table?)
			  var wndo = new dw_scrollObj('wn', 'lyr1');
			  
			  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
			  // wndo.bSizeDragBar = false;
			  
			  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
			  // (x/y offsets of dragBar in track)
			  wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
			  
			  // pass id('s) of scroll area(s) if inside table(s)
			  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
			  dw_scrollObj.GeckoTableBugFix('wn'); 
		  
		  } else {
		  
		  	$('lyr1').setStyle('visibility', 'visible');
		  	$('scrollbar').setStyle('display', 'none');
		  
		  }
	  
	    }
	  
		if ($('wnl')){
	
		  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
		  // if horizontal scrolling, id of element containing scrolling content (table?)
		  var wndo2 = new dw_scrollObj('wnl', 'lyr1l');
		  
		  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
		  // wndo.bSizeDragBar = false;
		  
		  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
		  // (x/y offsets of dragBar in track)
		  wndo2.setUpScrollbar("dragBarl", "trackl", "v", 1, 1);
		  
		  // pass id('s) of scroll area(s) if inside table(s)
		  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
		  dw_scrollObj.GeckoTableBugFix('wnl'); 
	  
	  	}

		if ($('wnr')){
			
		  if ($('wnr').getScrollSize().y > 200){
			  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
			  // if horizontal scrolling, id of element containing scrolling content (table?)
			  var wndo = new dw_scrollObj('wnr', 'lyr1r');
			  
			  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
			  // wndo.bSizeDragBar = false;
			  
			  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
			  // (x/y offsets of dragBar in track)
			  wndo.setUpScrollbar("dragBarr", "trackr", "v", 1, 1);
			  
			  // pass id('s) of scroll area(s) if inside table(s)
			  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
			  dw_scrollObj.GeckoTableBugFix('wnr'); 
		  } else {
		  
		  	$('lyr1r').setStyle('visibility', 'visible');
		  	$('scrollbarr').setStyle('display', 'none');
		  
		  }
		  		  
	  	}

		if ($('wnwhole')){
						
		  if ($('wnwhole').getScrollSize().y > 200){
			  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
			  // if horizontal scrolling, id of element containing scrolling content (table?)
			  var wndo = new dw_scrollObj('wnwhole', 'lyr1whole');
			  
			  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
			  // wndo.bSizeDragBar = false;
			  
			  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
			  // (x/y offsets of dragBar in track)
			  wndo.setUpScrollbar("dragBarwhole", "trackwhole", "v", 1, 1);
			  
			  // pass id('s) of scroll area(s) if inside table(s)
			  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
			  dw_scrollObj.GeckoTableBugFix('wnwhole'); 
		  } else {
		  
		  	$('lyr1whole').setStyle('visibility', 'visible');
		  	$('scrollbarwhole').setStyle('display', 'none');
		  
		  }
		  		  
	  	}

		if ($('my_show')) {
		    var myShow = new Slideshow('my_show', null, { delay: 2000, duration: 1000, captions: true, controller: false, loader:false });
		}
		
		// change link on gallery so that it displays slideshow if theres photos.
		if ($('gallerylink') && $('galleryoutput')) {
			// get first link in galleryoutput
			link = $('galleryoutput').getFirst('a').getProperty('href');
			title = $('galleryoutput').getFirst('a').getProperty('title');
						
			// change gallerylink link
			$('gallerylink').setProperty('href', link);
			$('gallerylink').setProperty('title', title);
		}
		
	});	

