function ro()
{
	$('.ro').mouseover( function()
	{
		rep = ".";
		ext = $(this).attr('src').substr(-4, 4);
		src = $(this).attr('src').replace(rep, "-on.");
		$(this).attr('src', src);
		
	});
	$('.ro').mouseout( function()
	{
		rep = "-on.";
		ext = $(this).attr('src').substr(-4, 4);
		src = $(this).attr('src').replace(rep, ".");
		$(this).attr('src', src);
		
	});
}

function bgro()
{
	$('.bgro').mouseover( function()
	{
		rep = ".";
		ext = $(this).css('background-image').substr(-4, 4);
		src = $(this).css('background-image').replace(rep, "-on.");
		$(this).attr('src', src);
		
	});
	$('.bgro').mouseout( function()
	{
		rep = "-on.";
		ext = $(this).css('background-image').substr(-4, 4);
		src = $(this).css('background-image').replace(rep, ".");
		$(this).attr('src', src);
		
	});
}

function datepick(){
	if( $('.date').length > 0 ){
		$(".date").datepicker({ 
			dateFormat: "mm/dd/yy", 
			showOn: "both", 
			buttonImage: "/media/img/bg/or/cal-icon.gif", 
			buttonImageOnly: true,
			dayNamesMin: ['S','M','T','W','T','F','S']
		});
	}
}

function datepick(){
	if( $('.keywords-date').length > 0 ){
		$(".keywords-date").datepicker({ 
			dateFormat: "mm/dd/yy", 
			showOn: "both", 
			buttonImage: "/media/img/form/input-keywords-datepicker.gif", 
			buttonImageOnly: true,
			dayNamesMin: ['S','M','T','W','T','F','S']
		});
	}
	if( $('.listing-search-events .keywords-date').length > 0 ){
		$(".listing-search-events .keywords-date").datepicker({ 
			dateFormat: "mm/dd/yy", 
			dayNamesMin: ['S','M','T','W','T','F','S']
		});
	}
}

function reserverationTabs(){
	if( $('#online-reservations .nav').length > 0 ){
		$("#online-reservations .nav").tabs();
	}
}

function increaseFontSize(){
	$('#adjust-font a.inc').click( function(){
		curSize = $('body').css('font-size');
		$('body').css('font-size','75%');
		return false;
	});
}

function decreaseFontSize(){
	$('#adjust-font a.dec').click( function(){
		curSize = $('body').css('font-size');
		$('body').css('font-size','62.5%');
		return false;
	});
}

function tablesort(){
	if( $('table.listing-table').length > 0 ){
		$('table.listing-table').tablesorter({
		//	textExtraction: function(node) {
		//		return node.childNodes[0].innerHTML;
		//	}
		//	debug: true
		}).tablesorterPager({container: $("#pager")});
	}
}

$(document).ready( function()
{
	if( $('.round_3').length > 0 ){
		DD_roundies.addRule('.round_3', '3px', true);
	}
	ro();
	bgro();
	datepick();
	reserverationTabs();
	increaseFontSize();
	decreaseFontSize();
//	tablesort();
});