var address;
var myPano;
var map = null;
var geocoder = null;

var globPoint;
var point;

Element.observe(window, 'load', function(){

	$$('#thumbHolder img').each(function(el) {
	    el.observe('click', function(e) {  
		var clicked = el.id
		scroll(0,0)
		$('banner').hide()
	    $('gallery_container').appear({duration:0.3});
	    });
	});

	$('displayImage').observe('click', function(e) {  
	var clicked = "main"
	scroll(0,0)
	$('banner').hide()
	$('gallery_container').appear({duration:0.3});
	});

	$('emailBox').hide();
	$('thankyou').hide();
	$('sending').hide();
	$('finishBtn').hide();
	$('contactBox').style.height='172px';
	$('loading').hide();
	address=$('gAddress').value;
	initialize();
	
	$('contactBox').style.height='172px';Effect.Fade('emailBox', { duration: 0.5 });Effect.Appear('contactDetails', { duration: 0.5 });$('sending').hide();$('contactBtn').show();$('thankyou').hide();
	
	
	Element.observe('backBtn', 'click', function(){
	$('contactBox').style.height='172px';Effect.Fade('emailBox', { duration: 0.5 });Effect.Appear('contactDetails', { duration: 0.5 });
	});
	
	Element.observe('contactBtn', 'click', function(){
	sendContactEmail();
	});
	
	Element.observe('finishBtn', 'click', function(){
	$('contactBox').style.height='172px';Effect.Fade('emailBox', { duration: 0.5 });Effect.Appear('contactDetails', { duration: 0.5 });$('sending').hide();$('contactBtn').show();$('thankyou').hide();
	});
	
	Element.observe('emailContact', 'click', function(){
		
	$('contactOuter').show();$('finishBtn').hide();$('contactBox').style.height='292px';Effect.Fade('contactDetails', { duration: 0.5 });Effect.Appear('emailBox', { duration: 0.5 });
   });
});




function CreateBookmarkLink(title,url) {

if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
}
else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title);
	}
else if(window.opera && window.print) { // Opera Hotlist
	return true;
	}
}


function mapView(){
	
	if ($('streetView').hasClassName('selectedMap')){
		$('streetView').toggleClassName('selectedMap');
	}
	if (!$('mapView').hasClassName('selectedMap')){
		$('mapView').toggleClassName('selectedMap');
	}
	showAddress();
	$('mapCanvas').focus();
}
function streetView(){
	if (!$('streetView').hasClassName('selectedMap')){
		$('streetView').toggleClassName('selectedMap');
	}
	if ($('mapView').hasClassName('selectedMap')){
		$('mapView').toggleClassName('selectedMap');
	}
	initialize();
	$('mapCanvas').focus();
}

function initialize() {  
$('map_view').hide();
$('street_view').show();
}

function showAddress() {
		$('street_view').hide();
	$('map_view').show();

}

function sendContactEmail(){
$('sending').show();
$('contactBtn').hide();
new Ajax.Request('/sendContactEmail.php', {
method: 'post',
parameters: $('contactFrm').serialize(true),
onSuccess: function(transport){
$('sending').hide();
$('contactOuter').hide();
$('thankyou').show();
$('finishBtn').show();
},
onFailure: function(){ $('contactBtn').show();$('sending').hide();alert('There was a problem. Please try again.'); }
});
}