



$(document).ready(function(){

	// rotator custom code

	$('#rotator').cycle({ 
    	fx:     'fade',
		speed:	'slow', 
	    timeout: 7000, 
	});
	
	// prevent content widows
	
	$("#main h1:not(h1:has(img)), #main h2:not(h2:has(img)), #main h3:not(h3:has(img)), #main p:not(p:has(img))").each(function(){
		var wordArray = $(this).html().split(" ");
		var finalTitle = "";
		for (i=0;i<=wordArray.length-1;i++){
			finalTitle += wordArray[i];
			if (i == (wordArray.length-2)){
				finalTitle += "&nbsp;";
			}else{
				finalTitle += " ";
			}
		}
		$(this).html(finalTitle);
	});	
	
	// placeholder functionality for input fields
	
	$('[placeholder]').focus(function() {
	  var input = $(this);
	  if (input.val() == input.attr('placeholder')) {
		input.val('');
		input.removeClass('placeholder');
	  }
	}).blur(function() {
	  var input = $(this);
	  if (input.val() == '' || input.val() == input.attr('placeholder')) {
		input.addClass('placeholder');
		input.val(input.attr('placeholder'));
	  }
	}).blur().parents('form').submit(function() {
	  $(this).find('[placeholder]').each(function() {
		var input = $(this);
		if (input.val() == input.attr('placeholder')) {
		  input.val('');
		}
	  })
	});


});



