$(document).ready(function(){
	$('#block-google_appliance-google_search #edit-keys').bind('click', function(){
		if(!$(this).attr('clicked'))
		{
		$(this).val('');
		$(this).attr('clicked','clicked');
		$(this).css('text-align','left');
		}
	})
});

$(document).ready(function(){
	$('#google-appliance-search-form #edit-keys').bind('click', function(){
		if(!$(this).attr('clicked'))
		{
		$(this).val('');
		$(this).attr('clicked','clicked');
		$(this).css('text-align','left');
		}
	});
	//$('a[href$="/search"]').parent().hide();
	$('.section-search #content-inner a[href$="/search/user"]').parent().hide();
	var help = $('.section-search #content-inner a[href$="/search/advanced_help"]').parent().hide();

});

//change submit button value for site/google search
$(document).ready(function(){
	 $('.search-form .form-submit').attr('value','');
	 $('.search-form .form-text').attr('value','site search');
});

function normalizeNoflashCaptionBackgrounds()
{
$('.ui-tabs-panel').each(function(){
	 var height = $(this).find('.home-slide-video-intro').height();
	 if(height)
	 	{
		 $(this).find('.home-slide-video-intro-bkgd').css('height',height);
	 	}
	 });
}
//homepage video loader	
$(document).ready(function(){	
	 var randomnumber=Math.floor(Math.random()*6) 
	 var loaded = 0;
	 if($("BODY.home-noflash").size() == 1)
	 {
	  
	 $("BODY.home-noflash #background-cover-inner #homepage-tabs").tabs({
		 "selected":0,
		 "show":function(event, ui)
          {
		  normalizeNoflashCaptionBackgrounds();
		  if(!loaded)
		  	{
		  	loaded = 1;
		  	}
	      }
	   });  
	 }
	 //set the heigh of each background block to the height of it's corresponding text block
	 $('#background-cover').ready(function(){
			$('.home-slide-video-intro').fadeIn(1000, function(){
			normalizeNoflashCaptionBackgrounds();
			});
			$('#background-cover-inner').fadeIn(3000); 
	 });
	 
	 //$("#background-cover-inner #homepage-tabs").tabs("rotate" , 10000 , false);
	 //kinda flashes out, find a new way to do this
	 //$('BODY.front .panels-flexible-row-2-main-row-right .menu a').append('<br/><b class="watch-video">Watch Video</b>');
	 $('.home-video-link').bind('click', function(){
	 $('#noflash-video-cover').fadeIn(1000);
	 $('.international-block, .live-chat-block, .social-media-links, .booking-widget, #homepage-ad').hide();
	 var flv = $(this).attr('flv');	
	 var screenshot = $(this).attr('screenshot');
	 var name = $(this).attr('name'); 
	  $('#noflash-video-inner').html('<div id="video_player"></div>');
	  var vars = { 
	    file: flv,
	    image: screenshot,
	    skin:  '/sites/visitstpeteclearwater.com/modules/jwplayer/st_pete_stylish.swf',
	    playerready:'JWPlayerReadyCallback',
	    plugins:'/sites/visitstpeteclearwater.com/modules/jwplayer/plugins/listening/Listener.swf'    
	    };
	  var params = {
	    width: 760, 
	    height: 595, 
	    wmode:'transparent', 
	    allowfullscreen:true
	    };
	  var attributes = {
	    width: 760, 
	    height: 595,
	    node_title:name
	    //tags: 
	    };
	  var swf = '/sites/visitstpeteclearwater.com/modules/jwplayer/player.swf';
	  
      $('#video_player').ready(function(){
	  
      swfobject.embedSWF(swf, 'video_player', 760, 595, '9.0.0','expressInstall.swf'  , vars, params, attributes);
	  $("#noflash-video-inner").append('<a class="close-video" title="close video" href="#"></a>');
	  $("#noflash-video-inner .close-video").bind('click',function(){$('#noflash-video').fadeOut();$('#noflash-video-inner').html(''); $('.international-block, .live-chat-block, .social-media-links, .booking-widget, #homepage-ad').show();});
      $('#noflash-video-cover').fadeOut(1000);
	  
	  $('#noflash-video').fadeIn(1000);
	  
	 });
     return false;
  });
});//end document.ready()

/* webform checkboxes - make 'em pretty*/
$(document).ready(function(){
	//$("#webform-client-form-362 input[type=checkbox]").prettyCheckboxes();
	//$("#webform-client-form-171 input[type=checkbox]").prettyCheckboxes();
});

var adBlockState = 0;
$(document).ready(function(){


	
	/*
	$("#hoverAdBlock").hoverIntent({
		sensitivity: 3, 
		interval: 200, 
		over: rise, 
		timeout: 500, 
		out: fall
	});
	*/
	$('#hoverAdBlock .adTitle a').bind('click', function(){
		if(adBlockState == 0)
		{
		rise("#hoverAdBlock");
		}
		else
		{
		fall("#hoverAdBlock");
		
		}
		
	});
	setTimeout(function(){ rise("#hoverAdBlock")}, 1000);
	setTimeout(function(){ fall("#hoverAdBlock")}, 6000);
}); // close document.ready

$(document).ready(function(){
	//$('.thickbox_image').thickbox(); 
});

$(document).ready(function(){
//	$('body.node-type-article .left-column .content').jScrollPane({showArrows:false, scrollbarWidth: 15, arrowSize: 16});	
});

$(document).ready(function(){
	$('.nearby-listings-group').each(function(){
		var outer = $(this);
		$(this).find('.nearby-listings-group-list').css('display','none');
		$(this).find('.nearby-listings-group-heading').bind('click', function(){
		  outer.find('.nearby-listings-group-list').toggle();	
		  }); 	
		});
});

function rise(id)
{
adBlockState = 1;	
$(id).animate({"top":470},500); 
$(id).addClass('active').removeClass('inactive');
}
function fall(id)
{
adBlockState = 0;
$(id).animate({"top":571},500); 
$(id).addClass('inactive').removeClass('active');
}

function hompageMovieOpened()
{
}
function homepageMovieClosed()
{
}

$(document).ready(function(){
	var i = 1;
	$('body.section-send-a-postcard .views-row .views-field-title').each(function(){
	$(this).prepend('<div class="row-counter">'+i+'</div>');
	i++;
	});
	
});