$(document).ready(function() {

// NOT supporting ie6 one bit
var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
if(IE6){
	$(function(){
	window.location= 'http://ie6funeral.com/';		
	});
}




//init tabs
$("ul.tabs").tabs("div.panes > div", {
	effect: 'fade',
	rotate: true
}).slideshow();


// sub nav 'on' state settings
// handled by tabs jquery tools



// scroll effect on anchor links
$('.thinCol, #sticky #mainNav, .textNav, ul.tabs').localScroll({
	easing: 'easeInOutCirc',
	hash : false,
	offset: 0 -190
});


// anchor link focuses form clear nav 'on' state
$('a[href="#emailJump"]').click(function(){
	//$('input#name').focus();
	$('#sticky ul li a').removeClass('on');
});

// clear nav 'on' state back to top
$('a[href="#top"]').click(function(){
	$('#sticky ul li a').removeClass('on');
});




// sticky nav
function sticky_relocate() {
  var window_top = $(window).scrollTop();
  var div_top = $('#sticky-anchor').offset().top;

  if (window_top > div_top)
    $('#sticky').addClass('stick')
  else
    $('#sticky').removeClass('stick');
  }
// If you have jQuery directly, use the following line
 $(function() {
// If you have jQuery via Google AJAX Libraries
//google.setOnLoadCallback(function() {
  $(window).scroll(sticky_relocate);
  sticky_relocate();
  });


// stikcy nav 'on' states
$('#sticky ul li a').click(function(){
	$('#sticky ul li a').removeClass('on');
	$(this).addClass('on');
});

// clear nav 'on' state BLOG link
/*
$('a[class="out"]').click(function(){
	$('#sticky ul li a').removeClass('on');
});
*/



// Validate form
$("#form1").validate({
rules: {
	name: {
		required: true,
		minlength: 3
	},
	email: {
		required: true,
		email: true
	},
},
messages: {
	name: "Please Include Your Name!",
	email: "Not a Valid Email Address!"
	}
});



// if Thank You page from form submit
if(window.location.hash) {
  
  $('#thankYou').animate({
	  top: '0'
	  }, 0, 'easeInOutCirc', function() {
  });

  $('#thankYou').animate({'border-width':'0px'},2800,'swing',function(){ //timer smilano
  
	  $('#thankYou').animate({
	  	top: '-165'
	  	}, 2000, 'easeInOutCirc', function() {
	  	// animation complete
	  });
  }); // END timer
  
  
  parent.location.hash = '';

} else {
  //alert('First time hit');
}




// Clear fix
$('.contentHolder, .clearFix').append('<div class="clear"></div>');


// External links
$('a[rel$="ext"]').click(function(){
  this.target = '_blank';
});


});
// END dom ready


