$(document).ready(function() {
 

 $('#simpleContent1').highlight('Dr Bob Khanna');
 
  $('#simpleContent1 p:first').css('font-weight', 'bold');


			  $(".nav img").mouseover(function (){
						         $(this).fadeTo(0.5, 0.5 )
  							  });
							  
							  

							  
$("body *").replaceText( /BOTOX/gi, "BOTULINUM TOXIN" );
$("body *").replaceText( /Botox/gi, "Botulinum Toxin" );				  

 	 $('.newsBoxFull').highlight('SubQ');  
    $('.newsBoxFull').highlight('treatments');  
	
	
	    $('.testTitle').highlight('Excellent');  
		$('.testTitle').highlight('patients');  
		$('.testTitle').highlight('learn');  
				
				
		    $('.testText').highlight('Excellent');  
		$('.testText').highlight('patients');  
		$('.testText').highlight('learn');  
			$('.testText').highlight('confident');  	
				$('.testText').highlight('practise'); 	
				$('.testText').highlight('recommended'); 					
				
				
				
		
 	$("img:not([title])").each(function() {
  		if($(this).attr("alt") != '') $(this).attr("title", $(this).attr("alt"))
  		else $(this).attr("title", $(this).attr("src"))
  	})
 
$('.rightHead').hide().delay(1200).fadeIn(600);
$('h1').hide().delay(400).fadeIn(800);
$('h3').hide().delay(800).fadeIn(800);
$('#testBox').hide().delay(1400).fadeIn(600);

$('#closeBox').click(function(){
  $('#closeBox').slideUp();
});


			Cufon.replace('h1');
			Cufon.replace('h2');
			Cufon.replace('h3');
			Cufon.replace('h4');
			
	$("img:not([title])").each(function() {
		$(this).attr("title", $(this).attr("alt"))
		})
		
	$("img:not([alt])").css("border","3px solid red")		
});




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());
 });
};

