/**************************************************************
*
*	@file odopod.js
*	@author Dane Hesseldahl
*	@url http://www.doesnotvalidate.com
*	@requires jQuery 1.2.6 (developed on minified version)
*
*************************************************************/
$(document).ready(function() 
{
	init();
});

function init()
{
	$("#blog_search_btn").click(
	function()
	{
		window.location.href = "/blog/search/" + $("#blog_search_input").val();
		return false;
	});
	
	//INSIDE ODOPOD SUBNAV ANIMATION
	$('.inside_odopod_header ul#subNav li:not(.active) a').hover(function(){
			$(this).animate({
				marginTop: '-16px',
				paddingTop: '16px'
			}, 'fast');
		},
		function(){
			$(this).animate({
				marginTop: '0',
				paddingTop: '0'
			}, 'fast');
	
		}
	);
	
  // TAG PAGE MENU
  
  var menu_height;
  
	$('.other_tags_button').hover(function(){
		$('#tag_menu').fadeIn('fast');
	});

	$('.other_tags_button').click(function(){
		
		$(this).addClass("active");
		
		if($('#tag_menu ul').css('display') == 'none')
		{
			$('#tag_menu ul').slideDown();
		}
		else
		{
			$('#tag_menu ul').slideUp('fast',function(){
				$('#tag_menu').fadeOut('fast');
			});
		}
	});

	$('#tag_menu:not(.blog)').hover(function(){
		
		$('#tag_menu ul').stop(true, true);
		$('.other_tags_button').removeClass("active");			
		
	},function(){
		$('#tag_menu ul').animate({opacity:'1'},1000).slideUp('fast',function(){
			$('#tag_menu').fadeOut('fast');
			$('.other_tags_button').removeClass("active");			
		});
	});

  
  
  // END TAG PAGE MENU





  // CLIENT INDEX HOVER PANEL
  $('.client_module').hover(function(){
		$(this).addClass('panel_on')
		$('.client_hover_panel',$(this)).fadeIn('fast');
	},function(){
		$('.client_hover_panel',$(this)).fadeOut('fast');
		$(this).removeClass('panel_on')
	})
	// END CLIENT INDEX HOVER PANEL





  //ODOGRID TOGGLE
	/*
  $(document).keypress(function(e){
    // console.log(e.which)
    if(e.which==103) //103 = "g"
    {
      if($('#odogrid').size() != 0)
      {
        $('#odogrid').remove()
      }
      else
      {
        $('#wrap').append('<div id="odogrid"></div>')
        $('#odogrid').css({width:944, height:2000, position:'absolute', top:0, backgroundImage:'url(/assets/gfx/odogrid.gif)'}).fadeTo(0,0.4)
      }
    }
  })
	*/
  //END ODOGRID





  //MODULE HOVER
		$('.module').hover(function()
		{
			if($(this).hasClass('.playing'))
			{
				return;
			}
			
			if($(this).hasClass('.speech'))
			{
				var color = ''
				
				if($(this).hasClass('.module_paper'))
				{
					color = '#ccc09c'
				}
				else if($(this).hasClass('.module_award'))
				{
					color = '#1ba2b5'
				}
				else
				{
					color = '#bdbdbd'
				}
				
				$('.module_body',$(this)).animate({backgroundColor:color}, 'fast')
				
			}
			else
			{
				$(this).animate({backgroundColor:'#871c4b'}, 'fast')
			}
			
			var module_image = $(this).children('a.inner').children('div.module_body').children('div.module_body_inner').children('img');
			
			if(module_image.length > 0){
				module_image.hide();		
			}
		},
		function()
		{
			if($(this).hasClass('.playing'))
			{
				return;
			}
			
			if($(this).hasClass('.speech'))
			{
				$('.module_body',$(this)).animate({backgroundColor:'#ffffff'}, 'fast')
			}
			else
			{
				$(this).removeClass('hover')
				$(this).animate({backgroundColor:'#df3d82'}, 'fast')
			}
			
			var module_image = $(this).children('a.inner').children('div.module_body').children('div.module_body_inner').children('img');
			
			if(module_image.length > 0){
				module_image.show();		
			}
			
		})
  //END MODULE HOVER
  

	//HOME PAGE MODULE HOVER
	$('.home_module_row .home_module_row_inner a').hover(function(){
		$(this).children('img.over').fadeIn('fast');
		$(this).addClass('panel_on');
	},
	function(){
		$(this).children('img.over').fadeOut('fast');
		$(this).removeClass('panel_on');
	});
	//END HOME PAGE MODULE HOVER
  
   
  
  // STRATEGY PAGE NAV HOVER
  $('#strategy_nav li').hover(function(){
		
		$(this).animate({marginLeft:-10}, 'fast')
		$('a', $(this)).animate({paddingLeft:10, backgroundColor:'#B53269'}, 'fast')
		
	},function(){

		if(!$(this).hasClass('active'))
		{
			$(this).animate({marginLeft:0}, 'fast')
			$('a', $(this)).animate({paddingLeft:0, backgroundColor:'#de3d81'}, 'fast')
		}
		
	})
  // END STRATEGY PAGE NAV HOVER
  
  
  
  
  
  // PNG FIX
  // supersleight.init()
  // $(document).pngFix(); 
  // END PNG FIX
      
  
}

