function slideSwitch() {
    var $active = $('.slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('.slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('.slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function(){	

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


			$('.slideshow IMG').css({opacity: 0.0});
			$('.slideshow IMG:first').css({opacity: 1.0});
			setInterval( "slideSwitch()", 4500 );
			
			
						  $("div.serviceBox").mouseover(function (){
						         $(this).addClass("hoverClass");
  							  });
							  
							  
							  $("div.serviceBox").mouseout(function (){
						         $(this).removeClass("hoverClass");
  							  });
							  
			$('#rightCol').highlight('Dr Bob Khanna');		  
			   $('#rightCol').highlight('Dr BK');
			   
			$('#newsPara').highlight('Dr Bob Khanna');		  
		   $('#newsPara').highlight('Dr BK');
   		   $('#newsPara').highlight('Dr Khanna');
		   	$('#newsPara').highlight('Bob Khanna');
		   	$('#newsPara').highlight('Treatment');
		  	$('#newsPara').highlight('treatments');
		  	$('#newsPara').highlight('DrBK');			
		   	$('#newsPara').highlight('Botox');		
		   	$('#newsPara').highlight('bruxism');
		   	$('#newsPara').highlight('skin');						
		  	$('#newsPara').highlight('painless');	
		  	$('#newsPara').highlight('suffer');				
		  	$('#newsPara').highlight('muscles');					
						   
					$("#bookForm").validate();
			   
			 $('#slider').jdSlider({ 
				width  : 707,
				height : 119
			});
	  	
				 var playerVersion = swfobject.getFlashPlayerVersion(); 
				if (playerVersion.major >7){
							
				}
				else {
					if ( typeof( showFrontHeader ) != 'undefined')
					{
						 $('#flReplace3').html('<img src="/images/_flashheader.jpg" width="966" height="390" />');
					}
				
					if ( typeof( showSubHeader ) != 'undefined'){
						
						$('#flReplace3').html('<img src="/images/headers/'+showSubHeader+'.jpg" width="966" height="328" />');
					}

				}	
		
});






Cufon.replace('h1', { fontFamily: 'Futura' });
Cufon.replace('h2', { fontFamily: 'Futura' });
Cufon.replace('h3', { fontFamily: 'Futura' });
Cufon.replace('h4', { fontFamily: 'Futura' });
Cufon.replace('h5', { fontFamily: 'Futura' });
Cufon.replace('.offerTitle', { fontFamily: 'Futura' });
Cufon.replace('.topOffer', { fontFamily: 'Futura' });

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 = 'color2';
    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(document).ready(function(){
      jQuery('.lightbox').lightbox();
    });
