$(document).ready(function() {
		
	// keywords
	if ($('#SearchKeywords').val() == '') {
		$('#SearchKeywords').val('Search');
	}
	$('#SearchKeywords').focus(function() {
	    if (this.value == 'Search') {
			this.value = '';
		}
		$(this).blur(function() {
			if (this.value == '') {
				this.value = 'Search';
			}
		});
	});
	
	// popup
	$('a.popup').colorbox();
	
	if ($('.youtube').length > 0) {
		$('.youtube').each(function(index){
			var html = $('<div id="youtube-div-'+index+'">');
			$(html).insertBefore($(this));
			// var flash = var attributes = {};
			swfobject.embedSWF($(this).attr('href'), 'youtube-div-'+index, "610", "488", "9.0.0");
		});
	}

	// Banners
	if ($('.banners').length > 0) {
		$('.banners').each(function(){
			if ($(this).find('div.banner').length > 1) {
				$(this).cycle({
					fx: 'fade'
				});
			}
		})
	}
	
	// Features
	if ($('.features').length > 0) {
		$('.features').each(function(){
			if ($(this).find('div.feature').length > 1) {
				$(this).cycle({
					fx: 'fade',
					speed:  500
				});
			}
		})
	}
	
	// Hides flashes after 2 seconds
	if ($('div.flash').length > 0) {
		$('div.flash').animate({opacity: 2.0}, 3000).fadeOut('slow', function() {
			$(this).remove();
		});
	}
	
	
});

