function setupPanes() {
	return common_setupPanes();
}

function showPane(showID, alias, useFlash, gotoFloorplan, delay) {
	return common_showPane(showID, alias, useFlash, gotoFloorplan, delay);
}

function goto(url) {
	return common_goto(url);
}

function setupInventorySweep(rows) {
	return common_setupInventorySweep(rows);
}

function doInventorySweep(row, delay) {
	common_doInventorySweep(row, delay, 630); // override scrolling 
	$('#search_results_div').removeClass();	
	var temp_page = row+1;
	if (temp_page == sr_pages) {
		var temp_pcount = sr_page_items - ((sr_pages * sr_page_items) - sr_count);
		$('#search_results_div').addClass('homes' + temp_pcount);
	} else {
		
	}
	return false;
}

function toggleInAddition(siteID, blocks, delay) {
	return common_toggleInAddition(siteID, blocks, delay);
}	

function swapImage(image_container, new_image, clicked_image) {
        return common_swapImage(image_container, new_image, clicked_image);
}

sr_page_items = 3;
sr_count = 0;

// inventory detail active tab
active_tab = "image-tab";
inv_panes = [];
inv_panes["image-tab"] = "detail-images";
inv_panes["vimage-tab"] = "detaili-images";
inv_panes["floorplan-tab"] = "detail-floorplan";
inv_panes["vt-tab"] = "detail-vt";

swf_loaded = {
	d: false,
	di: false
}

function change_homes_tab(tab) {
	if (tab != active_tab) {
		
		if (tab != "vt-tab") {
			$("#" + inv_panes[active_tab]).hide();
		}

		if ($('#' + inv_panes[tab]).hasClass('has-flash')) {
			$('#detail-tabs').addClass('ie6fix');
		} else {
			$('#detail-tabs').removeClass('ie6fix');
		}
		
		switch (tab) {
			case "image-tab":
				$("#" + inv_panes[tab]).show(); 
				loadDetailSWF();
			break;
			case "vimage-tab":
				$("#" + inv_panes[tab]).show(); 
				loadDetailiSWF();
			break;
			case "floorplan-tab":
				$("#" + inv_panes[tab]).show(); 
			break;
			case "vt-tab":
				return true;	
			break;
		}
	
		if (tab != "vt-tab") {
			$("#" + active_tab).removeClass("active-tab").addClass("inactive-tab");
			active_tab = tab;
			$("#" + active_tab).removeClass("inactive-tab hover-tab").addClass("active-tab");
			return true;	
		}
	}
	
	return false;	
}




$(document).ready(function() {

	
	sr_count = $('#search_results_rows .sr_container_basics').length;
	sr_pages = Math.floor(sr_count / sr_page_items)+1;
	if (sr_pages == 1) {
		var temp_pcount = sr_page_items - ((sr_pages * sr_page_items) - sr_count);
		$('#search_results_div').addClass('homes' + temp_pcount);
	}

	if ($("#inv-detail-pane")) {
		
			
		$(".detail-tab").click(
			function() {

				var tab = $(this).attr("id");
				return change_homes_tab(tab);
			}
		);
		

		
	}
	
	
});

