//slide of menus	
	
	function displayMainMenu(){
		$("#cMainMenu").slideToggle(800);
		$("#sMainMenu").slideToggle(800);
		$(".mainImg").show(900) ;
		setTimeout('showDeactivateDiv()', 500);
		$("#cActivateMenu").hide();	
	}
	
	function hideMainMenu(){
		$("#cMainMenu").slideToggle(800);
		$("#sMainMenu").slideToggle(800);
		setTimeout('showActivateDiv()', 500);	
		$("#cDeactivateMenu").hide();
		$(".mainImg").hide(700);
		$("#cContent").fadeIn();	
	}
	
	function showActivateDiv() {
		$("#cActivateMenu").show();
	}
	
	function showDeactivateDiv() {
		$("#cDeactivateMenu").show();
	}
	
	function loadSelectedMov(movName){
		splitArr = movName.split("_");
		$("#movPlayerObject").attr('data',splitArr[2]);			
		$("#movPlayerObject").attr('width',splitArr[0] + 'px');			
		$("#movPlayerObject").attr('height',splitArr[1] + 'px');		
	}
	
// image preload	

	var BildArray = new Array();
	BildArray[0] = "/library/img/layout/mainMenu/stift.gif";
	BildArray[1] = "/library/img/layout/mainMenu/stiftmorphing.gif";
	BildArray[2] = "/library/img/layout/mainMenu/laptopmorphing.gif";
	BildArray[3] = "/library/img/layout/mainMenu/fahne.gif";
	BildArray[4] = "/library/img/layout/mainMenu/fahnenmorphing.gif";
	BildArray[5] = "/library/img/layout/mainMenu/bagmorphing.gif"
	BildArray[6] = "/library/img/layout/mainMenu/krawatte.gif";
	BildArray[7] = "/library/img/layout/mainMenu/krawattenmorphing1.gif";
	BildArray[8] = "/library/img/layout/mainMenu/krawattenmorphing2.gif";
	BildArray[9] = "/library/img/layout/mainMenu/stuhl.gif";
	BildArray[10] = "/library/img/layout/mainMenu/stuhlmorphing.gif";
	BildArray[11] = "/library/img/layout/mainMenu/sesselmorphing.gif";
	BildArray[12] = "/library/img/layout/mainMenu/kerze.gif";
	BildArray[13] = "/library/img/layout/mainMenu/kerzenmorphing.gif";
	BildArray[14] = "/library/img/layout/mainMenu/leuchtenmorphing.gif";


	function imagePreload()
	{
		for (i = 0; i < BildArray.length; i++) {
		Bild[i] = new Image();
		Bild[i].src = BildArray[i];
		}
	}

//image switch

	$("#stift").hover(
		function(){
			$("#stift").attr('src', '/library/img/layout/mainMenu/stiftmorphing.gif')
		},
		function(){
			$("#stift").attr('src', '/library/img/layout/mainMenu/laptopmorphing.gif')
		}
	);
	
	$("#fahne").hover(
		function(){
			$("#fahne").attr('src', '/library/img/layout/mainMenu/fahnenmorphing.gif')
		},
		function(){
			$("#fahne").attr('src', '/library/img/layout/mainMenu/bagmorphing.gif')
		}
	);
	
	$("#krawatte").hover(
		function(){
			$("#krawatte").attr('src', '/library/img/layout/mainMenu/krawattenmorphing1.gif')
		},
		function(){
			$("#krawatte").attr('src', '/library/img/layout/mainMenu/krawattenmorphing2.gif')
		}
	);
	
	$("#stuhl").hover(
		function(){
			$("#stuhl").attr('src', '/library/img/layout/mainMenu/stuhlmorphing.gif')
		},
		function(){
			$("#stuhl").attr('src', '/library/img/layout/mainMenu/sesselmorphing.gif')
		}
	);
	
	$("#kerze").hover(
		function(){
			$("#kerze").attr('src', '/library/img/layout/mainMenu/kerzenmorphing.gif')
		},
		function(){
			$("#kerze").attr('src', '/library/img/layout/mainMenu/leuchtenmorphing.gif')
		}
	);
	
// Google Maps

	function initializeMaps() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(49.946271,11.538649), 14);
        map.setUIToDefault();
        
        var baseIcon = new GIcon(G_DEFAULT_ICON);
        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);

        // Creates a marker whose info window displays the letter corresponding
        // to the given index.
        function createMarker(point) {
          // Create a lettered icon for this point using our icon class
          //var letter = String.fromCharCode("S".charCodeAt(0));
          //var letteredIcon = new GIcon(baseIcon);
          //letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

          // Set up our GMarkerOptions object
          markerOptions = { };
          var marker = new GMarker(point, markerOptions);

          return marker;
        }
        
        var latlng = new GLatLng(49.942271,11.538649);
        map.addOverlay(createMarker(latlng));
        map.openInfoWindowHtml( latlng, "<img src='/library/img/layout/MPD_Logo.jpg' style='padding-left: 40px' alt='Miro Pistek Design' title='Miro Pistek Design' />");
      }
    }

// Opens the Google Maps link in a new Window	

	function goToRoutePlaner()
	{
		window.open('http://maps.google.de/maps?f=q&source=s_q&hl=de&geocode=&q=Miro+Pistek+Design,+Bayreuth&sll=51.151786,10.415039&sspn=18.97597,46.538086&ie=UTF8&hq=Miro+Pistek+Design,&hnear=Bayreuth&ll=49.942424,11.539432&spn=0.009142,0.022724&z=16', '', ''); 
		return false;
	} 
	
// Opens a link in a new window

	function openExternalLink(link)
	{
		window.open(link, '', ''); 
		return false;
	} 
	
// Set the background images of each design element

	function setBackgroundImages(picId)
	{
		$("#cSideMenu").css("background-image","url(/library/img/layout/bgImages/" + picId + "-02.jpg)");
		$("#cContentBox").css("background-image","url(/library/img/layout/bgImages/" + picId + "-03.jpg)");
		$("#cFooter").css("background-image","url(/library/img/layout/bgImages/" + picId + "-04.jpg)");
	}
	
// initilize the document after the ajax request

	function makeDocumentReady()
	{
		$('.scroll-pane').jScrollPane();				
		$('.menuLink').bind('click',function(event){
			event.preventDefault();
		    $.ajax({
	            url: this.href + "?type=ajax",
	            cache: false,
	            type: "POST",
	            success: function(html) {
	                $('#ajaxResponse').html(html);
	                makeDocumentReady();
					setBackgroundImages($("#bgPicId").html());
	            }
	        })	
		 });
		 
	}
		
	function showAndHide(showId, hideId){
		$('#' + showId).show();
		$('#' + hideId).hide();
	}
		
	function muteMusic() {
		$("#jplayer_volume_min").click();
	}
