$(document).ready(function() {
	$('.nojs').hide();
	$('.showjs').removeClass('hidden');
	$('#quoteformcontainer').fadeTo('fast', 0.5);
	$('.fullbutton').click(function() {
		var url = $(this).find('a').attr('href');
		window.location=url; 
	});
	$('.testsub-off').mouseover(function(){
		$(this).addClass('testsub-on');
		$(this).removeClass('testsub-off');
	});
	$('.testsub-off').mouseout(function(){
		$(this).addClass('testsub-off');
		$(this).removeClass('testsub-on');
	});
	$('.testsub-off').click(function(){
		var url = $(this).find('a').attr('href');
		window.location=url;						 
	});
	$('.quotebutton').click(function() {
		$('#container').fadeTo(300, '0.5');
		$('#quoteformcontainer').removeClass('hidden');
		$('#quoteformcontainer').fadeTo(300, 1);
		$('.quoteformcancelbutton').click(function() {
			$('#quoteformcontainer').fadeTo(300, .5);
			$('#quoteformcontainer').addClass('hidden');
			$('#container').fadeTo(300, 1);
			});
		$('.quoteformresetbutton').click(function() {
			$(':input').each(function() {
			var type=this.type;
			var tag=this.tagName.toLowerCase();
			if(type == 'text' || tag == 'textarea')
				this.value='';
			else if(type == 'checkbox')
				this.checked=false;
			});
		});
	});
	var total = $('.slider img').length;
    var rand1 = Math.floor(Math.random()*total);
	var rand2 = Math.floor(Math.random()*total);
	$(window).load(function(){
	    $('.slider').nivoSlider(
		{
			effect: 'fade',
			slices: 5,
			startSlide:rand1,
			animSpeed:500,
		    pauseTime:4500,
			directionNavHide:true,
			controlNav:true,
			pauseOnHover:false
		 }
		 );
		$('.slider2').nivoSlider(
		{
			effect: 'fade',
			slices: 5,
			startSlide:rand2,
			animSpeed:500,
			pauseTime:6000,
			directionNav:false,
			directionNavHide:true,
			controlNav:false,
			pauseOnHover:false
		}
		);
		
	});
	var IE = /*@cc_on!@*/false;
	if(IE){
       return;
    }else{
    $('#navbar ul li a, #navbar ul ul li a').append('class="hover"').each(function () {
	  var $span = $(this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(350, 1);
	  }, function () {
	    $span.stop().fadeTo(350, 0);
	  });
	 });
    }
	});