$(document).ready(function() {
 
 

 $('.clearField').autoclear();
 
 $('.colLink').click(function(){	
			$('.colLink').css({backgroundColor: '#ffffff'})
			colChoose=$(this).attr('id');
			$('#colour').val(colChoose);
			$(this).css({backgroundColor: '#0b9318'})

 
 });
 
 

 
  $('#addEmail').click(function(){	
	
	$(this).fadeOut();
	$('#emailerAdd').addClass('green');
	var emailADD=$('#emailerAdd').val();
	$('#emailerAdd').val('Added your email!');
		$.post("/includes/updater.php", {action: "emailADD", emailADD: emailADD });
	
	
 });
 
   $('#colour').change(function(){ 
   colChoose=$(this).val();
   $('.colLink').css({backgroundColor: '#ffffff'})
   thisvar='#'+colChoose;
	 $(thisvar).css({backgroundColor: '#0b9318'})
	 
   
 
  }); 	
 
 


 $('#article').highlight('Website Leasing');
 $('#article p').first().css('font-weight', 'bold');
 
 $('h1').highlight('IMPORTANCE');
 
  
 	$("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);

$('.hoverClick').click(
  function () {

    $('.dropContent').slideToggle();
	return false;
  }
);


	  
	  

		  $(".hoverFade").mouseover(function (){
					     $(this).stop();
						         $(this).fadeTo(300, 0.5 )
  							  });
				  $(".hoverFade").mouseout(function (){
					  			     $(this).stop();
						         $(this).fadeTo(200, 1 )
  							  });
							  

$('.fader').quovolver();

$('#navTabs a').click(
  function () {
	  
	 	  selDiv=this.className;
			hideTabs(selDiv);
			return false;
	    }
		
	
);



});




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



