// JavaScript Document

// GLOBAL VARS
var gObj_fit_current_property_item = { 'mlsnum':'', 'item_idx':'', 'active_div_id':''};

// GLOBAL FUNCTINS....

function fit_showMap(){	
	f_tabManagerR(0);
	propertyMap(gObj_fit_current_property_item.item_idx);
}

function fit_showDetails(){
			f_tabManagerR(1); // ACTIVE DETAILS
}

function fit_initDetails(set_active){
	
	if(set_active){
			f_tabManagerR(1); // ACTIVE DETAILS					
	}
	
		document.getElementById('content-holder-details').innerHTML = '<div id="details-anim" style="padding:5px;"><img src="img/ajax_animation_details.gif" width="70" height="64" alt="" title="" border="0" /></div>';
			propertyDetail(gObj_fit_current_property_item.mlsnum);
}

function fit_initDisplay(mlsn, iidx, is_map, div_id){
		
		gObj_fit_current_property_item.mlsnum = mlsn;
		gObj_fit_current_property_item.item_idx = iidx;
			
				document.getElementById(div_id).className = "res-envelope-active"; // mark as active				
				document.getElementById(gObj_fit_current_property_item.active_div_id).className = "res-envelope"; // reset the old one
				
		gObj_fit_current_property_item.active_div_id = div_id; // set new one as active...
		
		if(is_map){
			fit_showMap();
			fit_initDetails(false);
		}
		else{
			fit_initDetails(true);
		}
	
}

// UTILITY

function switchPropertyType(type_id, where){
	var current_page = location.href;	
	var lidx = current_page.lastIndexOf("/");	
	
	if((lidx+1) == current_page.length){					
			if(where == "LD_2"){
					window.location.href = 'land_search.php';
			}		
	}else{
		
			if((current_page.substring((lidx+1), current_page.length)) == "index.php"){					
				if(where == "LD_2"){
						window.location = 'land_search.php';
				}				
			}
			
			if((current_page.substring((lidx+1), current_page.length)) == "land_search.php"){				
					
				if(where == "RE_1"){
					window.location = 'index.php';
				}
			}
			
	}
	
return;	
}
