function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.css({'min-height': tallest});
}
function equalHeight2(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.css({'min-height': tallest});
}

$(document).ready(
	function(){
		$.fn.search = function() {
			return this.focus(function() {
				if( this.value == this.defaultValue ) {
					this.value = "";
				}
			}).blur(function() {
				if( !this.value.length ) {
					this.value = this.defaultValue;
				}
			});
		};
		// newsletter IDs
		$("#s").search();
		
		//toggle the componenet with class msg_body
 		$('.expand-result').click(function(e){
			e.preventDefault();
			
			$(this).parents('.orgentry').find('.orgresult').slideToggle(300);
			$(this).find('p').toggle();
		});
		
		
		
		equalHeight2($(".features .widget_text"));
		equalHeight2($(".features .widget"));

		equalHeight($(".content"));
		equalHeight($("#sidebar"));
	
		$('#casestudy-video').click(function(e){
			e.preventDefault();
			
			var vimeo_id = $(this).attr('href').replace('http://www.vimeo.com/', '').replace('http://vimeo.com/', '');
									
		//	$('#lightbox-content').html('<object width="640" height="512"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + vimeo_id + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff0179&amp;fullscreen=1&amp;autoplay=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=' + vimeo_id + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff0179&amp;fullscreen=1&amp;autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="512"></embed></object>');
			$('#lightbox-content').html('<object width="640" height="512"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6142178&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff0179&amp;fullscreen=1&amp;autoplay=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=' + vimeo_id + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ff0179&amp;fullscreen=1&amp;autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="512"></embed></object>');
		
			$('#lightbox-black').html('<a href="#" class="lightbox-close">x</a>');
			
			$('#lightbox-black, #lightbox-content').toggle();
		});
		
		$('#lightbox-black').click(function(){
			$('#lightbox-black, #lightbox-content').toggle();
		});
		
		$('.lightbox-close').click(function(e){
			e.preventDefault();
		});
		
		$('#list-name').change(function(){
			$('#list-name-hidden').attr('name', $(this).val());
		});
				
		$('#list-name-hidden').attr('name', $('#list-name optgroup option:first-child').val());
	}
);

$('.newshover').hover(  
 function() {  
  $(this).addClass('hover');  
 },  
 function() {  
  $(this).removeClass('hover');  
 }  
);  