// JavaScript Document

$(document).ready(function(){
									
	sub_nav();
						   
   $('#navWrapper li:first').addClass('navFirstLi');
	$('#navWrapper li:last').addClass('navLastLi');
	
	$('.entry table thead tr th:first').addClass('firstTH');
	$('.entry table tbody tr td:first-child').addClass('firstTD');

	$('tbody tr:nth-child(odd)').addClass('odd'); // zebra table
	
	$('#featureSlide div').click(function(){
    	window.location=$(this).find('a').attr('href');return false;
	});
	
    $('#shareContainerDrop').hover(
      function () {
        $('#shareContainerWrap').show();
        $('#shareContainerDrop a:first').addClass('hovered');
      }, 
      function () {
        $('#shareContainerWrap').hide();
        $('#shareContainerDrop a:first').removeClass('hovered');
      }
    );
	
	$('#featureNav').jFlow({
		slides: '#featureSlide',
		controller: '.jFlowControl',
		slideWrapper : '#featureMask',
		selectedWrapper: 'jFlowSelected',
		width: '566px',
		height: '258px',
		duration: 400,
		prev: '#featButtonHolder .previous',
		next: '#featButtonHolder .next'
	});
	
    $('#homeTabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	
	if (jQuery.browser.msie) {
		if(parseInt(jQuery.browser.version) == 6) {
			$('#commentTabs').tabs();
		}
	}
	if( (parseInt(jQuery.browser.version) == 7) || (parseInt(jQuery.browser.version) == 8) ) {
		$('#commentTabs').tabs();
	}
	else {
		$('#commentTabs').tabs({ fxFade: true, fxSpeed: 'fast' });		
	}
	
});

function mailpage()
{
	mail_str = 'mailto:?subject=Check out the ' + document.title;
	mail_str += '&body=I thought you might be interested in the ' + document.title;
	mail_str += '. You can view it at, ' + location.href;
	location.href = mail_str;
}

function sub_nav(){ //dropdown menu

	var the_nav = '#navWrapper'; // menu ID or CLASS
	var the_nav_sidebar = '#widgetHolder ul'; // menu ID or CLASS
	
	jQuery( the_nav_sidebar + ' li' ).each
	(
		function( intIndex )
		{
			jQuery(this).css({'z-index': 1000 - intIndex });
		}
	);
	
	jQuery( the_nav + ' li' ).each
	(
		function( intIndex )
		{
			jQuery(this).css({'z-index': 1000 - intIndex });
		}
	);
	
	jQuery( the_nav + ' li a' ).removeAttr('title');
	
	jQuery( the_nav_sidebar + ' li a' ).removeAttr('title');
	
	jQuery(the_nav + ' ul').css({display: 'none'}); // Fix for Opera Browser
	jQuery(the_nav_sidebar + ' ul').css({display: 'none'}); // Fix for Opera Browser
	
	jQuery(the_nav + ' li').hover(function(){
		jQuery(this).find('ul:first').css({visibility: 'visible', display: 'none'}).fadeIn(350);
		jQuery(this).find('a:first').addClass("dropdown_hovered");
	},function(){
		jQuery(this).find('ul:first').css({visibility: 'hidden'});
		jQuery(this).find('a:first').removeClass("dropdown_hovered");
	});
	
	jQuery(the_nav_sidebar + ' li').hover(function(){
		jQuery(this).find('ul:first').css({visibility: 'visible', display: 'none'}).fadeIn(350);
		jQuery(this).find('ul:first').prev().addClass("dropdown_hovered");
	},function(){
		jQuery(this).find('ul:first').css({visibility: 'hidden'});
		jQuery(this).find('a:first').removeClass("dropdown_hovered");
	});
	
    $('#shareContainerDrop').hover(
      function () {
		  $('.postTitle').removeClass('hovered');
      }, 
      function () {
		  $('.postTitle').addClass('hovered');
      }
    );
  
}



