function scrollContentWindow(direction)
{
	if (direction == 'next')
		{
			var targetPage =	++currentPage;
			var targetSymbol =	"#" + targetPage;
		}

	else if (direction == 'prev')
		{
			var targetPage =	--currentPage;
			var targetSymbol =	"#" + targetPage;
		}

	//scroll the page
	$('#scroller').scrollTo(targetSymbol, 'normal');

	//update paddle text using 'title' attribute from divs
	updatePaddleText();	

	//$('#features').hide('fast');
	$('#feature-drawers').hide(500, function () {
		
		//update features via AJAX call, reassign featurette hover functions on callback
		var url = "/featurettes/index/format/html/section/" + section + "/page/" + currentPage; 

		$('#features').load(url, function() {
			
			updateAfterAJAX();

			//reveal featurettes
			//$('#features').show('slow');
			$('#feature-drawers').show('slow');

			});
			
	});		
}			

/*
SAVED
function scrollContentWindow(direction)
{
	//$('#features').hide('fast');
	$('#feature-drawers').hide('10000');
	
	if (direction == 'next')
		{
			var targetPage =	++currentPage;
			var targetSymbol =	"#" + targetPage;
		}
	
	else if (direction == 'prev')
		{
			var targetPage =	--currentPage;
			var targetSymbol =	"#" + targetPage;
		}
		
	//update features via AJAX call, reassign featurette hover functions on callback
	var url = "/featurettes/index/format/html/section/" + section + "/page/" + currentPage; 

	$('#features').load(url, function() { updateAfterAJAX(); });

	//scroll the page
	$('#scroller').scrollTo(targetSymbol, 'slow');
	
	//update paddle text using 'title' attribute from divs
	updatePaddleText();
	
	//reveal featurettes
	//$('#features').show('slow');
	$('#feature-drawers').show('10000');
	
}
*/

function updateAfterAJAX()
{
	$('li.featurette').hover(function() {
		$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split('-up.').join('-hover.'));
		$(this).children('div.featurette_item').show(100);
	  	}, function() {
		$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split("-hover.").join("-up."));
		$(this).children('div.featurette_item').hide(100);
		});
	
	$('a[rel*=facebox]').facebox();
	//$('a[rel*=lightbox]').lightBox();
  	
}


function updatePaddleText()
{
	if (totalPages == 1)
		{
		hidePaddle('both');		
		}
	else
		{	
		var currentPageSymbol = "#" + currentPage;
		
		var nextpaddleText = $(currentPageSymbol).next('div').attr('title');
		var prevpaddleText = $(currentPageSymbol).prev('div').attr('title');
	
		$('#nextPaddleText').html(nextpaddleText);
		$('#prevPaddleText').html(prevpaddleText);
	
		if (currentPage == 1)
			{
				hidePaddle('right_paddle');
				showPaddle('left_paddle');
			}
	
		else if (currentPage == totalPages)
			{
				hidePaddle('left_paddle');
				showPaddle('right_paddle');
			}
		else
			{
				showPaddle('left_paddle');
				showPaddle('right_paddle');
			}
		}
}


function hidePaddle(paddle)
{
	if (paddle == 'left_paddle')
		{
			$('#left_paddle').hide('slow');
		}
	else if (paddle == 'right_paddle')
		{
			$('#right_paddle').hide('slow');
		}
	else if (paddle == 'both')
		{
			$('#left_paddle').hide('slow');
			$('#right_paddle').hide('slow');
		}
}

function showPaddle(paddle)
{
	if (paddle == 'left_paddle')
		{
			$('#left_paddle').show('slow');
		}
	else if (paddle == 'right_paddle')
		{
			$('#right_paddle').show('slow');
		}
}

function update_caption(content)
{
	var info = "<i>" + content + "</i>";
	$('#caption').html(info);
}

function update_tip(content)
{
	var $target = evt.target;
	$target.children('p').html(content);
}


function hideFeaturette()
{
	//alert($(this).next());
	$("div.featurette", this).hide('fast');
	alert($(this).next());
}

function highlightFeaturette(targetItem)
{
	var targetID =	"#" + targetItem;
	//alert(targetID);
	$(targetID).triggerHandler("mouseover");
}

function unhighlightFeaturette(targetItem)
{
	var targetID =	"#" + targetItem;
	$(targetID).triggerHandler("mouseout");
}

function copyBillingtoShipping()
{
	$('#s_firstName').val($('#firstName').val());
	$('#s_lastName').val($('#lastName').val());
	$('#s_company').val($('#company').val());
	$('#s_address').val($('#address').val());
	$('#s_city').val($('#city').val());
	$('#s_state').val($('#state').val());
	$('#s_zip').val($('#zip').val());
	$('#s_country').val($('#country').val());
	$('#s_phone').val($('#phone').val());
}

//rollover text for albumButton
$(document).ready(function() {
  $('#albumButton').hover(function() {
    $('#albumCaption').html('albums');
  }, function() {
    $('#albumCaption').html('&nbsp;');
  });
});

//rollover text for searchButton
$(document).ready(function() {
  $('#searchButton').hover(function() {
    $('#searchCaption').html('search');
  }, function() {
    $('#searchCaption').html('&nbsp;');
  });
});

//rollover text for savedButton
$(document).ready(function() {
  $('#savedButton').hover(function() {
    $('#savedCaption').html('saved');
  }, function() {
    $('#savedCaption').html('&nbsp;');
  });
});

//rollover text for savedButton
$(document).ready(function() {
  $('#submitButton').hover(function() {
    $('#submitLabel').html('submit');
  }, function() {
    $('#submitLabel').html('&nbsp;');
  });
});

//rollover function for <img> use class="rollover"
$(document).ready(function() {
  $("img.rollover").hover(function() {
    $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
  }, function() {
    $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
  });
});

//rollover function for <input> buttons, use class="rollover"
$(document).ready(function() {
  $("input.rollover").hover(function() {
    $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
  }, function() {
    $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
  });
});


//featurettes hide/show mechanism and image rollover
/*
$(document).ready(function() {
$('li.featurette').hover(function() {
	$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split('.').join('-hover.'));
	$(this).children('div.featurette_item').show(100);
  }, function() {
	$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split("-hover.").join("."));
	$(this).children('div.featurette_item').hide(100);
	});
});
*/

$(document).ready(function() {
$('li.featurette').hover(function() {
	$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split('-up.').join('-hover.'));
	$(this).children('div.featurette_item').show(100);
  }, function() {
	$(this).children('a').children('img').attr('src', $(this).children('a').children('img').attr('src').split("-hover.").join("-up."));
	$(this).children('div.featurette_item').hide(100);
	});
});


