// JavaScript Document

//  var stockholm = new google.maps.LatLng(51.8510691, 4.3186428);
//  var parliament = new google.maps.LatLng(51.8510691, 4.3186428);
  var marker;
  var map;

var imageGalleryIndex = new Array();

$(document).ready(function(){

	if($('#map_canvas').attr('id')){
	 initialize();
	}


	initinnerpagelinks();
	initsalonlinks();
	initteamlinks();
});//END document ready

function initialize() {

    var mapOptions = {
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: stockholm
    };

    map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);
          
    marker = new google.maps.Marker({
      map:map,
      draggable:true,
      animation: google.maps.Animation.DROP,
      position: parliament
    });
    google.maps.event.addListener(marker, 'click', toggleBounce);
  }

  function toggleBounce() {

    if (marker.getAnimation() != null) {
      marker.setAnimation(null);
    } else {
      marker.setAnimation(google.maps.Animation.BOUNCE);
    }
  }
	
function initinnerpagelinks(){
		

		//Hide the all but the first divs with class iplcontent
			$('.iplcontent:not(:first)').hide();
			$('.iplcontent:first').show();//<ie9 hide al elements
		//loop over links
		$('#pageinternallinks a').each(function(index) {
			if($(this).attr('accesskey')){

				$(this).bind('click', function(){
//					console.log($(this).attr('accesskey'));
					switchContent('iplcontent',$(this).attr('accesskey'));
				});
			}
		});
}

function initsalonlinks(){
	

	
		if($('.salon_sections')){

//Hide the all but the first divs with class salon_section
			$('.salon_section:not(:first)').hide();
			$('.salon_section:first').show();//<ie9 hide al elements
		
			//Select all links witch contain 'salon_' as value in the accesskey attr
			$('a[accesskey^=salon_]').each(function(index){	
	///			console.log('----'+$(this).attr('accesskey'));	
					$(this).bind('click', function(){
	//					console.log($(this).attr('accesskey'));
						switchContent('salon_section',$(this).attr('accesskey'));
					});
			});
		}
}

function initteamlinks(){

		if($('#team_sections')){

			//Hide the all but the first divs with class salon_section
			$('.team_section').hide();
			$('.team_section:first').show();//<ie9 hide al elements
		
			//Select all links witch contain 'salon_' as value in the accesskey attr
			$('a[accesskey^=team_]').each(function(index){	
	///			console.log('----'+$(this).attr('accesskey'));	
					$(this).bind('click', function(){
	//					console.log($(this).attr('accesskey'));
						switchContent('team_section',$(this).attr('accesskey'));
					});
			});
		}
}

function switchContent(myclass,id){
	//hide all div 
	$('.'+myclass).hide();
	$('#'+id).show();
}




