$(document).ready(function(){
		
		$('.navigation li').each(function(){
			
			var theheight = 0;
			theheight = $('ul', this).height();
			
			//set the css height to the actual height so slides work
			$(this).find('ul').css('height',$(this).find('ul:first').height());
			
			
			$(this).hover(
				
				function () {
					//show
					$('ul', this).slideDown(500);	
				}, 
				function () {
					//hide
					$('ul', this).slideUp(500);			
				}
			);
		});
	
		
		
		//

		$.needHelp();
		$.quoteCallback();
		
		$.flexiForm();
		$('#callback-quoteme').hide();
		//call me back form
		$.flexiForm.addForm('external','ajax/callback-callback.html',{
			loadInto: '#callback-callback', 
			autoRespond: 1, 
			clearOnSend: true,
			allowDefaultSuccess: true,
			autoResponderFields: ['email'], 
			success: function(){
				$('.successmessage').each(function(){ 
						var thisVar = this; 
						$(this).html('<div><p>Thank you for your Enquiry</p></div>');
						$(this).show();
						setTimeout( function(){ 
								$qc.hide();
						},5500);
				});
			}});
			
		//I know what I want, quote me form
		$.flexiForm.addForm('external','ajax/callback-quoteme.html',{loadInto: '#callback-quoteme', autoRespond: 1, autoResponderFields: ['email'], 
			success: function(){
				$('.successmessage').each(function(){ 
						var thisVar = this; 
						$(this).html('<div><p>Thank you for your Enquiry</p></div>');
						$(this).show();
						setTimeout( function(){ 
								$qc.hide();
						},5500);
				});
			}});


		
 
		$('.btn-know').each(function(){
			$(this).addClass('hover');
			
			$(this).click(function(e){
				e.preventDefault();
				$('#callback-callback').hide();
				$('#callback-quoteme').show();
				
				$(this).addClass('hover');
				$('.btn-contact-callback').each(function(){$(this).removeClass('hover')});
				
			});
		});
		$('.btn-contact-callback').each(function(){
			
			$(this).click(function(e){
				e.preventDefault();
				$('#callback-quoteme').hide();
				$('#callback-callback').show();
				
				$(this).addClass('hover');
				$('.btn-know').each(function(){$(this).removeClass('hover')});
			});
			
		});
		
		
		$('.scrolltop').each(function(){
			$(this).click(function(e){
				e.preventDefault();
				$('html, body').animate({scrollTop:0}, 'slow');
			});
		});
		
		
		$('.btn-contact-callback').each(function(){$(this).removeClass('hover')});
		$('.btn-know').each(function(){$(this).removeClass('hover')});
		$('.btn-contact-callback').each(function(){$(this).addClass('hover')});

		
});





(function($){
	
	$quoteCallback = $.quoteCallback = $qc = $.qc = function(){
		$qc.initialize();
	}
	
	$qc.vars = {
		classOpen: 'open-callback',
		classClose: 'close-callback',
		id: '#quotecallback ',
		animSpeed: 500,
		height: 400,
		shown: false
	}
	
	$qc.initialize = function(){
		//remember initial height 
		$qc.vars.height = $($qc.vars.id).height();
		if($qc.vars.shown == false){
			$($qc.vars.id).height(0);
		}
		$($qc.vars.id).show();
		$qc.assignActions();
	}
	
	$qc.hide = function(){
		$($qc.vars.id).animate({height:0},$qc.vars.animSpeed);
		$qc.vars.shown = false;
	}
	$qc.show = function(){
		if(!$qc.vars.shown){
			$($qc.vars.id).animate({height:$qc.vars.height},$qc.vars.animSpeed);
			$qc.vars.shown = true
		}else{
			$qc.hide();
		}
		
	}
	
	$qc.assignActions = function(){
			//set up the action for open links
		$('.'+$qc.vars.classOpen).each(function(){
			
			$(this).click(function(e){
				e.preventDefault();
				
				$('html,body').animate({scrollTop:0}, 500,function(){
					
				});
				setTimeout('$qc.show()',500);
				
			});
			
		});
		
		//set up the action for close links
		$('.'+$qc.vars.classClose ).each(function(){
			$(this).click(function(e){
				e.preventDefault();
				$qc.hide();
			});
		});
	}

	
	
	
})( jQuery );

/**
	Dependancies: cookie.jquery
**/
(function( $ ){
	
	$.needHelp = $needHelp = $.nhlp = $nhlp = function(){
		$nhlp.initialize();
	}
	
	$nhlp.vars = {
		
		classOpen: 	'open-need-help', 
		classClose: 'close-need-help',
		boxID: 		'needhelptab',
		width: 		300,
		animSpeed: 500,
		shown: false,
		cookieDuration:1000,
		enableCookies: true
		
	}
	
	
	$nhlp.initialize = function(){
		
		//ensure the box is displayed
		$('#'+$nhlp.vars.boxID).show();
		
		//load the default state
		if($nhlp.vars.shown){
			$nhlp.show();
		}else{
			$nhlp.hide();
		}
		
		$nhlp.assignActions();
		setTimeout("$nhlp.openFirstTime()",3000);

	}
	
	$nhlp.openFirstTime = function(){
		
		if($nhlp.vars.enableCookies && !$.cookie('nhlp_opened')){
			$nhlp.show();
			//create cookie that expires in 1 day
			$.cookie('nhlp_opened',1, {expires:1});
		}
		
	};
	
	
	
	$nhlp.assignActions = function(){
			//set up the action for open links
		$('.'+$nhlp.vars.classOpen).each(function(){
			
			$(this).click(function(e){
				e.preventDefault();
				$nhlp.show();
			});
			
		});
		
		//set up the action for close links
		$('.'+$nhlp.vars.classClose ).each(function(){
			$(this).click(function(e){
				e.preventDefault();
				$nhlp.hide();
			});
		});
	}

	
	//show the box
	$nhlp.show = function(){
		
		if(!$nhlp.vars.shown){
			$('#'+$nhlp.vars.boxID).animate({left: 0+'px'},$nhlp.vars.animSpeed);
			$nhlp.vars.shown = true;
		}else{
			$nhlp.hide();
		}
		
		
	}
	
	//hide the box
	$nhlp.hide = function(){

		$('#'+$nhlp.vars.boxID).animate({left: -$nhlp.vars.width+'px'},$nhlp.vars.animSpeed);
		$nhlp.vars.shown = false;
	}
	
	
	
	
	
	
})( jQuery );









































