	$(function() {
    // run the code in the markup!
    $('td pre code').each(
	function() {eval($(this).text());});
	});
	
$(document).ready(function() {
	 
	//set default easing
	jQuery.easing.def = 'easeOutQuad';
	
	/* Contact Us Slide */
	
	$('.contact_tab').click(
	function () {
	$('DIV.hidden_contact')
	.slideToggle(1000, 'jswing');
	},
	
	function () {
	$('DIV.hidden_contact')
	.slideToggle(500, 'jswing');
	});
	
	$('.contact_tab').hover(
	function() {$(this)
	.stop(true,true)
	.animate({paddingTop:"35px"}, {duration: 500, easing: 'easeOutQuad'});},
	function() {$(this)
	.animate({paddingTop:"0px"}, {duration: 500, easing: 'easeOutQuad'});});
	
	$('form#contact_us #button1').click(
	function () {
	$('.contact_tab')
	.click();
	});

	$('#roll').click(
	function () {
	$('#roll_div')
	.fadeIn(1000);
	});
	
	$('#wall').click(
	function () {
	$('#wall_div')
	.fadeIn(1000);
	});
	
	$('#drft').click(
	function () {
	$('#drft_div')
	.fadeIn(1000);
	});
	
	$('.img_div_dtl').mouseleave(
	function () {
	$(this)
	.fadeOut(1000);
	});
	
	//set preload function
	jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++)
	{jQuery("<img>").attr("src", arguments[i]);}
	};
	
	//define images to preload
	$.preloadImages("../images/survey.png", "../images/survey_.png", "../images/green.png", "../images/green_.png", "../images/blog.png", "../images/blog_.png", "../images/rss.png", "../images/rss.png");
    
    $('#survey').hover(
	function() {$(this)
	.attr("src","../images/survey_.png");},
	function() {$(this)
	.attr("src","../images/survey.png");});
	
	$('#green').hover(
	function() {$(this)
	.attr("src","../images/green_.png");},
	function() {$(this)
	.attr("src","../images/green.png");});
	
	$('.karnheath_blog_img').hover(
	function() {$(this)
	.attr("src","../images/blog_.png");},
	function() {$(this)
	.attr("src","../images/blog.png");});
	
	$('.karnheath_rss_img').hover(
	function() {$(this)
	.attr("src","../images/rss_.png");},
	function() {$(this)
	.attr("src","../images/rss.png");});
	
	$('#test_cycle').cycle({
        fx: 'scrollUp',
        easing: 'jswing',
        delay: -6000,
		speedIn: 15000,
		speedOut: 15000,
		continuous: true
    });
    
    /* Quote Benefit Slide */
	
	$('.benefit').click(
	function () {
	$('DIV.benefit_div')
	.slideToggle(1000, 'jswing');
	},
	
	function () {
	$('DIV.benefit_div')
	.slideToggle(500, 'jswing');
	});
	
	/* Quote Appear from side data */
	
	$('IMG.survey').click(
	function () {
	$('DIV.hidden_quote')
	.css({"position":"absolute", "display":"inline"})
	.stop(true,true)
	.animate({right:"20px"}, {duration: 2000, easing: 'easeOutElastic'})
	$('DIV.hidden_quote_bg')
	.fadeIn(1000);
	});
	
	$('.close_quote').click(
	function () {
	$('DIV.hidden_quote')
	.stop(true,true)
	.animate({right:"-480px"}, {duration: 1000, easing: 'easeOutElastic'})
	.css({"position":"fixed", "display":"none"})
	$('DIV.hidden_quote_bg')
	.fadeOut(1000);
	});
	
	$('.grants_button').click(
	function () {
	$('IMG.survey')
	.click();
	});
	
	$(function(){
    $('DIV.c_grnt_box').click(
	function(){window.open("http://karnheathltd.com/grants.php", "_self"); return false;});
	});
	
	$(function(){
    $('DIV.c_test_box').click(
	function(){window.open("http://karnheathltd.com/testimonials.php","_self"); return false;});
	});
	
	$('.body').supersleight();
	$('.footer').supersleight();
});