jQuery(document).ready(function(){
								
	var $ = jQuery.noConflict();
	

 

	
	jQuery('span.footer_image').hover(function() {
		jQuery('span.footer_text', this).stop().animate({height:'100%', duration: 1000, top: '0px'});
		}, 	
		function() {
    	 jQuery("span.footer_text", this).stop().animate({height:'100%', duration: 1000, top: '115px'});
	});



/*====== for the contact section of links in the header and mid_wrapper =======*/
	jQuery('div.email_wrapper, div.phone_wrapper, div.personal_wrapper, div.testimonial_wrapper').hide();
	
	jQuery("a.email_trigger").click(function()
	{
		phoneToggleUp();
		personalToggleUp();
		testimonialToggleUp();
		jQuery("div.email_wrapper").slideToggle("slow");
		return false;
	});
	
	jQuery("a.phone_trigger").click(function()
	{
		emailToggleUp();
		personalToggleUp();
		testimonialToggleUp();
		jQuery("div.phone_wrapper").slideToggle("slow");
		return false;
	});
	
	jQuery("a.personal_trigger").click(function()
	{
		emailToggleUp();
		phoneToggleUp();
		testimonialToggleUp();
		jQuery("div.personal_wrapper").slideToggle("slow");
		return false;
	});
	
	jQuery("a.testies_trigger").click(function()
	{
		emailToggleUp();
		phoneToggleUp();
		personalToggleUp();
		jQuery("div.testimonial_wrapper").slideToggle("slow");
		return false;
	});
	
/* functions to make the divs disapear */	
	function emailToggleUp(){
		jQuery("div.email_wrapper").slideUp("slow");
	}

	function personalToggleUp(){
		jQuery("div.personal_wrapper").slideUp("slow");
	}

	function phoneToggleUp(){
		jQuery("div.phone_wrapper").slideUp("slow");
	}
	
	function testimonialToggleUp(){
		jQuery("div.testimonial_wrapper").slideUp("slow");
	}
	
	//close all function
	function closeAll(){
		emailToggleUp();
		phoneToggleUp();
		personalToggleUp();
		testimonialToggleUp();			
	}
	
/* ===== ends here ===== */
	
	//listens to the escape key and if pressed removes the contact panel
	jQuery(document).keyup(function(event){
		if (event.keyCode == 27) {
		   	closeAll();
		}
	});
	
	//so i can close al the divs with a button
	jQuery('a.close_trigger').click(function(){
		closeAll();					
	});
	
	
/* for the whats next section request a call back */
	jQuery("div#whats_next ul li.callback ul#callback_content").hide();
	
	jQuery("a.callback_trigger").click(function()
	{
		jQuery("div#whats_next ul li.callback").toggleClass('active');
		jQuery("div#whats_next ul li.callback ul#callback_content").slideToggle("slow");
		return false;
	});


/*for the category list pages to show and hide their extra details */
	jQuery('div.itemmeta_content').hide();
	jQuery("a.itemmeta_trigger").click(function()
	{
		jQuery(this).next("div.itemmeta_content").slideToggle("slow");
		jQuery(this).toggleClass('active');
		return false;
	});
	
	
/* adds a little more advanced css selecting to the site. css3 stuff but universal */
	jQuery('li.recommended:last').addClass('thumbs');
	jQuery('li.connections:last').addClass('network');
	
	
/*for the text highlighting on the search page */
//http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) 
{
	var skip = 0;
	if (node.nodeType == 3) 
	{
		var pos = node.data.toUpperCase().indexOf(pat);
		if (pos >= 0) 
		{
			var spannode = document.createElement('span');
			spannode.className = 'highlight';
			var middlebit = node.splitText(pos);
			var endbit = middlebit.splitText(pat.length);
			var middleclone = middlebit.cloneNode(true);
			spannode.appendChild(middleclone);
			middlebit.parentNode.replaceChild(spannode, middlebit);
			skip = 1;
		}
	}
	else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) 
	{
		for (var i = 0; i < node.childNodes.length; ++i) 
		{
			i += innerHighlight(node.childNodes[i], pat);
		}
	}
	return skip;
}

return this.each(function() 
{
	innerHighlight(this, pat.toUpperCase());
});
};

jQuery.fn.removeHighlight = function() 
{
return this.find("span.highlight").each(function() 
{
this.parentNode.firstChild.nodeName;
with (this.parentNode) 
{
	replaceChild(this.firstChild, this);
	normalize();
}
}).end();
};



   
 
	
});
