/* <![CDATA[ */

	
	
	$('#infobox-container li a[href*=#]').click(function() {
	
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			
			if ($target.length) {
				
				$('#infobox-container li a.selected').removeClass('selected');
				
				$(this).addClass('selected');
				
				var targetOffset = $target.offset().left;
				
				var divOffset = $('#infobox #slide').offset().left;
				
				var pOffset = $('#slide div'+this.hash).offset().left;
				
				var pScroll = '';
				
				pScroll = (pOffset - divOffset);
				
				//var tHeight = $target.height();
				
				
				
				
				if($.browser.version < 7) {
					if(pScroll.toString().substring(0, 1) != '-') { $('#slide').stop().animate({'left': '-'+pScroll+'px'}, 500); }
					else { $('#slide').stop().animate({'left': pScroll + 'px'}); }
				} else {
					$('#slide').stop().animate({scrollLeft: '+=' + pScroll + 'px'}, 500);
				}
				
				if(up_down == 'down') {
					
					$('#infobox').stop().animate({height: '135px'}, 500);
				
					$('.arrow').stop().animate({top: '171px'}, 500);
				
				$('.arrow img').attr('src', 'images/home/infobox/arrow.jpg');
				
				up_down = 'up';
				
				}
				
				return false;
			}
		}
	
	});
	
	$('#quote_tab a[href*=#]').click(function() {

		clicker(this);
		
		return false;
	
	});
	
	$('.arrow a ').click(function() {
	
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $('#infobox-container li a.selected').attr('href');
			
			if(up_down  == 'up' && $('#slide div'+target).height() > 135) {
				
				var tHeight = $('#slide div'+target).height();
				
				var aHeight = tHeight + 37;
				
				$('#infobox').stop().animate({height: tHeight + 'px'}, 500);
				
				$('.arrow').stop().animate({top: aHeight + 'px'}, 500);
				
				$('.arrow img').attr('src', 'images/home/infobox/arrow_up.jpg');
				
				up_down = 'down';
				
			} else if(up_down == 'down' && $('#slide div'+target).height() > 135) {
			
				$('#infobox').stop().animate({height: '135px'}, 500);
				
				$('.arrow').stop().animate({ top: '171px'}, 500);
				
				$('.arrow img').attr('src', 'images/home/infobox/arrow.jpg');
				
				up_down = 'up';
			
			}
			
			return false;
		}
	
	});
	
	$('#quick_quote').submit(function() {
		error = false;
		var datastring = $('#quick_quote').serialize();
		
		$('#quick_quote .required').each(function(count, element) { 
			check(element, 'quick');
		});
		
		if($('#how_can_we_help :selected').val() == '') {
			$('#how_can_we_help').addClass('error');
			error = true;
		}
		
		if(!error) {
			
			$('#quote_form div').fadeOut(function() {
				$('#quote_form div').html('<p>Sending... <img src="images/default/ajax-loader.gif">');
			});
			$('#quote_form div').fadeIn();
			
			$.ajax({
				type: "POST",
				url: "includes/php/mail.php",
				data: datastring,
				dataType: 'json',
				success: function(data) {
					
					$('#quote_form div').fadeOut(function() {
					
						$('#quote_form div').html(data['msg']);
					
					});
			
					$('#quote_form div').fadeIn();
					
					window.setTimeout(function() {
						var divOffset = $('#header-slider').offset().left;
					
						var pOffset = $('#header-slider div#header_default').offset().left;
						
						var pScroll = (pOffset - divOffset);
						
						$('#header-slider').stop().animate({scrollLeft: '+=' + pScroll + 'px'}, 500);
						
						$('#quote_tab a').attr('href', '#quote_form');
						
					}, 2000);
					
				}
			});
		
		}
		
		return false;
	});
	


/* ]]> */

