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) {
	return common_doInventorySweep(row, delay, 720); // override scrolling 
}

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);
}


// 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";


$(document).ready(function() {

	var sr_counter = 0;
	// setup search results divider on every 2 results
	$("#search_results_rows .sr_container_basics").each(
		function(i,e) {

			switch(sr_counter) {
				case 0:
					sr_counter++;
				break;
				case 1:
					sr_counter++;
					$(e).addClass("sr_home_divider");
					break;
				case 2:
					$(e).addClass("sr_home_divider");
					sr_counter = 0;
				break;
				
			}
		}
	);
	
	
	if ($("#inv-detail-pane")) {
		
		// reset the floorplan href since javascript is enabled
		$("#floorplan-tab a").attr("href","javascript:void(0);");
		
		$(".detail-tab").click(
			function() {

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

				if (tab != active_tab) {
					
					if (tab != "vt-tab") {
						$("#" + inv_panes[active_tab]).hide();
					}
					
					switch (tab) {
						case "image-tab":
							$("#" + inv_panes[tab]).fadeIn("fast");
							loadDetailSWF();
						break;
						case "vimage-tab":
							$("#" + inv_panes[tab]).fadeIn("fast");
							loadDetailiSWF();
						break;
						case "floorplan-tab":
							$("#" + inv_panes[tab]).fadeIn("fast");
						break;
						case "vt-tab":
							
							//var vtid = $(this).find("a").attr("id");
							
							//vtwin = window.open (vtid,"wcivtwindow");
							//vtwin.focus();
							window.location.href = $(this).find('a').attr('id');
					
						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 false;
			}
		);
		
		$(".detail-tab").bind("mouseenter mouseleave", 
			function(e){
				if (!$(this).hasClass("active-tab")) {
					$(this).toggleClass("hover-tab");
				}
			}
		);
		
	}
	if ($('#search_results_rows')) {
		$('#search_results_rows .sr_container_basics table').each( 
			function(i, e) {
				$(e).find('tr:first td').css({borderTop: '1px solid #000',borderBottom: '1px solid #000'  });
				$(e).find('tr:first td:first').css({borderLeft: '1px solid #000'  });
				$(e).find('tr:first td:last').css({borderRight: '1px solid #000'  });
				
			}
		);
	}
	
	
});

