var commentFormMoving=false;
Event.addBehavior({
  '.projectjump:click' : function(e) {
		l = this.id.split('-', 1);
		new Effect.ScrollTo(l[0], { duration: .5, offset: -50, transition: Effect.Transitions.sinoidal });
		return false;		
  }, 
  '.up:click' : function(e) {
	new Effect.ScrollTo('top-anchor', { duration: .5, offset: -50 });
	return false;		
  }, 
  '#add-comment:click' : function(e) {
	Effect.BlindDown('comment-form', {duration: .2});
	this.hide();
	$('cancel-comment').show();
	return false;		
  },
  '#cancel-comment:click' : function(e) {
	  Effect.BlindUp('comment-form', {duration: .2});
	this.hide();
	$('add-comment').show();
	return false;		
  },
  '.blog-rollover:mouseover' : function(e) {
	  showInfo(this.id);
	  return false;		
  } 
});
	

var stop_event = function(e){
	if (e.stopPropagation){
		e.stopPropagation();
		e.preventDefault();
	} else {
		e.returnValue = false;
		e.cancelBubble = true;
	}
	return false;
};

Event.onReady(function() {
	if(!$('isHome')) {
		currentHeight = Element.getHeight('fudge');	
		windowHeight = document.documentElement.clientHeight;
		gap = windowHeight + (currentHeight)-490;
		Element.setStyle('fudge', {height:gap+'px'} );
	}
	if($('bgsbigchip')) {
	 rotateAwardScreens();	
	}
	if($('web-landing')) {
	 rotateLandingScreens();
	}
	if($('comment-form')) {
		 $('comment-form').hide();
	}
	if($('home-poster-rotation')) {
		startLooper();
	}
});

function showInfo(who) {
	switch (who)
	{
	case "dave":
	  $('other-blog-names').className = 'dave-grey';
	  $('detail').innerHTML = 'Managing Director';
	  break
	case "andy":
	  $('other-blog-names').className = 'andy-grey';
	  $('detail').innerHTML = 'Project Director';
	  break
	case "gavin":
	  $('other-blog-names').className = 'gavin-grey';
	  $('detail').innerHTML = 'Creative';
	  break	 
	case "chris":
	  $('other-blog-names').className = 'chris-grey';
	  $('detail').innerHTML = 'Creative';
	  break	
	case "robin":
	  $('other-blog-names').className = 'robin-grey';
	  $('detail').innerHTML = 'Creative Director';
	  break	
	case "davea":
	  $('other-blog-names').className = 'davea-grey';
	  $('detail').innerHTML = 'Marketing Director';
	  break	
	case "phil":
	  $('other-blog-names').className = 'phil-grey';
	  $('detail').innerHTML = 'Technical Director';
	  break		  
	  
	}	
}
