function change_button(obj,status,design)
{
	if (status)
		obj.src = "http://www.myvisuallistings.com/virtual-tour-images/designs/"+design+"/menu/"+ obj.id +"-on.jpg";	
	else
		obj.src = "http://www.myvisuallistings.com/virtual-tour-images/common/"+ obj.id +"-over.jpg";
}	

function checkMailForm(){
	form = document.forms['friend'];
	sender = 0;
	error ="";
	
	if (form.elements['receiver'].value == "")
	{
		error += "• Please enter a valid email address to send the listing to\n";
	}
	else
	{
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test(form.elements['receiver'].value))
		{
			error += "• Please enter a valid email address to send the listing to\n";
		}	
	}
	
	if (form.elements['name'].value == "")
	{
		error += "• Please enter your name in the name field.\n";
	}
	
	if (form.elements['sender'].value == "")
	{
		error += "• Please enter your email address\n";
	}
	else
	{
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test(form.elements['sender'].value))
		{
			error += "• Please enter your valid email address\n";
		}	
	}
	
	
	
	if (form.elements['message'].value == "")
	{
		error += "• Please enter a message in the message field.\n";
		sender = 1;
	}
	
	if (error!=""){alert(error);return false;}
	form.elements['act'].value = 'sendmail';
	form.submit();
}

function popup(URL)
{
	myRef = window.open(''+URL,'mywin',
'left=20,top=20,width=470,height=350,toolbar=0,resizable=0');
}

function open_window(URL,Name) {
	h = screen.availHeight;
    w = screen.availWidth;
	window.open(URL,"","resizable=yes,toolbar=no,locationbar=no,menubar=no,scrollbars=yes,status=no,height="+h+",width="+w);
}

function initialize() {
	if (GBrowserIsCompatible())
	{
		if (mapLat != null)
		{
			map = new GMap2(document.getElementById("map_canvas"));
			map.setCenter(new GLatLng(37.4419, -122.1419), 13);
			var point  = new GLatLng(mapLat,mapLong);
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			map.setMapType(G_NORMAL_MAP);
			map.setCenter(point, 13);
			var marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml(address);		
		}
		else
		{
			map = new GMap2(document.getElementById("map_canvas"));
			map.setCenter(new GLatLng(37.4419, -122.1419), 13);
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			map.setMapType(G_NORMAL_MAP);
			
			geocoder = new GClientGeocoder();
			showAddress(address);
		}
	}
}

function hideHomeAddress(){
	setTimeout("hideAddress()",3000);
}

function hideAddress()
{
	//alert(document.getElementById('homeAddress'));
	document.getElementById('homeAddress').style.display = "none";
}


function showAddress() {
	if (geocoder) {
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
			  		//alert(address + " not found");
				} else {
				  map.setCenter(point, 16);
				  var marker = new GMarker(point);
				  map.addOverlay(marker);
				  marker.openInfoWindowHtml(address);
				}
			}
		);
	}
}


function setMusicStatus(myValue)
{
	musicStatus = myValue;
}

function panoramicVoice(status)
{
	if (status)
	{
		if (musicStatus == "on")
		{SendDataFromPanoramic("myMusicObject", 10);}
	}
	else
	{
		if (musicStatus == "on")
		{SendDataFromPanoramic("myMusicObject", 100);}
	}
}

function SendDataFromPanoramic(flashMovie, myValue)
{
	var flashMovie = getFlashMovieObject(flashMovie);
	flashMovie.SetVariable("/:setNewVolume", myValue);
}



function getFlashMovieObject(movieName)
{
	if (window.document[movieName]) 
	{
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName])
		return document.embeds[movieName]; 
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}


