// JavaScript Document

jQuery.noConflict();
jQuery(document).ready(function($) {

		// Email spam suojaus
		$('body').find('.' + 'protect').each(function() {
			var $this = $(this);
			var s = $this.text().replace(' [at] ', '&#64;');
			$(this).html('<a href="mailto:' + s + '">' + s + '</a>');
		});
		
		// Liikkeen kerrokset
		$( "#stores" ).accordion({
			autoHeight: false,
			navigation: true,
			animated: 'easeslide'
		});
		
		//Pohjapiirrokset
		$( "#button2" ).click(function() {
			$('.floor2').show('slow');
			$('.floor1').hide('slow');
		});
		
		$( "#button1" ).click(function() {
			$('.floor1').show('slow');
			$('.floor2').hide('slow');
		});
		
		//Google Map
		$('#map').gMap({
		controls: false,
		scrollwheel: true,
		markers: [{
			/*icon: {
				image: '<?php bloginfo( 'template_url' ); ?>/images/icon-pin.png',
                iconsize: [47, 47],
                iconanchor: [37, 20]
			},*/
			latitude: 60.9936786,
            longitude: 24.4603972
		}],
		zoom: 15
		});
		
		// Lomakkeet
		$('input[type="text"], textarea').focus(function() {
        if (this.value == this.defaultValue){
            this.value = '';
        }
        if(this.value != this.defaultValue){
            this.select();
        }
		});
		$('input[type="text"], textarea').blur(function() {
			if (this.value == ''){
				this.value = this.defaultValue;
			}
		});
		
});

	//Google Steer View
	var myPano;
    
    function initialize() {
      var fenwayPark = new GLatLng(60.994208,24.460569);
      panoramaOptions = { latlng:fenwayPark };
      myPano = new GStreetviewPanorama(document.getElementById("pano"), panoramaOptions);
      GEvent.addListener(myPano, "error", handleNoFlash);
    }
    
    function handleNoFlash(errorCode) {
      if (errorCode == FLASH_UNAVAILABLE) {
        alert("Error: Flash doesn't appear to be supported by your browser");
        return;
      }
    }
	
