$(document).ready(function() {
	var toggled = true;
	$('#btm').fadeOut("slow");
	openDiv = "ssp";    
	resetTheMap = function(){
	$('#mapDetails').hide();
	$('#map').show();
	$('#btm').fadeOut("slow");

	map.checkResize();
	}
	
	
	$('#showInfo').click(function() {
    $('#moreInfo').slideToggle();
	if(toggled==false){$('#showInfo').html('Show Details'); toggled=true;} 
   else{$('#showInfo').html('Hide Details');toggled=false;} 
    return false; 
  });
	
	resetMyMap = function(){
		$('#mapDetails').hide();
	    $('#map').show();
	    $('#btm').fadeOut("slow");
		map.checkResize();
		map.setCenter(new GLatLng(resortLat,resortLong), resortZoom);
		map.closeInfoWindow();
		
}
    xPoint = function(){
		map.checkResize();
		map.returnToSavedPosition();
		
}
	
	recenterMap = function(){
		map.checkResize();
		map.setCenter(new GLatLng(resortLat,resortLong), resortZoom);
	 }
					   

    // show resort map
	openPropPanel = function(){
			$('#mapDetails').hide();
			$('#map').fadeIn("slow");
			$('#btm').fadeOut("slow");
	};

myClick = function(i) {
	    $('#mapDetails').hide();
		$('#map').fadeIn("slow");
	    GEvent.trigger(gmarkers[i],"click");
}

reloadTabs = function(i){
	$('#tabs').tabs( 'destroy' )
	$("#tabs").tabs({ cache: false, spinner: '', selected:0 });
	$('#tabs').tabs( 'remove' , 0 );
	$('#tabs').tabs( 'add' , 'prop_details.cfm?prop='+i , 'Propery Details' , [0] );
	$('#tabs').tabs( 'remove' , 1 );
	$('#tabs').tabs( 'add' , 'prop_gallery.cfm?prop='+i , 'Propery Gallery' , [1] );
	}


}); // End On page load

function setMapCenter(){
	//alert(resortLat+" "+resortLong);
	map.setCenter(new GLatLng(resortLat,resortLong), resortZoom);
}
	

function xHTML(i){
	myData = "";
	return myData;
}

function closePropPanel(i){
		$('#map').hide();
		$('#mapDetails').fadeIn("slow");
		$('#btm').fadeIn("slow");
		reloadTabs(i);
						
};

function hideMe(i){
	//alert(i);
	$('#downs').hide();
}
       
function getInfoContent(name){
	$.ajax({type: "GET",url: "ajaxTest_0.cfm", data: "whichProp=" + name + "&myResort=" + wResort, success: function(html){
     lastMarker.openInfoWindow(html);
   }});
}

// Call inc_propDetails.cfm and send propCode
function getPropDetails(propCode){
	 $('#help').hide();
	 $('#mapContainer').hide();
	 $('#mapDetails').fadeIn("slow");
	 $("#detailsContainer").empty().append('<IFRAME src="inc_propDetails.cfm?propCode='+propCode+'&hideGRH='+hideGRH+'" width="700" height="492" frameborder="0" scrolling="no">').show();
	 openDiv = "detailsContainer";
   
}

function clearTabContainers(){
	$("#360s").empty();
	$('#'+openDiv).hide();
	}

function showMapContainer(){
	clearTabContainers();
	$('#help').show();
	$('#mapContainer').fadeIn("slow");
	map.checkResize();
	setMapCenter();
	map.closeInfoWindow();
	openDiv = "mapContainer";
	}

function showSSPContainer(){
	clearTabContainers();
	$('#ssp').show();
	openDiv = "ssp";
}

function show360Container(){
	clearTabContainers();
	$("#360s").empty().append('<IFRAME src="sub_360V2.cfm?myResort='+wResort+'" width="700" height="492" frameborder="0" scrolling="no" id="myId">').show();
	openDiv = "360s";
	};

function returnToMap(){
	clearTabContainers();
	$('#mapContainer,#help').fadeIn("slow");
	map.checkResize();
	openDiv = "mapContainer";
	}
	function showAlert(){
		alert("Got the call");
	}
