jQuery.tablesorter.defaults.widgets = ['zebra', 'columnHighlight'];
jQuery(document).ready(function() {
	jQuery("img.rollover").hover(
		function(){
			this.src = this.src.replace("_off","_on");
		},
		function(){
			this.src = this.src.replace("_on","_off");
		}
	);
	jQuery.preloadImages = function(){
		for(var i = 0; i<arguments.length; i++){
			jQuery("<img>").attr("src", arguments[i]);
		}
	}
	jQuery.preloadImages("/images/calendar_off.jpg", "/images/calendar_on.jpg", "/images/advertise_off.jpg", "/images/advertise_on.jpg",
						"/images/logout_off.jpg", "/images/logout_on.jpg", "/images/BannerRollover.gif", "/images/bluconbgcolor01.jpg",
						"/images/CategoryColorTop1.png", "/images/CategoryColorTop2.png", "/images/CategoryColorTop3.png", "/images/CategoryColorTop4.png",
						"/images/CategoryColorTop5.png", "/images/CategoryColorTop6.png", "/images/CategoryColorTop7.png", "/images/CategoryColorTop8.png",
						"/images/featuredvideostxtimg01.jpg", "/images/categoriestopcorner01.jpg", "/images/CategoryImage_1.jpg", "/images/CategoryImage_2.jpg",
						"/images/CategoryImage_3.jpg", "/images/CategoryImage_4.jpg", "/images/CategoryImage_5.jpg", "/images/CategoryImage_6.jpg",
						"/images/CategoryImage_7.jpg", "/images/CategoryImage_8.jpg", "/images/catlabel01.jpg", "/images/catdivider01.jpg",
						"/images/catpartoftown01.jpg", "/images/catbottomcorner01.jpg", "/images/ComingSoon.jpg", "/images/Submit.png",
						"/images/Read.gif", "/images/layoutBGguids/footerfoodlayoutguide01.jpg", "/images/CalendarNoEvents.png");
});

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum){
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
function PopUp(url){
	window.open (url,"_blank","width=980,height=820"); 
}
function smallPopUp(url){
	window.open (url,"_blank","width=620,height=500,scrollbars=1"); 
}

var map = null;
var geocoder = null;

function initialize() {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("ListingMap"));
	map.setCenter(new GLatLng(37.4419, -122.1419), 13);
	geocoder = new GClientGeocoder();
	map.addControl(new GSmallMapControl());
  }
}
function showAddress(address) {
  if (geocoder) {
	geocoder.getLatLng(
	  address,
	  function(point) {
		if (!point) {
		  //alert(address + " not found");
		  point = "(33.754487, -84.389663)";
		  map.setCenter(point, 13);
		  var marker = new GMarker(point);
		  map.addOverlay(marker);
		} else {
		  map.setCenter(point, 13);
		  var marker = new GMarker(point);
		  map.addOverlay(marker);
		  //marker.openInfoWindowHtml(address);
		}
	  }
	);
  }
}
function ShowRateForm() {
	jQuery('#ReadReviewsBar').css('z-index','1');
	jQuery('#RatingBar').css('z-index','2');
	jQuery('#featuredvideosbar').hide();
	jQuery('#multiple_listings_area').hide();
}
function ShowReviews() {
	jQuery('#ReadReviewsBar').css('z-index','2');
	jQuery('#RatingBar').css('z-index','1');
	jQuery('#featuredvideosbar').hide();
	jQuery('#multiple_listings_area').hide();
}
function ShowDefault() {
	jQuery('#ReadReviewsBar').css('z-index','1');
	jQuery('#RatingBar').css('z-index','1');
	jQuery('#featuredvideosbar').show();
	jQuery('#multiple_listings_area').show();
}
function Stats(Statistic, ListingID){
	jQuery.get("/ajax/SaveStat.php", { "Statistic": Statistic, "ListingID": ListingID } );
}
function ts( table ){
	$("#" + table).tablesorter({debug: false}).tablesorterPager({ container: $("#" + table + "_pager"), positionFixed: false });
}

