﻿/// <reference path="jquery.intellisense.js"/>

$(document).ready(function(){
  var fadeSpeed = 400;
	$('.nav h1').removeAttr('title');
	$(this).pngFix();
	
	//-- nav --//
//	$('.nav h1').find('a').hover(function(){
//    $(this).addClass('on').attr('hover','true');
//    $('.topnav h1').find('a[hover!="true"][class="on"]').each(function(){
//      $(this).removeClass('on');
//      $(this).parents('li').find('.subnav').hide(0);
//      $(this).parents('li').find('*[hover="true"]').removeAttr('hover');
//    });
//    $(this).parents('li').find('.subnav').hide(0);
//    $(this).parents('li').find('.subnav:first').fadeIn(fadeSpeed);
//  },function(){
//    $(this).removeAttr('hover');
//    hoverClose($(this).parents('li'));
//  });
//  
//  $('.subnav').hover(function(){
//    $(this).attr('hover','true');
//  },function(){
//    $(this).removeAttr('hover');
//    hoverClose($(this).parent());
//  });
//  
//  $('.subnav h2').find('a').hover(function(){
//    $(this).attr('hover','true');
//    $(this).parents('.subnav:first').find('.subnav').hide(0);
//    $(this).parents('h2').siblings('.subnav:first').fadeIn(200);
//  },function(){
//    $(this).removeAttr('hover');
//    hoverClose($(this).parents('li'));
//  });
//  
//  function hoverClose($p){
//    setTimeout(function(){
//      if ($p.find('*[hover="true"]').length==0){
//        $p.find('.subnav').hide(0);
//        $li = $p.hasClass('subnav') ? $p.parents('li') : $p;
//        if ($li.find('.subnav[hover="true"]').length==0)
//          $li.find('h1').find('a').removeClass('on');
//      }
//    },100);
//  }

  $('.subnav h2 a').hover(function(){
    $(this).parent().parent().addClass('hover');
  },function(){
    $(this).parent().parent().removeClass('hover');
  });

	//-- cbox --//
	if ($.browser.msie && $.browser.version == '6.0'){
	  $('.cbox .button').removeClass('.on').siblings('.content').show(0);
	  $('.cbox .ctc').hide(0);
	} else {
	  $('.cbox .content:not(.spacer)').hide(0);
	  $('.cbox:first').find('.button').addClass('on');
	  $('.cbox:first').find('.content').show(0);
	
	  $('.cbox .button:not(.on)').each(function(){
		  $(this).one('click', expandCBox);
		  $(this).siblings('.title').one('click', expandCBox);
		  $(this).siblings('ctc').one('click', expandCBox);
	  });
	  $('.cbox .on').each(function(){
		  $(this).one('click', collapseCBox);
		  $(this).siblings('.title').one('click', collapseCBox);
		  $(this).siblings('ctc').one('click', collapseCBox);
	  });
	}
	
	function collapseCBox(eventObject){
		$(this).siblings('.content:not(.spacer)').slideUp(1000, function(){
			$(this).parent().find('.button').removeClass('on').one('click', expandCBox);
			$(this).parent().find('.title').one('click', expandCBox);
			$(this).parent().find('.ctc').text('- click to expand').one('click', expandCBox);
		});
	}

  function expandCBox(eventObject){
		$(this).siblings('.content:not(.spacer)').slideDown(1000, function(){
			$(this).parent().find('.button').addClass('on').one('click', collapseCBox);
			$(this).parent().find('.title').one('click', collapseCBox);
			$(this).parent().find('.ctc').text('- click to collapse').one('click', collapseCBox);
		});
	}

	$('.taxprep').click(function() {
		$(this).next('.taxprepHide').slideToggle('normal');
	});
  
});

//-- sIFR --//
if(typeof sIFR == "function"){
  sIFR.bHideBrowserText = true;
  sIFR.setup();
};